From 81b56f76ced81e3230b25f6e525e18a103cba66e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 19 Jan 2024 22:03:20 +1100 Subject: [PATCH] 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 */