Win fixes

now game launchable on windows
This commit is contained in:
Issac332 2026-05-17 13:01:41 +03:00
parent c2af9b3ff9
commit 6b4e0a92b4
2 changed files with 7 additions and 6 deletions

View file

@ -571,8 +571,9 @@ static void mriBindingExecute(){
char **argv = 0; char **argv = 0;
char options_argv1[] = "oneshot", options_argv2[] = "-evd", options_argv3[] = "--jit"; char options_argv1[] = "oneshot", options_argv2[] = "-evd", options_argv3[] = "--jit";
char* options_argv[] = {options_argv1, options_argv2, options_argv3, NULL}; char* options_argv[] = {options_argv1, options_argv2, options_argv3, NULL};
ruby_setup();
ruby_sysinit(&argc, &argv); ruby_sysinit(&argc, &argv);
RUBY_INIT_STACK;
ruby_setup();
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding())); rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
Config &conf = shState->rtData().config; Config &conf = shState->rtData().config;

View file

@ -185,7 +185,7 @@ static void setupWindowIcon(const Config &conf, SDL_Window *win){
static void setGamePathInRegistry() { static void setGamePathInRegistry() {
#if defined WIN32 #if defined WIN32
// this logic is currently windows specific // this logic is currently windows specific
char* dataDir = SDL_GetBasePath(); const char* dataDir = SDL_GetBasePath();
if (dataDir){ if (dataDir){
HKEY key; HKEY key;
long keyOpenError = RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), &key); long keyOpenError = RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), &key);
@ -212,12 +212,14 @@ static void setGamePathInRegistry() {
} }
RegCloseKey(key); RegCloseKey(key);
} }
SDL_free(dataDir); //SDL_free(dataDir); // not needed in sdl3
} }
#endif #endif
//TODO handle this for Linux/Mac //TODO handle this for Linux/Mac
} }
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
loadLanguageMetadata(); //there will be a segfault on fclose if I don't move it here
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
SDL_SetHint(SDL_HINT_APP_ID, "OneshotSunshine"); SDL_SetHint(SDL_HINT_APP_ID, "OneshotSunshine");
SDL_SetHint(SDL_HINT_APP_NAME, "Oneshot: Sunshine"); SDL_SetHint(SDL_HINT_APP_NAME, "Oneshot: Sunshine");
@ -264,8 +266,6 @@ int main(int argc, char *argv[]){
/* Initialize physfs here so that config can call PHYSFS_getPrefDir */ /* Initialize physfs here so that config can call PHYSFS_getPrefDir */
PHYSFS_init(argv[0]); PHYSFS_init(argv[0]);
loadLanguageMetadata();
/* now we load the config */ /* now we load the config */
Config conf; Config conf;
conf.read(argc, argv); conf.read(argc, argv);
@ -405,7 +405,7 @@ int main(int argc, char *argv[]){
Sound_Quit(); Sound_Quit();
TTF_Quit(); TTF_Quit();
SDL_Quit(); SDL_Quit(); // i got "Thread 1 received signal ?, Unknown signal" here on windows after closing game
#ifdef STEAM #ifdef STEAM
STEAMSHIM_deinit(); STEAMSHIM_deinit();