Skip to content

Commit

Permalink
EP128: Xemu unification part1 ;)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgblgblgb committed Oct 12, 2020
1 parent 7f34465 commit 8210a59
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 862 deletions.
4 changes: 2 additions & 2 deletions targets/ep128/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ TARGET = ep128
PRG_TARGET = xep128
EMU_DESCRIPTION = Enterprise 128

SRCS_TARGET_xep128 = screen.c enterprise128.c cpu.c z180.c nick.c dave.c input.c exdos_wd.c sdext.c rtc.c printer.c zxemu.c primoemu.c emu_rom_interface.c epnet.c apu.c keyboard_mapping.c configuration.c roms.c console.c emu_monitor.c joystick.c fileio.c snapshot.c
SRCS_COMMON_xep128 = z80.c z80_dasm.c emutools_socketapi.c lodepng.c emutools_gui.c
SRCS_TARGET_xep128 = enterprise128.c cpu.c z180.c nick.c dave.c input.c exdos_wd.c sdext.c rtc.c printer.c zxemu.c primoemu.c emu_rom_interface.c epnet.c apu.c keyboard_mapping.c configuration.c roms.c console.c emu_monitor.c joystick.c fileio.c snapshot.c
SRCS_COMMON_xep128 = emutools.c emutools_gui.c z80.c z80_dasm.c emutools_socketapi.c lodepng.c
CFLAGS_TARGET_xep128 = $(SDL2_CFLAGS) $(MATH_CFLAGS) $(SOCKET_CFLAGS) $(XEMUGUI_CFLAGS) $(READLINE_CFLAGS)
LDFLAGS_TARGET_xep128 = $(SDL2_LIBS) $(MATH_LIBS) $(SOCKET_LIBS) $(XEMUGUI_LIBS) $(READLINE_LIBS)

Expand Down
17 changes: 7 additions & 10 deletions targets/ep128/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ static struct configSetting_st *config = NULL;
static int config_size = 0;
char *app_pref_path, *app_base_path;
char current_directory[PATH_MAX + 1];
SDL_version sdlver_compiled, sdlver_linked;
FILE *debug_fp = NULL;
//SDL_version sdlver_compiled, sdlver_linked;



Expand Down Expand Up @@ -127,9 +126,9 @@ FILE *open_emu_file ( const char *name, const char *mode, char *pathbuffer )
FILE *f;
// try to detect absolute path, Win32 related part tries to detect the possibility of X:\... syntax
if (
name[0] == DIRSEP[0]
name[0] == DIRSEP_STR[0]
#ifdef _WIN32
|| (strlen(name) > 3 && name[1] == ':' && name[2] == DIRSEP[0])
|| (strlen(name) > 3 && name[1] == ':' && name[2] == DIRSEP_STR[0])
#endif
) {
prefixes[0] = "";
Expand Down Expand Up @@ -205,14 +204,12 @@ int config_set ( const char *name, int subopt, const char *value )
if (st) {
free(st->value);
} else {
config = realloc(config, (config_size + 1) * sizeof(struct configOption_st));
CHECK_MALLOC(config);
config = xemu_realloc(config, (config_size + 1) * sizeof(struct configOption_st));
st = config + (config_size++);
st->opt = opt;
st->subopt = subopt;
}
st->value = strdup(value);
CHECK_MALLOC(st->value);
st->value = xemu_strdup(value);
return 0;
}

Expand Down Expand Up @@ -513,7 +510,7 @@ static int get_path_info ( void )
}
#endif
/* Check for pref dir override file in the same directory where executable is (base path) */
snprintf(buffer, sizeof buffer, "%s%cxep128.dir", app_base_path, DIRSEP[0]);
snprintf(buffer, sizeof buffer, "%s%cxep128.dir", app_base_path, DIRSEP_STR[0]);
f = fopen(buffer, "r");
if (f) {
char *p = fgets(buffer, sizeof buffer, f);
Expand Down Expand Up @@ -554,7 +551,7 @@ static int get_path_info ( void )
ERROR_WINDOW("Cannot query current directory: %s", ERRSTR());
return 1;
}
strcat(current_directory, DIRSEP);
strcat(current_directory, DIRSEP_STR);
return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions targets/ep128/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ int ep_init_ram ( void )
DEBUGPRINT("CONFIG: MEM: %s" NL, dbuf);
strcat(dbuf, "\n");
s = mem_desc ? strlen(mem_desc) : 0;
mem_desc = realloc(mem_desc, s + strlen(dbuf) + 256);
CHECK_MALLOC(mem_desc);
mem_desc = xemu_realloc(mem_desc, s + strlen(dbuf) + 256);
if (!s)
*mem_desc = '\0';
strcat(mem_desc, dbuf);
Expand Down
16 changes: 10 additions & 6 deletions targets/ep128/emu_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "configuration.h"
#include "emu_rom_interface.h"
#include "fileio.h"
#include "screen.h"
#include "console.h"
#include "nick.h"
#include "input.h"
Expand Down Expand Up @@ -521,7 +520,7 @@ static void cmd_lpt ( void )
static void cmd_pause ( void )
{
paused = !paused;
OSD("Emulation %s", paused ? "paused" : "resumed");
OSD(-1, -1, "Emulation %s", paused ? "paused" : "resumed");
}


Expand Down Expand Up @@ -556,6 +555,7 @@ static void cmd_sdl ( void )
MPRINTF("Display #%d %dx%dpx @ %dHz %i bpp (%s)\n", a, display.w, display.h, display.refresh_rate,
SDL_BITSPERPIXEL(display.format), SDL_GetPixelFormatName(display.format)
);
#if 0
switch (sdl_wminfo.subsystem) {
default:
case SDL_SYSWM_UNKNOWN:
Expand All @@ -578,6 +578,10 @@ static void cmd_sdl ( void )
subsystem,
sdl_wminfo.subsystem
);
#else
subsystem = "FIXME";
MPRINTF(WINDOW_TITLE " is FIXME");
#endif
}


Expand Down Expand Up @@ -605,12 +609,12 @@ static void cmd_cd ( void )
char *r_scwd = getcwd(cwd_old, PATH_MAX); // Save working directory
int r;
if (chdir(fileio_cwd)) // set old FILE: dir
r = chdir(DIRSEP);
r = chdir(DIRSEP_STR);
r_cd = chdir(arg); // do the CD - maybe relative - to the old one
if (!r_cd) {
if (getcwd(fileio_cwd, PATH_MAX)) { // store result directory as new FILE: dir
if (fileio_cwd[strlen(fileio_cwd) - 1] != DIRSEP[0])
strcat(fileio_cwd, DIRSEP);
if (fileio_cwd[strlen(fileio_cwd) - 1] != DIRSEP_STR[0])
strcat(fileio_cwd, DIRSEP_STR);
}
}
if (!r_scwd)
Expand Down Expand Up @@ -644,7 +648,7 @@ static void cmd_dir ( void )
struct stat st;
if (entry->d_name[0] == '.')
continue;
if (CHECK_SNPRINTF(snprintf(fn, sizeof fn, "%s%s%s", fileio_cwd, DIRSEP, entry->d_name), sizeof fn))
if (CHECK_SNPRINTF(snprintf(fn, sizeof fn, "%s%s%s", fileio_cwd, DIRSEP_STR, entry->d_name), sizeof fn))
continue;
if (!stat(fn, &st)) {
char size_info[10];
Expand Down
Loading

1 comment on commit 8210a59

@lgblgblgb
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.