From 7ec019cd45798753637f7e938f80a4e96dc40638 Mon Sep 17 00:00:00 2001 From: camthehaxman Date: Wed, 17 Jan 2024 14:15:08 -0600 Subject: [PATCH 1/4] make the UI actually legible on 3DS --- .gitignore | 3 +++ src/LBackend.c | 10 ++++++++-- src/LWidgets.c | 10 ++++++++-- src/Launcher.c | 2 +- src/Window_3DS.c | 12 ++++++------ 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 38a20ef08..5c2e96054 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ android/app/.externalNativeBuild/ android/local.properties *.iml +# 3DS build results +build-3ds/ + # Build results [Dd]ebug/ [Dd]ebugPublic/ diff --git a/src/LBackend.c b/src/LBackend.c index d9e84c7bd..66d9dfb53 100644 --- a/src/LBackend.c +++ b/src/LBackend.c @@ -47,8 +47,14 @@ static int flagXOffset, flagYOffset; static void HookEvents(void); void LBackend_Init(void) { - xBorder = Display_ScaleX(1); xBorder2 = xBorder * 2; xBorder3 = xBorder * 3; xBorder4 = xBorder * 4; - yBorder = Display_ScaleY(1); yBorder2 = yBorder * 2; yBorder3 = yBorder * 3; yBorder4 = yBorder * 4; + xBorder = Display_ScaleX(1); + yBorder = Display_ScaleY(1); + + if (xBorder < 1) { xBorder = 1; } + if (yBorder < 1) { yBorder = 1; } + + xBorder2 = xBorder * 2; xBorder3 = xBorder * 3; xBorder4 = xBorder * 4; + yBorder2 = yBorder * 2; yBorder3 = yBorder * 3; yBorder4 = yBorder * 4; xInputOffset = Display_ScaleX(5); yInputOffset = Display_ScaleY(2); diff --git a/src/LWidgets.c b/src/LWidgets.c index 8b7ca47ae..3893bf907 100644 --- a/src/LWidgets.c +++ b/src/LWidgets.c @@ -19,8 +19,14 @@ static int oneX, twoX, fourX; static int oneY, twoY, fourY; void LWidget_CalcOffsets(void) { - oneX = Display_ScaleX(1); twoX = oneX * 2; fourX = oneX * 4; - oneY = Display_ScaleY(1); twoY = oneY * 2; fourY = oneY * 4; + oneX = Display_ScaleX(1); + oneY = Display_ScaleY(1); + + if (oneX < 1) { oneX = 1; } + if (oneY < 1) { oneY = 1; } + + twoX = oneX * 2; fourX = oneX * 4; + twoY = oneY * 2; fourY = oneY * 4; flagXOffset = Display_ScaleX(2); flagYOffset = Display_ScaleY(6); diff --git a/src/Launcher.c b/src/Launcher.c index 36d9c6bae..fa90ab531 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -529,7 +529,7 @@ void Launcher_DrawTitle(struct FontDesc* font, const char* text, struct Context2 int x; /* Skip dragging logo when very small window to save space */ - if (WindowInfo.Height < 300) return; + if (WindowInfo.Height < 240) return; DrawTextArgs_Make(&args, &title, font, false); x = ctx->width / 2 - Drawer2D_TextWidth(&args) / 2; diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 977667faf..5652e1992 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -18,9 +18,9 @@ static Result irrst_result; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on 3DS -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } +// Render everything at half size due to the small resolution +int Display_ScaleX(int x) { return x / 2; } +int Display_ScaleY(int y) { return y / 2; } // Note from https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/gfx.h @@ -42,8 +42,8 @@ void Window_Init(void) { DisplayInfo.Width = height; // deliberately swapped DisplayInfo.Height = width; // deliberately swapped DisplayInfo.Depth = 4; // 32 bit - DisplayInfo.ScaleX = 1; - DisplayInfo.ScaleY = 1; + DisplayInfo.ScaleX = 0.5; + DisplayInfo.ScaleY = 0.5; WindowInfo.Width = height; // deliberately swapped WindowInfo.Height = width; // deliberately swapped @@ -277,4 +277,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) { cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) { return ERR_NOT_SUPPORTED; } -#endif \ No newline at end of file +#endif From 4d2de70f45ed63c9ec2e9f300b53e8f399e55a41 Mon Sep 17 00:00:00 2001 From: camthehaxman Date: Thu, 18 Jan 2024 19:13:52 -0600 Subject: [PATCH 2/4] increase stick deadzone to 16 --- src/Window_3DS.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 5652e1992..3ff477d13 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -101,10 +101,10 @@ static void HandleButtons(u32 mods) { static void ProcessJoystickInput(circlePosition* pos, double delta) { float scale = (delta * 60.0) / 8.0f; - + // May not be exactly 0 on actual hardware - if (Math_AbsI(pos->dx) <= 8) pos->dx = 0; - if (Math_AbsI(pos->dy) <= 8) pos->dy = 0; + if (Math_AbsI(pos->dx) <= 16) pos->dx = 0; + if (Math_AbsI(pos->dy) <= 16) pos->dy = 0; Event_RaiseRawMove(&PointerEvents.RawMoved, pos->dx * scale, -pos->dy * scale); } @@ -148,7 +148,6 @@ void Window_ProcessEvents(double delta) { hidCircleRead(&pos); ProcessJoystickInput(&pos, delta); } - if (Input.RawMode && irrst_result == 0) { circlePosition pos; irrstScanInput(); From c156484de27b81c6ae17bfa1a5d74c7c84692cdd Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 19 Jan 2024 18:33:24 +1100 Subject: [PATCH 3/4] Add audio backend function for allocating audio chunks Also try to fix stick drift on 3DS (Thanks camthesaxman) --- src/Audio.c | 64 +++++++++++++++++++++++++++++++++++------------ src/Audio.h | 11 +++++--- src/Http_Worker.c | 17 ++++++++----- src/Vectors.h | 11 ++++---- src/Window_3DS.c | 4 +-- src/_GLShared.h | 2 +- 6 files changed, 76 insertions(+), 33 deletions(-) diff --git a/src/Audio.c b/src/Audio.c index 4316802da..a862243f2 100644 --- a/src/Audio.c +++ b/src/Audio.c @@ -248,14 +248,14 @@ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate return 0; } -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 size) { +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 size) { ALuint buffer; ALenum err; if (!ctx->free) return ERR_INVALID_ARGUMENT; buffer = ctx->freeIDs[--ctx->free]; - _alBufferData(buffer, ctx->channels, data, size, ctx->sampleRate); + _alBufferData(buffer, ctx->channels, chunk, size, ctx->sampleRate); if ((err = _alGetError())) return err; _alSourceQueueBuffers(ctx->source, 1, &buffer); if ((err = _alGetError())) return err; @@ -299,7 +299,7 @@ cc_result Audio_PlayData(struct AudioContext* ctx, struct AudioData* data) { data->sampleRate = Audio_AdjustSampleRate(data); if ((res = Audio_SetFormat(ctx, data->channels, data->sampleRate))) return res; - if ((res = Audio_QueueData(ctx, data->data, data->size))) return res; + if ((res = Audio_QueueChunk(ctx, data->data, data->size))) return res; if ((res = Audio_Play(ctx))) return res; return 0; } @@ -322,6 +322,14 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) { if (err) String_AppendConst(dst, err); return err != NULL; } + +void* Audio_AllocChunk(cc_uint32 size) { + return Mem_TryAlloc(size, 1); +} + +void Audio_FreeChunk(void* data) { + Mem_Free(data); +} #elif defined CC_BUILD_WINMM /*########################################################################################################################* *------------------------------------------------------WinMM backend------------------------------------------------------* @@ -448,7 +456,7 @@ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate return res; } -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 dataSize) { +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 dataSize) { cc_result res = 0; WAVEHDR* hdr; int i; @@ -458,7 +466,7 @@ cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 dataSi if (!(hdr->dwFlags & WHDR_DONE)) continue; Mem_Set(hdr, 0, sizeof(WAVEHDR)); - hdr->lpData = (LPSTR)data; + hdr->lpData = (LPSTR)chunk; hdr->dwBufferLength = dataSize; hdr->dwLoops = 1; @@ -504,7 +512,7 @@ cc_result Audio_PlayData(struct AudioContext* ctx, struct AudioData* data) { data->sampleRate = Audio_AdjustSampleRate(data); if ((res = Audio_SetFormat(ctx, data->channels, data->sampleRate))) return res; - if ((res = Audio_QueueData(ctx, data->data, data->size))) return res; + if ((res = Audio_QueueChunk(ctx, data->data, data->size))) return res; return 0; } @@ -516,6 +524,14 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) { String_AppendConst(dst, buffer); return true; } + +void* Audio_AllocChunk(cc_uint32 size) { + return Mem_TryAlloc(size, 1); +} + +void Audio_FreeChunk(void* data) { + Mem_Free(data); +} #elif defined CC_BUILD_OPENSLES /*########################################################################################################################* *----------------------------------------------------OpenSL ES backend----------------------------------------------------* @@ -676,8 +692,8 @@ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate return 0; } -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 size) { - return (*ctx->playerQueue)->Enqueue(ctx->playerQueue, data, size); +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 size) { + return (*ctx->playerQueue)->Enqueue(ctx->playerQueue, chunk, size); } static cc_result Audio_Pause(struct AudioContext* ctx) { @@ -712,7 +728,7 @@ cc_result Audio_PlayData(struct AudioContext* ctx, struct AudioData* data) { /* rate is in milli, so 1000 = normal rate */ if ((res = (*ctx->playerRate)->SetRate(ctx->playerRate, data->rate * 10))) return res; - if ((res = Audio_QueueData(ctx, data->data, data->size))) return res; + if ((res = Audio_QueueChunk(ctx, data->data, data->size))) return res; if ((res = Audio_Play(ctx))) return res; return 0; } @@ -744,6 +760,14 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) { if (err) String_AppendConst(dst, err); return err != NULL; } + +void* Audio_AllocChunk(cc_uint32 size) { + return Mem_TryAlloc(size, 1); +} + +void Audio_FreeChunk(void* data) { + Mem_Free(data); +} #elif defined CC_BUILD_3DS /*########################################################################################################################* *-------------------------------------------------------3DS backend-------------------------------------------------------* @@ -804,7 +828,7 @@ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate return 0; } -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 dataSize) { +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 dataSize) { ndspWaveBuf* buf; for (int i = 0; i < ctx->count; i++) @@ -814,7 +838,7 @@ cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 dataSi if (buf->status == NDSP_WBUF_QUEUED || buf->status == NDSP_WBUF_PLAYING) continue; - buf->data_pcm16 = data; + buf->data_pcm16 = chunk; buf->nsamples = dataSize / 2; // 16 bit samples //Platform_Log1("PLAYING ON: %i", &ctx->chanID); ndspChnWaveBufAdd(ctx->chanID, buf); @@ -858,7 +882,7 @@ cc_result Audio_PlayData(struct AudioContext* ctx, struct AudioData* data) { cc_result res; if ((res = Audio_SetFormat(ctx, data->channels, data->sampleRate))) return res; - if ((res = Audio_QueueData(ctx, data->data, data->size))) return res; + if ((res = Audio_QueueChunk(ctx, data->data, data->size))) return res; return 0; } @@ -892,7 +916,7 @@ void Audio_Close(struct AudioContext* ctx) { cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate) { return ERR_NOT_SUPPORTED; } -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 size) { +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 size) { return ERR_NOT_SUPPORTED; } cc_result Audio_Play(struct AudioContext* ctx) { return ERR_NOT_SUPPORTED; } @@ -922,6 +946,14 @@ cc_bool Audio_DescribeError(cc_result res, cc_string* dst) { String_AppendUtf8(dst, buffer, len); return len > 0; } + +void* Audio_AllocChunk(cc_uint32 size) { + return Mem_TryAlloc(size, 1); +} + +void Audio_FreeChunk(void* data) { + Mem_Free(data); +} #endif /*########################################################################################################################* @@ -1032,7 +1064,7 @@ static cc_result Sound_ReadWaveData(struct Stream* stream, struct Sound* snd) { if (bitsPerSample != 16) return WAV_ERR_SAMPLE_BITS; size -= WAV_FMT_SIZE; } else if (fourCC == WAV_FourCC('d','a','t','a')) { - snd->data = Mem_TryAlloc(size, 1); + snd->data = Audio_AllocChunk(size); snd->size = size; if (!snd->data) return ERR_OUT_OF_MEMORY; @@ -1310,7 +1342,7 @@ static cc_result Music_Buffer(cc_int16* data, int maxSamples, struct VorbisState } if (Audio_MusicVolume < 100) { ApplyVolume(data, samples, Audio_MusicVolume); } - res2 = Audio_QueueData(&music_ctx, data, samples * 2); + res2 = Audio_QueueChunk(&music_ctx, data, samples * 2); if (res2) { music_stopping = true; return res2; } return res; } @@ -1339,7 +1371,7 @@ static cc_result Music_PlayOgg(struct Stream* source) { samplesPerSecond = channels * sampleRate; cur = 0; - data = (cc_int16*)Mem_TryAlloc(chunkSize * AUDIO_MAX_BUFFERS, 2); + data = (cc_int16*)Audio_AllocChunk(chunkSize * AUDIO_MAX_BUFFERS * 2); if (!data) { res = ERR_OUT_OF_MEMORY; goto cleanup; } /* fill up with some samples before playing */ diff --git a/src/Audio.h b/src/Audio.h index f806bc46d..9c2613b1a 100644 --- a/src/Audio.h +++ b/src/Audio.h @@ -48,11 +48,11 @@ void Audio_Close(struct AudioContext* ctx); /* Sets the format of the audio data to be played. */ /* NOTE: Changing the format can be expensive, depending on the backend. */ cc_result Audio_SetFormat(struct AudioContext* ctx, int channels, int sampleRate); -/* Queues the given audio data for playing. */ +/* Queues the given audio chunk for playing. */ /* NOTE: You MUST ensure Audio_Poll indicates a buffer is free before calling this. */ /* NOTE: Some backends directly read from the data - therefore you MUST NOT modify it */ -cc_result Audio_QueueData(struct AudioContext* ctx, void* data, cc_uint32 size); -/* Begins playing audio. Audio_QueueData must have been used before this. */ +cc_result Audio_QueueChunk(struct AudioContext* ctx, void* chunk, cc_uint32 size); +/* Begins playing audio. Audio_QueueChunk must have been used before this. */ cc_result Audio_Play(struct AudioContext* ctx); /* Polls the audio context and then potentially unqueues buffer */ /* Returns the number of buffers being played or queued */ @@ -65,4 +65,9 @@ cc_result Audio_PlayData(struct AudioContext* ctx, struct AudioData* data); cc_bool Audio_FastPlay(struct AudioContext* ctx, struct AudioData* data); /* Outputs more detailed information about errors with audio. */ cc_bool Audio_DescribeError(cc_result res, cc_string* dst); + +/* Allocates a chunk of data to store audio samples */ +void* Audio_AllocChunk(cc_uint32 size); +/* Frees a previously allocated chunk of data */ +void Audio_FreeChunk(void* chunk); #endif diff --git a/src/Http_Worker.c b/src/Http_Worker.c index 4e0ed3cfb..e8ba3dfdc 100644 --- a/src/Http_Worker.c +++ b/src/Http_Worker.c @@ -708,7 +708,7 @@ static cc_result HttpClient_SendRequest(struct HttpClientState* state) { HttpClient_Serialise(state); /* TODO check that wrote is >= inputMsg.length */ - return HttpConnection_Write(state->conn, inputBuffer, inputMsg.length, &wrote); + return HttpConnection_Write(state->conn, (cc_uint8*)inputBuffer, inputMsg.length, &wrote); } @@ -763,7 +763,8 @@ static int HttpClient_BeginBody(struct HttpRequest* req, struct HttpClientState* static int HttpClient_GetChunkLength(const cc_string* line) { int length = 0, i, part; - for (i = 0; i < line->length; i++) { + for (i = 0; i < line->length; i++) + { char c = line->buffer[i]; /* RFC 7230, section 4.1.1 - Chunk Extensions */ if (c == ';') break; @@ -786,7 +787,8 @@ static cc_result HttpClient_Process(struct HttpClientState* state, char* buffer, case HTTP_RESPONSE_STATE_HEADER: { - for (; offset < total;) { + for (; offset < total;) + { char c = buffer[offset++]; if (c == '\r') continue; if (c != '\n') { @@ -837,7 +839,8 @@ static cc_result HttpClient_Process(struct HttpClientState* state, char* buffer, /* RFC 7230, section 4.1 - Chunked Transfer Coding */ case HTTP_RESPONSE_STATE_CHUNK_HEADER: { - for (; offset < total;) { + for (; offset < total;) + { char c = buffer[offset++]; if (c == '\r') continue; if (c != '\n') { String_Append(&state->header, c); continue; } @@ -874,7 +877,8 @@ static cc_result HttpClient_Process(struct HttpClientState* state, char* buffer, /* RFC 7230, section 4.1.2 - Chunked Trailer Part */ case HTTP_RESPONSE_STATE_CHUNK_TRAILERS: { - for (; offset < total;) { + for (; offset < total;) + { char c = buffer[offset++]; if (c == '\r') continue; if (c != '\n') { String_Append(&state->header, c); continue; } @@ -904,7 +908,8 @@ static cc_result HttpClient_ParseResponse(struct HttpClientState* state) { cc_uint32 total; cc_result res; - for (;;) { + for (;;) + { dst = state->dataLeft > INPUT_BUFFER_LEN ? (req->data + req->size) : buffer; res = HttpConnection_Read(state->conn, dst, INPUT_BUFFER_LEN, &total); diff --git a/src/Vectors.h b/src/Vectors.h index 7ac404959..c27915fa8 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -19,11 +19,12 @@ struct Vec4 { float x, y, z, w; }; /* 4x4 matrix. (for vertex transformations) */ struct Matrix { struct Vec4 row1, row2, row3, row4; }; -#define Matrix_IdentityValue { \ -1.0f, 0.0f, 0.0f, 0.0f, \ -0.0f, 1.0f, 0.0f, 0.0f, \ -0.0f, 0.0f, 1.0f, 0.0f, \ -0.0f, 0.0f, 0.0f, 1.0f \ +#define Matrix_IdentityValue \ +{ \ + { 1.0f, 0.0f, 0.0f, 0.0f }, \ + { 0.0f, 1.0f, 0.0f, 0.0f }, \ + { 0.0f, 0.0f, 1.0f, 0.0f }, \ + { 0.0f, 0.0f, 0.0f, 1.0f } \ } /* Identity matrix. (A * Identity = A) */ diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 977667faf..1017699ca 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -103,8 +103,8 @@ static void ProcessJoystickInput(circlePosition* pos, double delta) { float scale = (delta * 60.0) / 8.0f; // May not be exactly 0 on actual hardware - if (Math_AbsI(pos->dx) <= 8) pos->dx = 0; - if (Math_AbsI(pos->dy) <= 8) pos->dy = 0; + if (Math_AbsI(pos->dx) <= 16) pos->dx = 0; + if (Math_AbsI(pos->dy) <= 16) pos->dy = 0; Event_RaiseRawMove(&PointerEvents.RawMoved, pos->dx * scale, -pos->dy * scale); } diff --git a/src/_GLShared.h b/src/_GLShared.h index ecddb36f5..f77f9ba9a 100644 --- a/src/_GLShared.h +++ b/src/_GLShared.h @@ -272,7 +272,7 @@ static void AppendVRAMStats(cc_string* info) { } void Gfx_GetApiInfo(cc_string* info) { - GLint depthBits; + GLint depthBits = 0; int pointerSize = sizeof(void*) * 8; glGetIntegerv(GL_DEPTH_BITS, &depthBits); From 81b56f76ced81e3230b25f6e525e18a103cba66e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 19 Jan 2024 22:03:20 +1100 Subject: [PATCH 4/4] Move Display_ScaleX/Y to Window.h and ignore build results for other consoles too --- .gitignore | 11 +++++++++-- src/Window.h | 4 ++-- src/Window_3DS.c | 3 --- src/Window_Dreamcast.c | 3 --- src/Window_GCWii.c | 3 --- src/Window_N64.c | 3 --- src/Window_PS2.c | 3 --- src/Window_PS3.c | 3 --- src/Window_PSP.c | 3 --- src/Window_PSVita.c | 3 --- src/Window_Xbox.c | 3 --- src/Window_Xbox360.c | 3 --- src/_WindowBase.h | 3 --- 13 files changed, 11 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 5c2e96054..eb9e6f85c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,12 +20,19 @@ android/app/.externalNativeBuild/ android/local.properties *.iml -# 3DS build results +# Console build results +build-360/ build-3ds/ +build-dc/ +build-gc/ +build-n64/ +build-ps2/ +build-ps3/ +build-vita/ +build-wii/ # Build results [Dd]ebug/ -[Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ diff --git a/src/Window.h b/src/Window.h index 2092fb6a1..c506c1989 100644 --- a/src/Window.h +++ b/src/Window.h @@ -64,9 +64,9 @@ CC_VAR extern struct _DisplayData { } DisplayInfo; /* Scales the given X coordinate from 96 dpi to current display dpi. */ -int Display_ScaleX(int x); +static CC_INLINE int Display_ScaleX(int x) { return (int)(x * DisplayInfo.ScaleX); } /* Scales the given Y coordinate from 96 dpi to current display dpi. */ -int Display_ScaleY(int y); +static CC_INLINE int Display_ScaleY(int y) { return (int)(y * DisplayInfo.ScaleY); } /* Data for the game/launcher window. */ CC_VAR extern struct _WinData { diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 3ff477d13..b9836bec8 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -18,9 +18,6 @@ static Result irrst_result; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// Render everything at half size due to the small resolution -int Display_ScaleX(int x) { return x / 2; } -int Display_ScaleY(int y) { return y / 2; } // Note from https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/gfx.h diff --git a/src/Window_Dreamcast.c b/src/Window_Dreamcast.c index 10382f2ed..a44a09164 100644 --- a/src/Window_Dreamcast.c +++ b/src/Window_Dreamcast.c @@ -15,9 +15,6 @@ static cc_bool launcherMode; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on 3DS -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } void Window_Init(void) { DisplayInfo.Width = vid_mode->width; diff --git a/src/Window_GCWii.c b/src/Window_GCWii.c index ce2274f34..a155c6f4c 100644 --- a/src/Window_GCWii.c +++ b/src/Window_GCWii.c @@ -23,9 +23,6 @@ static GXRModeObj* rmode; void* Window_XFB; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on Wii/GameCube -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } static void OnPowerOff(void) { diff --git a/src/Window_N64.c b/src/Window_N64.c index 037f08e7a..32529597e 100644 --- a/src/Window_N64.c +++ b/src/Window_N64.c @@ -16,9 +16,6 @@ static cc_bool launcherMode; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on Wii/GameCube -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } void Window_Init(void) { display_init(RESOLUTION_320x240, DEPTH_32_BPP, 2, GAMMA_NONE, FILTERS_DISABLED); diff --git a/src/Window_PS2.c b/src/Window_PS2.c index 03600946a..f3c105ba0 100644 --- a/src/Window_PS2.c +++ b/src/Window_PS2.c @@ -26,9 +26,6 @@ static char padBuf[256] __attribute__((aligned(64))); struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on PS Vita -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } void Window_Init(void) { DisplayInfo.Width = 640; diff --git a/src/Window_PS3.c b/src/Window_PS3.c index 053b8c4a1..fa1e6d591 100644 --- a/src/Window_PS3.c +++ b/src/Window_PS3.c @@ -25,9 +25,6 @@ static KbConfig kb_config; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on PS Vita -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } static void sysutil_callback(u64 status, u64 param, void* usrdata) { switch (status) { diff --git a/src/Window_PSP.c b/src/Window_PSP.c index 4becc0bac..ac13c390c 100644 --- a/src/Window_PSP.c +++ b/src/Window_PSP.c @@ -21,9 +21,6 @@ static cc_bool launcherMode; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on Wii/GameCube -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } void Window_Init(void) { DisplayInfo.Width = SCREEN_WIDTH; diff --git a/src/Window_PSVita.c b/src/Window_PSVita.c index 60b08b707..15000321c 100644 --- a/src/Window_PSVita.c +++ b/src/Window_PSVita.c @@ -18,9 +18,6 @@ static SceTouchPanelInfo frontPanel; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on PS Vita -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } #define DISPLAY_WIDTH 960 #define DISPLAY_HEIGHT 544 diff --git a/src/Window_Xbox.c b/src/Window_Xbox.c index 0e7a0cfed..c22061ce4 100644 --- a/src/Window_Xbox.c +++ b/src/Window_Xbox.c @@ -20,9 +20,6 @@ static xid_gamepad_in gp_state; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on Xbox -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } // TODO No idea if this even works static void OnDataReceived(UTR_T* utr) { diff --git a/src/Window_Xbox360.c b/src/Window_Xbox360.c index fb61ac093..09321f0ae 100644 --- a/src/Window_Xbox360.c +++ b/src/Window_Xbox360.c @@ -18,9 +18,6 @@ static cc_bool launcherMode; struct _DisplayData DisplayInfo; struct _WinData WindowInfo; -// no DPI scaling on Xbox -int Display_ScaleX(int x) { return x; } -int Display_ScaleY(int y) { return y; } // https://github.com/Free60Project/libxenon/blob/71a411cddfc26c9ccade08d054d87180c359797a/libxenon/drivers/console/console.c#L47 struct ati_info { diff --git a/src/_WindowBase.h b/src/_WindowBase.h index da69264a8..0d2306c8a 100644 --- a/src/_WindowBase.h +++ b/src/_WindowBase.h @@ -10,9 +10,6 @@ struct _WinData WindowInfo; #define Display_CentreX(width) (DisplayInfo.x + (DisplayInfo.Width - width) / 2) #define Display_CentreY(height) (DisplayInfo.y + (DisplayInfo.Height - height) / 2) -int Display_ScaleX(int x) { return (int)(x * DisplayInfo.ScaleX); } -int Display_ScaleY(int y) { return (int)(y * DisplayInfo.ScaleY); } - static int cursorPrevX, cursorPrevY; static cc_bool cursorVisible = true; /* Gets the position of the cursor in screen or window coordinates */