From 946e1c6b5f32941f4eba16a3b27932bfe5a41f5e Mon Sep 17 00:00:00 2001 From: turbocat Date: Wed, 15 Jun 2022 20:06:15 +0000 Subject: [PATCH] DGEN: - Fixed create .dgen dir bug; - Disable debug output; - Moved all build definitions to config.h. git-svn-id: svn://kolibrios.org@9840 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/emulator/dgen-sdl-1.33/Tupfile.lua | 5 ++-- programs/emulator/dgen-sdl-1.33/config.h | 33 +++++++++++++++++++++ programs/emulator/dgen-sdl-1.33/md.h | 2 ++ programs/emulator/dgen-sdl-1.33/sdl/sdl.cpp | 2 +- programs/emulator/dgen-sdl-1.33/system.c | 15 ++++++---- 5 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 programs/emulator/dgen-sdl-1.33/config.h diff --git a/programs/emulator/dgen-sdl-1.33/Tupfile.lua b/programs/emulator/dgen-sdl-1.33/Tupfile.lua index 1c0318ec61..e6d5557cdf 100644 --- a/programs/emulator/dgen-sdl-1.33/Tupfile.lua +++ b/programs/emulator/dgen-sdl-1.33/Tupfile.lua @@ -1,15 +1,14 @@ if tup.getconfig("NO_GCC") ~= "" then return end if tup.getconfig("HELPERDIR") == "" then - if tup.getconfig("NO_NASM") ~= "" then return end -- required for SDL compilation + if tup.getconfig("NO_NASM") ~= "" then return end HELPERDIR = "../../" end tup.include(HELPERDIR .. "/use_gcc.lua") tup.include(HELPERDIR .. "/use_newlib.lua") tup.include(HELPERDIR .. "/use_sdl_newlib.lua") -CFLAGS = CFLAGS_OPTIMIZE_SPEED ..[[ -DPACKAGE_NAME=\"DGen/SDL\" -DPACKAGE_TARNAME=\"dgen-sdl\" -DPACKAGE_VERSION=\"1.33\" -DPACKAGE_STRING=\"DGen/SDL\ 1.33\" -DPACKAGE_BUGREPORT=\"zamaz@users.sourceforge.net\" -DPACKAGE_URL=\"http://sourceforge.net/projects/dgen\" -DPACKAGE=\"dgen-sdl\" -DVERSION=\"1.33\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FTELLO=1 -DHAVE_GLOB_H=1 -DWITH_JOYSTICK=1 -DWITH_MUSA=1 -DWITH_STAR=1 -DWITH_MZ80=1 -DWITH_CZ80=1 -DWITH_X86_ASM=1 -DHAVE_MEMCPY_H=1 -DWITH_CTV=1 -DWITH_SCALE2X=1 -DWITH_X86_MZ80=1 -DWITH_X86_MMX=1 -DWITH_X86_CTV=1 -DWITH_X86_TILES=1 ]] - +CFLAGS = CFLAGS_OPTIMIZE_SPEED LDFLAGS = LDFLAGS .. " --subsystem native" INCLUDES = INCLUDES .. " -Isdl -I. -Iscale2x" diff --git a/programs/emulator/dgen-sdl-1.33/config.h b/programs/emulator/dgen-sdl-1.33/config.h new file mode 100644 index 0000000000..e4f8814b93 --- /dev/null +++ b/programs/emulator/dgen-sdl-1.33/config.h @@ -0,0 +1,33 @@ +#pragma once + +#define PACKAGE_NAME "DGen/SDL" +#define PACKAGE_TARNAME "dgen-sdl" +#define PACKAGE_VERSION "1.33" +#define PACKAGE_STRING "DGen/SDL-1.33" +#define PACKAGE_BUGREPORT "zamaz@users.sourceforge.net" +#define PACKAGE_URL "http://sourceforge.net/projects/dgen" +#define PACKAGE "dgen-sdl" +#define VERSION "1.33" +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_FTELLO 1 +#define HAVE_GLOB_H 1 +#define WITH_MUSA 1 +#define WITH_STAR 1 +#define WITH_MZ80 1 +#define WITH_CZ80 1 +#define WITH_X86_ASM 1 +#define HAVE_MEMCPY_H 1 +#define WITH_CTV 1 +#define WITH_SCALE2X 1 +#define WITH_X86_MZ80 1 +#define WITH_X86_MMX 1 +#define WITH_X86_CTV 1 +#define WITH_X86_TILES 1 +#define NDEBUG diff --git a/programs/emulator/dgen-sdl-1.33/md.h b/programs/emulator/dgen-sdl-1.33/md.h index 381099c95d..540c00c2ba 100644 --- a/programs/emulator/dgen-sdl-1.33/md.h +++ b/programs/emulator/dgen-sdl-1.33/md.h @@ -3,6 +3,8 @@ #ifndef __MD_H__ #define __MD_H__ +#include "config.h" + #define VER VERSION #include diff --git a/programs/emulator/dgen-sdl-1.33/sdl/sdl.cpp b/programs/emulator/dgen-sdl-1.33/sdl/sdl.cpp index 4d8941eb36..e6ce68fd6a 100644 --- a/programs/emulator/dgen-sdl-1.33/sdl/sdl.cpp +++ b/programs/emulator/dgen-sdl-1.33/sdl/sdl.cpp @@ -6309,8 +6309,8 @@ int pd_handle_events(md &megad) }; unsigned int hat_value_map; intptr_t joypad; - bool pressed; #endif + bool pressed; uint32_t plist[8]; uint32_t rlist[8]; unsigned int i, pi, ri; diff --git a/programs/emulator/dgen-sdl-1.33/system.c b/programs/emulator/dgen-sdl-1.33/system.c index 01adfc7dbe..7ba5c1147e 100644 --- a/programs/emulator/dgen-sdl-1.33/system.c +++ b/programs/emulator/dgen-sdl-1.33/system.c @@ -40,7 +40,8 @@ #endif #ifdef _KOLIBRI -char* dgen_conf_dir = "/tmp0/1"; +char* kos_dgen_userdir = "/tmp0/1"; + #endif static const char *fopen_mode(unsigned int mode) @@ -181,7 +182,7 @@ char *dgen_userdir(char *buf, size_t *size) } #ifndef __MINGW32__ #ifdef _KOLIBRI - strncpy(path, dgen_conf_dir, sz_dir); + strncpy(path, kos_dgen_userdir, sz_dir); #else strncpy(path, pwd->pw_dir, sz_dir); #endif @@ -231,7 +232,7 @@ char *dgen_dir(char *buf, size_t *size, const char *sub) return NULL; sz_dir = strlen(pwd->pw_dir); #else - sz_dir = strlen(dgen_conf_dir); + sz_dir = strlen(kos_dgen_userdir); #endif #endif @@ -263,7 +264,7 @@ char *dgen_dir(char *buf, size_t *size, const char *sub) #ifndef _KOLIBRI strncpy(path, pwd->pw_dir, sz_dir); #else - strncpy(path, dgen_conf_dir, sz_dir); + strncpy(path, kos_dgen_userdir, sz_dir); #endif #else if (SHGetFolderPath(NULL, (CSIDL_APPDATA | CSIDL_FLAG_CREATE), @@ -352,9 +353,12 @@ FILE *dgen_freopen(const char *relative, const char *file, unsigned int mode, goto error; size = strlen(path); } - printf("HOME=%s\n", path); +#ifndef KOLIBRI if ((mode & (DGEN_WRITE | DGEN_APPEND)) && (path != NULL)) mkdir(path, 0777); /* XXX make that recursive */ +#else + mkdir(path, 0777); +#endif file_size = strlen(file); if ((tmp = realloc(path, (size + !!size + file_size + 1))) == NULL) goto error; @@ -374,7 +378,6 @@ FILE *dgen_freopen(const char *relative, const char *file, unsigned int mode, errno = e; return f; error: - puts("ERROR"); free(path); errno = EACCES; return NULL;