Skip to content

Commit

Permalink
src/menu: add extra "2MB RAM" option in menu
Browse files Browse the repository at this point in the history
for increased memory to enable extra features in games.
  • Loading branch information
Apaczer committed Oct 30, 2024
1 parent 0663c9f commit 133b5e1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ char uae4all_image_file2[128];

int drawfinished=0;

extern int mainMenu_throttle, mainMenu_frameskip, mainMenu_sound, mainMenu_case, mainMenu_autosave, mainMenu_vpos, mainMenu_usejoy, mainMenu_statusbar;
extern int mainMenu_throttle, mainMenu_frameskip, mainMenu_sound, mainMenu_case, mainMenu_autosave, mainMenu_vpos, mainMenu_usejoy, mainMenu_statusbar, mainMenu_ram;

int emulated_left=0;
int emulated_right=0;
Expand Down Expand Up @@ -162,6 +162,8 @@ void loadConfig()
#if defined(MIYOO) || defined(RS97)
else if(!strcmp(line, "STATUS_BAR"))
sscanf(arg, "%d", &mainMenu_statusbar);
else if(!strcmp(line, "2MB_RAM"))
sscanf(arg, "%d", &mainMenu_ram);
#endif
else if(!strcmp(line, "LAST_DIR"))
{
Expand Down Expand Up @@ -224,7 +226,7 @@ void storeConfig()
}

#if defined(MIYOO) || defined(RS97)
fprintf(f, "THROTTLE %d\nFRAMESKIP %d\nSCREEN_POS %d\nSOUND %d\nSAVE_DISKS %d\nUSE_JOY %d\nSTATUS_BAR %d\n", mainMenu_throttle, mainMenu_frameskip, mainMenu_vpos, mainMenu_sound, mainMenu_autosave, mainMenu_usejoy, mainMenu_statusbar);
fprintf(f, "THROTTLE %d\nFRAMESKIP %d\nSCREEN_POS %d\nSOUND %d\nSAVE_DISKS %d\nUSE_JOY %d\nSTATUS_BAR %d\n2MB_RAM %d\n", mainMenu_throttle, mainMenu_frameskip, mainMenu_vpos, mainMenu_sound, mainMenu_autosave, mainMenu_usejoy, mainMenu_statusbar, mainMenu_ram);
#else
fprintf(f, "THROTTLE %d\nFRAMESKIP %d\nSCREEN_POS %d\nSOUND %d\nSAVE_DISKS %d\nUSE_JOY %d\n", mainMenu_throttle, mainMenu_frameskip, mainMenu_vpos, mainMenu_sound, mainMenu_autosave, mainMenu_usejoy);
#endif
Expand Down
16 changes: 14 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ int no_gui = 0;
int joystickpresent = 0;
int cloanto_rom = 0;

extern int mainMenu_ram;

struct gui_info gui_data;

char warning_buffer[256];
Expand Down Expand Up @@ -143,8 +145,6 @@ void default_prefs ()
// strcpy (romfile, "/cdrom/kick.rom");
strcpy (romfile, "kick.rom");
#endif

prefs_chipmem_size=0x00100000;
}

int quit_program = 0;
Expand Down Expand Up @@ -318,6 +318,18 @@ void real_main (int argc, char **argv)
produce_sound = 0;
}

#ifdef MIYOO
prefs_chipmem_size=(!mainMenu_ram ? 0x00100000 : 0x00200000);
#ifdef DEBUG_RAM
if (prefs_chipmem_size==0x00100000)
printf ("\nRAM 1MB\n");
else
printf ("\nRAM 2MB\n");
#endif
#else
prefs_chipmem_size=0x00100000;
#endif

/* Install resident module to get 8MB chipmem, if requested */
rtarea_setup ();

Expand Down
11 changes: 11 additions & 0 deletions src/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "zfile.h"

unsigned prefs_chipmem_size;
extern int mainMenu_ram;

#ifdef USE_MAPPED_MEMORY
#include <sys/mman.h>
Expand Down Expand Up @@ -1128,6 +1129,16 @@ static void allocate_memory (void)
mapped_free (chipmemory);
chipmemory = 0;

#ifdef MIYOO
prefs_chipmem_size=(!mainMenu_ram ? 0x00100000 : 0x00200000);
#ifdef DEBUG_RAM
if (prefs_chipmem_size==0x00100000)
printf ("\nRAM 1MB\n");
else
printf ("\nRAM 2MB\n");
#endif
#endif

allocated_chipmem = prefs_chipmem_size;
chipmem_mask = allocated_chipmem - 1;

Expand Down
26 changes: 24 additions & 2 deletions src/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static const char *text_str_autosave="Save disks";
static const char *text_str_vpos="Screen pos";
static const char *text_str_joystick="Use analog";
static const char *text_str_status="Status bar";
static const char *text_str_ram="2MB RAM";
static const char *text_str_8="8";
static const char *text_str_16="16";
static const char *text_str_20="20";
Expand Down Expand Up @@ -63,6 +64,7 @@ enum MainMenuEntry {
MAIN_MENU_ENTRY_SAVE_DISKS,
MAIN_MENU_ENTRY_USE_JOY,
MAIN_MENU_ENTRY_STATUS_BAR,
MAIN_MENU_ENTRY_RAM,
MAIN_MENU_ENTRY_RESET_EMULATION,
MAIN_MENU_ENTRY_RETURN_TO_EMULATION,
MAIN_MENU_ENTRY_EXIT_UAE,
Expand Down Expand Up @@ -113,15 +115,16 @@ int mainMenu_sound=0;
int mainMenu_autosave=-1;
int mainMenu_usejoy=-1;
int mainMenu_statusbar=-1;
int mainMenu_ram=0;

static void draw_mainMenu(enum MainMenuEntry c)
{
static int frame = 0;
int flash = frame / 3;
int row = 4, column = 0;
int row = 3, column = 0;

text_draw_background();
text_draw_window(40,28,260,192,text_str_title);
text_draw_window(40,22,260,216,text_str_title);

if (c == MAIN_MENU_ENTRY_LOAD && flash)
write_text_inv(6, row++, text_str_load);
Expand Down Expand Up @@ -313,6 +316,21 @@ static void draw_mainMenu(enum MainMenuEntry c)
write_text_inv(column, row, text_str_on);
else
write_text(column, row, text_str_on);

row += 2;

write_text(6, row, text_str_ram);
column = 17;

if (!mainMenu_ram && (c != MAIN_MENU_ENTRY_RAM || flash))
write_text_inv(column, row, text_str_off);
else
write_text(column, row, text_str_off);
column += strlen(text_str_off) + 2;
if (mainMenu_ram && (c != MAIN_MENU_ENTRY_RAM || flash))
write_text_inv(column, row, text_str_on);
else
write_text(column, row, text_str_on);
#endif

row++;
Expand Down Expand Up @@ -480,6 +498,10 @@ static enum MainMenuEntry key_mainMenu(enum MainMenuEntry *sel)
if (left || right)
mainMenu_statusbar = ~mainMenu_statusbar;
break;
case MAIN_MENU_ENTRY_RAM:
if (left || right)
mainMenu_ram = ~mainMenu_ram;
break;
case MAIN_MENU_ENTRY_LOAD:
case MAIN_MENU_ENTRY_SAVED_STATES:
case MAIN_MENU_ENTRY_RESET_EMULATION:
Expand Down

0 comments on commit 133b5e1

Please sign in to comment.