[PATCH 07/20] Adjust settings.c to make it compilable in Hatari |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- Subject: [PATCH 07/20] Adjust settings.c to make it compilable in Hatari
- From: Thomas Huth <huth@xxxxxxxxxxxxx>
- Date: Sun, 7 Jan 2024 19:09:01 +0100
---
src/jaguar/settings.c | 113 ++++++++++++++++++------------------------
src/jaguar/settings.h | 5 --
2 files changed, 48 insertions(+), 70 deletions(-)
diff --git a/src/jaguar/settings.c b/src/jaguar/settings.c
index 0ddf0700..47cf81ec 100644
--- a/src/jaguar/settings.c
+++ b/src/jaguar/settings.c
@@ -14,16 +14,17 @@
#include "settings.h"
#include <stdlib.h>
-#include <string>
-#include "SDL.h"
-#include "sdlemu_config.h"
+#include <string.h>
+#include <SDL.h>
#include "log.h"
-using namespace std;
+#define sdlemu_getval_int(str, val) (val)
+#define sdlemu_getval_bool(str, val) (val)
+#define sdlemu_getval_string(str, val) (val)
// Global variables
-VJSettings vjs;
+struct VJSettings vjs;
// Private function prototypes
@@ -34,12 +35,6 @@ void CheckForTrailingSlash(char * path);
//
void LoadVJSettings(void)
{
- if (sdlemu_init_config("./vj.cfg") == 0 // CWD
- && sdlemu_init_config("~/vj.cfg") == 0 // Home
- && sdlemu_init_config("~/.vj/vj.cfg") == 0 // Home under .vj directory
- && sdlemu_init_config("vj.cfg") == 0) // Somewhere in the path
- WriteLog("Settings: Couldn't find VJ configuration file. Using defaults...\n");
-
vjs.useJoystick = sdlemu_getval_bool("useJoystick", false);
vjs.joyport = sdlemu_getval_int("joyport", 0);
vjs.hardwareTypeNTSC = sdlemu_getval_bool("hardwareTypeNTSC", true);
@@ -47,55 +42,52 @@ void LoadVJSettings(void)
vjs.useJaguarBIOS = sdlemu_getval_bool("useJaguarBIOS", false);
vjs.DSPEnabled = sdlemu_getval_bool("DSPEnabled", false);
vjs.usePipelinedDSP = sdlemu_getval_bool("usePipelinedDSP", false);
- vjs.fullscreen = sdlemu_getval_bool("fullscreen", false);
- vjs.useOpenGL = sdlemu_getval_bool("useOpenGL", true);
- vjs.glFilter = sdlemu_getval_int("glFilterType", 0);
vjs.renderType = sdlemu_getval_int("renderType", 0);
// Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
- vjs.p1KeyBindings[0] = sdlemu_getval_int("p1k_up", SDLK_UP);
- vjs.p1KeyBindings[1] = sdlemu_getval_int("p1k_down", SDLK_DOWN);
- vjs.p1KeyBindings[2] = sdlemu_getval_int("p1k_left", SDLK_LEFT);
- vjs.p1KeyBindings[3] = sdlemu_getval_int("p1k_right", SDLK_RIGHT);
- vjs.p1KeyBindings[4] = sdlemu_getval_int("p1k_c", SDLK_z);
- vjs.p1KeyBindings[5] = sdlemu_getval_int("p1k_b", SDLK_x);
- vjs.p1KeyBindings[6] = sdlemu_getval_int("p1k_a", SDLK_c);
- vjs.p1KeyBindings[7] = sdlemu_getval_int("p1k_option", SDLK_QUOTE);
- vjs.p1KeyBindings[8] = sdlemu_getval_int("p1k_pause", SDLK_RETURN);
- vjs.p1KeyBindings[9] = sdlemu_getval_int("p1k_0", SDLK_KP0);
- vjs.p1KeyBindings[10] = sdlemu_getval_int("p1k_1", SDLK_KP1);
- vjs.p1KeyBindings[11] = sdlemu_getval_int("p1k_2", SDLK_KP2);
- vjs.p1KeyBindings[12] = sdlemu_getval_int("p1k_3", SDLK_KP3);
- vjs.p1KeyBindings[13] = sdlemu_getval_int("p1k_4", SDLK_KP4);
- vjs.p1KeyBindings[14] = sdlemu_getval_int("p1k_5", SDLK_KP5);
- vjs.p1KeyBindings[15] = sdlemu_getval_int("p1k_6", SDLK_KP6);
- vjs.p1KeyBindings[16] = sdlemu_getval_int("p1k_7", SDLK_KP7);
- vjs.p1KeyBindings[17] = sdlemu_getval_int("p1k_8", SDLK_KP8);
- vjs.p1KeyBindings[18] = sdlemu_getval_int("p1k_9", SDLK_KP9);
- vjs.p1KeyBindings[19] = sdlemu_getval_int("p1k_pound", SDLK_KP_DIVIDE);
- vjs.p1KeyBindings[20] = sdlemu_getval_int("p1k_star", SDLK_KP_MULTIPLY);
+ vjs.p1KeyBindings[0] = sdlemu_getval_int("p1k_up", SDL_SCANCODE_UP);
+ vjs.p1KeyBindings[1] = sdlemu_getval_int("p1k_down", SDL_SCANCODE_DOWN);
+ vjs.p1KeyBindings[2] = sdlemu_getval_int("p1k_left", SDL_SCANCODE_LEFT);
+ vjs.p1KeyBindings[3] = sdlemu_getval_int("p1k_right", SDL_SCANCODE_RIGHT);
+ vjs.p1KeyBindings[4] = sdlemu_getval_int("p1k_c", SDL_SCANCODE_A);
+ vjs.p1KeyBindings[5] = sdlemu_getval_int("p1k_b", SDL_SCANCODE_S);
+ vjs.p1KeyBindings[6] = sdlemu_getval_int("p1k_a", SDL_SCANCODE_D);
+ vjs.p1KeyBindings[7] = sdlemu_getval_int("p1k_option", SDL_SCANCODE_GRAVE);
+ vjs.p1KeyBindings[8] = sdlemu_getval_int("p1k_pause", SDL_SCANCODE_RETURN);
+ vjs.p1KeyBindings[9] = sdlemu_getval_int("p1k_0", SDL_SCANCODE_Z);
+ vjs.p1KeyBindings[10] = sdlemu_getval_int("p1k_1", SDL_SCANCODE_U);
+ vjs.p1KeyBindings[11] = sdlemu_getval_int("p1k_2", SDL_SCANCODE_I);
+ vjs.p1KeyBindings[12] = sdlemu_getval_int("p1k_3", SDL_SCANCODE_H);
+ vjs.p1KeyBindings[13] = sdlemu_getval_int("p1k_4", SDL_SCANCODE_J);
+ vjs.p1KeyBindings[14] = sdlemu_getval_int("p1k_5", SDL_SCANCODE_K);
+ vjs.p1KeyBindings[15] = sdlemu_getval_int("p1k_6", SDL_SCANCODE_KP_6);
+ vjs.p1KeyBindings[16] = sdlemu_getval_int("p1k_7", SDL_SCANCODE_KP_7);
+ vjs.p1KeyBindings[17] = sdlemu_getval_int("p1k_8", SDL_SCANCODE_KP_8);
+ vjs.p1KeyBindings[18] = sdlemu_getval_int("p1k_9", SDL_SCANCODE_KP_9);
+ vjs.p1KeyBindings[19] = sdlemu_getval_int("p1k_pound", SDL_SCANCODE_KP_DIVIDE);
+ vjs.p1KeyBindings[20] = sdlemu_getval_int("p1k_star", SDL_SCANCODE_KP_MULTIPLY);
- vjs.p2KeyBindings[0] = sdlemu_getval_int("p2k_up", SDLK_UP);
- vjs.p2KeyBindings[1] = sdlemu_getval_int("p2k_down", SDLK_DOWN);
- vjs.p2KeyBindings[2] = sdlemu_getval_int("p2k_left", SDLK_LEFT);
- vjs.p2KeyBindings[3] = sdlemu_getval_int("p2k_right", SDLK_RIGHT);
- vjs.p2KeyBindings[4] = sdlemu_getval_int("p2k_c", SDLK_z);
- vjs.p2KeyBindings[5] = sdlemu_getval_int("p2k_b", SDLK_x);
- vjs.p2KeyBindings[6] = sdlemu_getval_int("p2k_a", SDLK_c);
- vjs.p2KeyBindings[7] = sdlemu_getval_int("p2k_option", SDLK_QUOTE);
- vjs.p2KeyBindings[8] = sdlemu_getval_int("p2k_pause", SDLK_RETURN);
- vjs.p2KeyBindings[9] = sdlemu_getval_int("p2k_0", SDLK_KP0);
- vjs.p2KeyBindings[10] = sdlemu_getval_int("p2k_1", SDLK_KP1);
- vjs.p2KeyBindings[11] = sdlemu_getval_int("p2k_2", SDLK_KP2);
- vjs.p2KeyBindings[12] = sdlemu_getval_int("p2k_3", SDLK_KP3);
- vjs.p2KeyBindings[13] = sdlemu_getval_int("p2k_4", SDLK_KP4);
- vjs.p2KeyBindings[14] = sdlemu_getval_int("p2k_5", SDLK_KP5);
- vjs.p2KeyBindings[15] = sdlemu_getval_int("p2k_6", SDLK_KP6);
- vjs.p2KeyBindings[16] = sdlemu_getval_int("p2k_7", SDLK_KP7);
- vjs.p2KeyBindings[17] = sdlemu_getval_int("p2k_8", SDLK_KP8);
- vjs.p2KeyBindings[18] = sdlemu_getval_int("p2k_9", SDLK_KP9);
- vjs.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDLK_KP_DIVIDE);
- vjs.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDLK_KP_MULTIPLY);
+ vjs.p2KeyBindings[0] = sdlemu_getval_int("p2k_up", SDL_SCANCODE_UP);
+ vjs.p2KeyBindings[1] = sdlemu_getval_int("p2k_down", SDL_SCANCODE_DOWN);
+ vjs.p2KeyBindings[2] = sdlemu_getval_int("p2k_left", SDL_SCANCODE_LEFT);
+ vjs.p2KeyBindings[3] = sdlemu_getval_int("p2k_right", SDL_SCANCODE_RIGHT);
+ vjs.p2KeyBindings[4] = sdlemu_getval_int("p2k_c", SDL_SCANCODE_Z);
+ vjs.p2KeyBindings[5] = sdlemu_getval_int("p2k_b", SDL_SCANCODE_X);
+ vjs.p2KeyBindings[6] = sdlemu_getval_int("p2k_a", SDL_SCANCODE_C);
+ vjs.p2KeyBindings[7] = sdlemu_getval_int("p2k_option", SDL_SCANCODE_GRAVE);
+ vjs.p2KeyBindings[8] = sdlemu_getval_int("p2k_pause", SDL_SCANCODE_RETURN);
+ vjs.p2KeyBindings[9] = sdlemu_getval_int("p2k_0", SDL_SCANCODE_KP_0);
+ vjs.p2KeyBindings[10] = sdlemu_getval_int("p2k_1", SDL_SCANCODE_KP_1);
+ vjs.p2KeyBindings[11] = sdlemu_getval_int("p2k_2", SDL_SCANCODE_KP_2);
+ vjs.p2KeyBindings[12] = sdlemu_getval_int("p2k_3", SDL_SCANCODE_KP_3);
+ vjs.p2KeyBindings[13] = sdlemu_getval_int("p2k_4", SDL_SCANCODE_KP_4);
+ vjs.p2KeyBindings[14] = sdlemu_getval_int("p2k_5", SDL_SCANCODE_KP_5);
+ vjs.p2KeyBindings[15] = sdlemu_getval_int("p2k_6", SDL_SCANCODE_KP_6);
+ vjs.p2KeyBindings[16] = sdlemu_getval_int("p2k_7", SDL_SCANCODE_KP_7);
+ vjs.p2KeyBindings[17] = sdlemu_getval_int("p2k_8", SDL_SCANCODE_KP_8);
+ vjs.p2KeyBindings[18] = sdlemu_getval_int("p2k_9", SDL_SCANCODE_KP_9);
+ vjs.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDL_SCANCODE_KP_DIVIDE);
+ vjs.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDL_SCANCODE_KP_MULTIPLY);
strcpy(vjs.jagBootPath, sdlemu_getval_string("JagBootROM", "./BIOS/jagboot.rom"));
strcpy(vjs.CDBootPath, sdlemu_getval_string("CDBootROM", "./BIOS/jagcd.rom"));
@@ -103,15 +95,6 @@ void LoadVJSettings(void)
strcpy(vjs.ROMPath, sdlemu_getval_string("ROMs", "./ROMs"));
CheckForTrailingSlash(vjs.EEPROMPath);
CheckForTrailingSlash(vjs.ROMPath);
-
- vjs.hardwareTypeAlpine = false; // No external setting for this yet...
-}
-
-//
-// Save Virtual Jaguar's settings
-//
-void SaveVJSettings(void)
-{
}
//
diff --git a/src/jaguar/settings.h b/src/jaguar/settings.h
index 857d3f72..37884b16 100644
--- a/src/jaguar/settings.h
+++ b/src/jaguar/settings.h
@@ -24,10 +24,6 @@ struct VJSettings
bool useJaguarBIOS;
bool DSPEnabled;
bool usePipelinedDSP;
- bool fullscreen;
- bool useOpenGL;
- uint32 glFilter;
- bool hardwareTypeAlpine;
uint32 frameSkip;
uint32 renderType;
@@ -51,7 +47,6 @@ enum { RT_NORMAL = 0, RT_TV = 1 };
// Exported functions
void LoadVJSettings(void);
-void SaveVJSettings(void);
// Exported variables
--
2.48.1
--MP_/VkVZp1l8MIESxWVe2vPSxV2
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=0008-Add-a-function-that-can-be-used-to-exit-the-loop-in-.patch