Commit 7e0bf562 authored by turtleletortue's avatar turtleletortue
Browse files

Added things to fix rom loading from GmenuNX, added an about menu, and fixed...

Added things to fix rom loading from GmenuNX, added an about menu, and fixed the background to work with the about menu option.
parent d1ff1329
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#ifdef _OPENDINGUX_ #ifdef _OPENDINGUX_
#include "../platform/opendingux/shared.h" #include "../platform/opendingux/shared.h"
#endif #endif
#ifdef _RS97_
#include "../platform/rs97/shared.h"
#endif
static uint16 *supervision_palette; static uint16 *supervision_palette;
static uint8 gpu_regs[4]; static uint8 gpu_regs[4];
...@@ -110,6 +113,12 @@ void gpu_reset(void) ...@@ -110,6 +113,12 @@ void gpu_reset(void)
supervision_palette[1] = PIX_TO_RGB(actualScreen->format,170,170,170); supervision_palette[1] = PIX_TO_RGB(actualScreen->format,170,170,170);
supervision_palette[0] = PIX_TO_RGB(actualScreen->format,240,240,240); supervision_palette[0] = PIX_TO_RGB(actualScreen->format,240,240,240);
#endif #endif
#ifdef _RS97_
supervision_palette[3] = PIX_TO_RGB(actualScreen->format,0,0,0);
supervision_palette[2] = PIX_TO_RGB(actualScreen->format,85,85,85);
supervision_palette[1] = PIX_TO_RGB(actualScreen->format,170,170,170);
supervision_palette[0] = PIX_TO_RGB(actualScreen->format,240,240,240);
#endif
memset(gpu_regs, 0, 4); memset(gpu_regs, 0, 4);
} }
...@@ -192,6 +201,15 @@ void gpu_set_colour_scheme(int colourScheme) ...@@ -192,6 +201,15 @@ void gpu_set_colour_scheme(int colourScheme)
supervision_palette[1] = PIX_TO_RGB(actualScreen->format,p21, p22, p23); supervision_palette[1] = PIX_TO_RGB(actualScreen->format,p21, p22, p23);
supervision_palette[0] = PIX_TO_RGB(actualScreen->format,p31, p32, p33); supervision_palette[0] = PIX_TO_RGB(actualScreen->format,p31, p32, p33);
#endif #endif
#ifdef _RS97_
int p11 = (int) 85*redf; int p12 = (int) 85*greenf; int p13 = (int) 85*bluef;
int p21 = (int) 170*redf; int p22 = (int) 170*greenf; int p23 = (int) 170*bluef;
int p31 = (int) 255*redf; int p32 = (int) 255*greenf; int p33 = (int) 255*bluef;
supervision_palette[3] = PIX_TO_RGB(actualScreen->format,0,0,0);
supervision_palette[2] = PIX_TO_RGB(actualScreen->format,p11, p12, p13);
supervision_palette[1] = PIX_TO_RGB(actualScreen->format,p21, p22, p23);
supervision_palette[0] = PIX_TO_RGB(actualScreen->format,p31, p32, p33);
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
......
...@@ -203,7 +203,7 @@ void supervision_exec(int16 *backbuffer, BOOL bRender) ...@@ -203,7 +203,7 @@ void supervision_exec(int16 *backbuffer, BOOL bRender)
#ifdef GP2X #ifdef GP2X
if(currentConfig.enable_sound) sound_exec(11025/160); if(currentConfig.enable_sound) sound_exec(11025/160);
#else #else
//sound_exec(22050/160); sound_exec(22050/160);
#endif #endif
Run6502(&m6502_registers); Run6502(&m6502_registers);
#ifdef NDS #ifdef NDS
......
...@@ -7,3 +7,5 @@ Icon=potator ...@@ -7,3 +7,5 @@ Icon=potator
Categories=emulators; Categories=emulators;
Version=20200219 Version=20200219
X-OD-Manual=readme.txt X-OD-Manual=readme.txt
X-OD-Selector=/home/retrofw
X-OD-Filter=.sv,.bin
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#OSTYPE=msys #OSTYPE=msys
#OSTYPE=oda320 #OSTYPE=oda320
#OSTYPE=odgcw #OSTYPE=odgcw
#OSTYPE=testing
OSTYPE=retrofwrs97 OSTYPE=retrofwrs97
PRGNAME = potator PRGNAME = potator
...@@ -33,13 +34,18 @@ EXESUFFIX = .dge ...@@ -33,13 +34,18 @@ EXESUFFIX = .dge
CC = $(TOOLCHAIN)/bin/mipsel-linux-gcc CC = $(TOOLCHAIN)/bin/mipsel-linux-gcc
CCP = $(TOOLCHAIN)/bin/mipsel-linux-g++ CCP = $(TOOLCHAIN)/bin/mipsel-linux-g++
LD = $(TOOLCHAIN)/bin/mipsel-linux-g++ LD = $(TOOLCHAIN)/bin/mipsel-linux-g++
ifeq "$(OSTYPE)" "testing"
TOOLCHAIN = /bin
CC = gcc
CCP = g++
LD = g++
EXESUFFIX = .dge
endif
# add SDL dependencies # add SDL dependencies
SDL_LIB = $(TOOLCHAIN)/lib SDL_LIB = $(TOOLCHAIN)/lib
SDL_INCLUDE = $(TOOLCHAIN)/include SDL_INCLUDE = $(TOOLCHAIN)/include
# change compilation / linking flag options # change compilation / linking flag options
ifeq "$(OSTYPE)" "msys" ifeq "$(OSTYPE)" "msys"
F_OPTS =-fomit-frame-pointer -ffunction-sections -ffast-math -fsingle-precision-constant F_OPTS =-fomit-frame-pointer -ffunction-sections -ffast-math -fsingle-precision-constant
...@@ -59,12 +65,17 @@ CXXFLAGS = $(CFLAGS) ...@@ -59,12 +65,17 @@ CXXFLAGS = $(CFLAGS)
LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL
endif endif
ifeq "$(OSTYPE)" "retrofwrs97" ifeq "$(OSTYPE)" "retrofwrs97"
CC_OPTS = -O2 -mips32 -mhard-float -G0 -D_OPENDINGUX_ $(F_OPTS) CC_OPTS = -O2 -mips32 -mhard-float -G0 -D_RS97_ $(F_OPTS)
CFLAGS = -I$(SDL_INCLUDE) -DOPENDINGUX $(CC_OPTS) CFLAGS = -I$(SDL_INCLUDE) $(CC_OPTS)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL
endif endif
ifeq "$(OSTYPE)" "testing"
CC_OPTS = -O2
CFLAGS = -I$(SDL_INCLUDE) -DOPENDINGUX $(CC_OPTS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL
endif
# Files to be compiled # Files to be compiled
SRCDIR = ./common/m6502 ./common ./platform/rs97 SRCDIR = ./common/m6502 ./common ./platform/rs97
VPATH = $(SRCDIR) VPATH = $(SRCDIR)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -154,7 +154,8 @@ void initSDL(void) { ...@@ -154,7 +154,8 @@ void initSDL(void) {
unsigned char potatorLoadROM(char* filename) { unsigned char potatorLoadROM(char* filename) {
unsigned int length; unsigned int length;
fprintf(stderr, "\n IN the loading rom portion\n");
fprintf(stderr, filename);
if (rom_buffer != NULL) if (rom_buffer != NULL)
free(rom_buffer); free(rom_buffer);
...@@ -190,19 +191,20 @@ int main(int argc, char *argv[]) { ...@@ -190,19 +191,20 @@ int main(int argc, char *argv[]) {
initSDL(); initSDL();
SDL_WM_SetCaption("potator", NULL); SDL_WM_SetCaption("potator", NULL);
//load rom file via args if a rom path is supplied //load rom file via args if a rom path is supplied
if(argc > 1) { if(argc > 1) {
strcpy(gameName,argv[1]); strcpy(gameName,argv[1]);
m_Flag = GF_GAMEINIT; m_Flag = GF_GAMEINIT;
} }
// Initialize the virtual console emulation // Initialize the virtual console emulation
supervision_init(); supervision_init();
m_Flag = GF_MAINUI; //Make sure loading a rom is not already set to happen before loading main interface
if(m_Flag != GF_GAMEINIT){
m_Flag = GF_MAINUI;
}
system_loadcfg(current_conf_app); system_loadcfg(current_conf_app);
while (m_Flag != GF_GAMEQUIT) { while (m_Flag != GF_GAMEQUIT) {
SDL_PollEvent(&event); SDL_PollEvent(&event);
unsigned char *keys = SDL_GetKeyState(NULL); unsigned char *keys = SDL_GetKeyState(NULL);
...@@ -261,6 +263,9 @@ int main(int argc, char *argv[]) { ...@@ -261,6 +263,9 @@ int main(int argc, char *argv[]) {
if ( (keys[SDLK_ESCAPE] == SDL_PRESSED) && (keys[SDLK_RETURN] == SDL_PRESSED ) ) { if ( (keys[SDLK_ESCAPE] == SDL_PRESSED) && (keys[SDLK_RETURN] == SDL_PRESSED ) ) {
m_Flag = GF_MAINUI; m_Flag = GF_MAINUI;
} }
if ( (keys[SDLK_END] == SDL_PRESSED) ){
m_Flag = GF_MAINUI;
}
else if ( (keys[SDLK_RETURN] == SDL_PRESSED) ) controls_state |= keyCoresp[GameConf.OD_Joy[10]]; // START else if ( (keys[SDLK_RETURN] == SDL_PRESSED) ) controls_state |= keyCoresp[GameConf.OD_Joy[10]]; // START
else if ( (keys[SDLK_ESCAPE] == SDL_PRESSED) ) controls_state |= keyCoresp[GameConf.OD_Joy[11]]; // SELECT else if ( (keys[SDLK_ESCAPE] == SDL_PRESSED) ) controls_state |= keyCoresp[GameConf.OD_Joy[11]]; // SELECT
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "./data/potator_background.h" #include "./data/potator_background.h"
#include "./data/potator_load.h" #include "./data/potator_load.h"
#include "./data/potator_skin.h" #include "./data/potator_skin.h"
#include "string.h"
extern unsigned int m_Flag; extern unsigned int m_Flag;
...@@ -197,9 +198,10 @@ MENUITEM MainMenuItems[] = { ...@@ -197,9 +198,10 @@ MENUITEM MainMenuItems[] = {
{"Button Settings", NULL, 0, NULL, &screen_showkeymenu}, {"Button Settings", NULL, 0, NULL, &screen_showkeymenu},
{"Take Screenshot", NULL, 0, NULL, &menuSaveBmp}, {"Take Screenshot", NULL, 0, NULL, &menuSaveBmp},
{"Show FPS: ", (int *) &GameConf.m_DisplayFPS, 1,(char *) &mnuYesNo, NULL}, {"Show FPS: ", (int *) &GameConf.m_DisplayFPS, 1,(char *) &mnuYesNo, NULL},
{"About Potator", NULL, 0, NULL,&menuAbout},
{"Exit", NULL, 0, NULL, &menuQuit} {"Exit", NULL, 0, NULL, &menuQuit}
}; };
MENU mnuMainMenu = { 9, 0, (MENUITEM *) &MainMenuItems }; MENU mnuMainMenu = { 10, 0, (MENUITEM *) &MainMenuItems };
MENUITEM ConfigMenuItems[] = { MENUITEM ConfigMenuItems[] = {
{"Button A: ", (int *) &GameConf.OD_Joy[4], 6, (char *) &mnuButtons, NULL}, {"Button A: ", (int *) &GameConf.OD_Joy[4], 6, (char *) &mnuButtons, NULL},
...@@ -325,8 +327,8 @@ void screen_showmenu(MENU *menu) { ...@@ -325,8 +327,8 @@ void screen_showmenu(MENU *menu) {
int fg_color; int fg_color;
if(menu->itemCur == i) fg_color = COLOR_ACTIVE_ITEM; else fg_color = COLOR_INACTIVE_ITEM; if(menu->itemCur == i) fg_color = COLOR_ACTIVE_ITEM; else fg_color = COLOR_INACTIVE_ITEM;
screen_showitem(SPRX+10, 59+i*15, mi, fg_color); screen_showitem(SPRX+10, 51+i*15, mi, fg_color);
if(menu->itemCur == i) print_string("-", fg_color, COLOR_BG, SPRX+10-12, 59+i*15); if(menu->itemCur == i) print_string("-", fg_color, COLOR_BG, SPRX+10-12, 51+i*15);
} }
} }
...@@ -471,10 +473,13 @@ void screen_showmainmenu(MENU *menu) { ...@@ -471,10 +473,13 @@ void screen_showmainmenu(MENU *menu) {
if (gameMenu) { if (gameMenu) {
screen_showmenu(menu); // show menu items screen_showmenu(menu); // show menu items
if (menu == &mnuMainMenu) { if (menu == &mnuMainMenu) {
print_string("V1.1", COLOR_LIGHT,COLOR_BG, 294,29); print_string("Build: 20200220", COLOR_LIGHT,COLOR_BG, 220,29);
if (cartridge_IsLoaded()) { if (cartridge_IsLoaded()) {
#ifdef _OPENDINGUX_ #ifdef _OPENDINGUX_
sprintf(szVal,"Game:%s",strrchr(gameName,'/')+1);szVal[(320/6)-2] = '\0'; sprintf(szVal,"Game:%s",strrchr(gameName,'/')+1);szVal[(320/6)-2] = '\0';
#endif
#ifdef _RS97_
sprintf(szVal,"Game:%s",strrchr(gameName,'/')+1);szVal[(320/6)-2] = '\0';
#else #else
sprintf(szVal,"Game:%s",strrchr(gameName,'\\')+1);szVal[(320/6)-2] = '\0'; sprintf(szVal,"Game:%s",strrchr(gameName,'\\')+1);szVal[(320/6)-2] = '\0';
#endif #endif
...@@ -755,6 +760,9 @@ signed int load_file(char **wildcards, char *result) { ...@@ -755,6 +760,9 @@ signed int load_file(char **wildcards, char *result) {
return_value = 0; return_value = 0;
#ifdef _OPENDINGUX_ #ifdef _OPENDINGUX_
sprintf(result, "%s/%s", current_dir_name, filedir_list[current_filedir_selection].name); sprintf(result, "%s/%s", current_dir_name, filedir_list[current_filedir_selection].name);
#endif
#ifdef _RS97_
sprintf(result, "%s/%s", current_dir_name, filedir_list[current_filedir_selection].name);
#else #else
sprintf(result, "%s\\%s", current_dir_name, filedir_list[current_filedir_selection].name); sprintf(result, "%s\\%s", current_dir_name, filedir_list[current_filedir_selection].name);
#endif #endif
...@@ -881,6 +889,9 @@ void menuSaveBmp(void) { ...@@ -881,6 +889,9 @@ void menuSaveBmp(void) {
if (cartridge_IsLoaded()) { if (cartridge_IsLoaded()) {
#ifdef _OPENDINGUX_ #ifdef _OPENDINGUX_
sprintf(szFile,"./%s",strrchr(gameName,'/')+1); sprintf(szFile,"./%s",strrchr(gameName,'/')+1);
#endif
#ifdef _RS97_
sprintf(szFile,"./%s",strrchr(gameName,'/')+1);
#else #else
sprintf(szFile,".\\%s",strrchr(gameName,'\\')+1); sprintf(szFile,".\\%s",strrchr(gameName,'\\')+1);
#endif #endif
...@@ -943,7 +954,8 @@ void menuReturn(void) { ...@@ -943,7 +954,8 @@ void menuReturn(void) {
void system_loadcfg(char *cfg_name) { void system_loadcfg(char *cfg_name) {
int fd; int fd;
//fprintf(stderr,"\nLoading Cfg\n");
//fprintf(stderr,cfg_name);
fd = open(cfg_name, O_RDONLY | O_BINARY); fd = open(cfg_name, O_RDONLY | O_BINARY);
if (fd >= 0) { if (fd >= 0) {
read(fd, &GameConf, sizeof(GameConf)); read(fd, &GameConf, sizeof(GameConf));
...@@ -998,7 +1010,54 @@ void gethomedir(char *dir, char* name) { ...@@ -998,7 +1010,54 @@ void gethomedir(char *dir, char* name) {
} }
sprintf(dir,"%s//.%s//",dir, name); sprintf(dir,"%s//.%s//",dir, name);
mkdir(dir,S_IRWXU | S_IRWXG | S_IRWXO); // create $HOME/.config/program if it doesn't exist mkdir(dir,S_IRWXU | S_IRWXG | S_IRWXO); // create $HOME/.config/program if it doesn't exist
#endif
#ifdef _RS97_
strcpy(dir, getenv("HOME"));
if (strlen(dir) == 0) {
getcwd(dir, 256);
}
sprintf(dir,"%s//.%s//",dir, name);
mkdir(dir,S_IRWXU | S_IRWXG | S_IRWXO); // create $HOME/.config/program if it doesn't exist
#else #else
getcwd(dir, 256); getcwd(dir, 256);
#endif #endif
} }
void menuAbout(){
unsigned char *keys;
unsigned int keyb = 0;
int repeat = 1;
int return_value;
int fg_color = COLOR_INACTIVE_ITEM;
// Code taken from file selector. In short traps it and displays stuff on screen.
while(repeat) {
screen_prepback(layer, POTATOR_LOAD, POTATOR_LOAD_SIZE);
print_string("Credit goes to:",COLOR_ACTIVE_ITEM,COLOR_BG, 110,50);
print_string("Cal2 and Normmat for potator source code", fg_color,COLOR_BG,20, 65);
print_string("Mess Team for supervision driver",fg_color,COLOR_BG,20,80);
print_string("d_smargin for handy_a320 gui", fg_color,COLOR_BG,20,95);
print_string("qbertaddict for testing", fg_color,COLOR_BG,20,110);
print_string("hi-ban for the skin", fg_color,COLOR_BG,20,125);
print_string("Alekmaul for porting to GCW Zero", fg_color,COLOR_BG,20,140);
print_string("Retrofw port exists thanks to these people", COLOR_KO,COLOR_BG,20,155);
print_string("Press B to return to the main menu", COLOR_HELP_TEXT, COLOR_BG, 160-(34*8/2), 240-5 -10*3);
// Catch input
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
// B - exit or back to previous menu
if (keys[SDLK_LALT] == SDL_PRESSED) {
if (!keyb) {
keyb = 1;
return_value = -1;
repeat = 0;
}
}
else keyb=0;
SDL_Delay(16);
screen_flip();
}
}
...@@ -65,4 +65,4 @@ http://www.portabledev.com ...@@ -65,4 +65,4 @@ http://www.portabledev.com
EDITED! EDITED!
This folder is for rs97. It should be identical to the opendingux folder This folder is for rs97. It should be similar to the opendingux folder
...@@ -84,6 +84,7 @@ extern void mainemuinit(); ...@@ -84,6 +84,7 @@ extern void mainemuinit();
extern void screen_showtopmenu(void); extern void screen_showtopmenu(void);
extern void print_string_video(int x, int y, const char *s); extern void print_string_video(int x, int y, const char *s);
extern void gethomedir(char *dir, char* name); extern void gethomedir(char *dir, char* name);
extern void menuAbout();
// sound // sound
/* /*
......
File added
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment