Code cleanup
Removed unneeded code
This commit is contained in:
parent
ccd65acb1f
commit
e5c5eddda6
7 changed files with 107 additions and 235 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -26,3 +26,4 @@ Amiberry/VisualGDB/Release/Amiberry
|
||||||
*.TMP
|
*.TMP
|
||||||
VisualGDB/VisualGDB/Release/Amiberry
|
VisualGDB/VisualGDB/Release/Amiberry
|
||||||
VisualGDB/VisualGDB/Debug/Amiberry
|
VisualGDB/VisualGDB/Debug/Amiberry
|
||||||
|
*.npa00-a6b8830a
|
||||||
|
|
|
@ -641,7 +641,8 @@ static int real_main2 (int argc, TCHAR **argv)
|
||||||
{
|
{
|
||||||
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
||||||
abort();
|
abort();
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
||||||
sdlWindow = SDL_CreateWindow("Amiberry v2",
|
sdlWindow = SDL_CreateWindow("Amiberry v2",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
|
@ -706,13 +707,13 @@ static int real_main2 (int argc, TCHAR **argv)
|
||||||
if (err == -1) {
|
if (err == -1) {
|
||||||
write_log(_T("Failed to initialize the GUI\n"));
|
write_log(_T("Failed to initialize the GUI\n"));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (err == -2) {
|
}
|
||||||
|
else if (err == -2) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setCpuSpeed();
|
|
||||||
update_display(&currprefs);
|
update_display(&currprefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,44 +128,6 @@ void RegisterRefreshFunc(void (*func)(void))
|
||||||
namespace sdl
|
namespace sdl
|
||||||
{
|
{
|
||||||
void gui_init()
|
void gui_init()
|
||||||
// {
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// // Set layer for GUI screen
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// char tmp[20];
|
|
||||||
// snprintf(tmp, 20, "%dx%d", GUI_WIDTH, GUI_HEIGHT);
|
|
||||||
// setenv("SDL_OMAP_LAYER_SIZE", tmp, 1);
|
|
||||||
// snprintf(tmp, 20, "0,0,0,0");
|
|
||||||
// setenv("SDL_OMAP_BORDER_CUT", tmp, 1);
|
|
||||||
//
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// // Create new screen for GUI
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// #if defined (RASPBERRY)
|
|
||||||
// const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
|
|
||||||
//#ifdef DEBUG
|
|
||||||
// printf("Current resolution: %d x %d %d bpp\n",videoInfo->current_w, videoInfo->current_h, videoInfo->vfmt->BitsPerPixel);
|
|
||||||
//#endif
|
|
||||||
// gui_screen = SDL_SetVideoMode(videoInfo->current_w, videoInfo->current_h, videoInfo->vfmt->BitsPerPixel, SDL_SWSURFACE | SDL_FULLSCREEN);
|
|
||||||
// #else
|
|
||||||
// gui_screen = SDL_SetVideoMode(GUI_WIDTH, GUI_HEIGHT, 16, SDL_SWSURFACE);
|
|
||||||
// #endif
|
|
||||||
// SDL_EnableUNICODE(1);
|
|
||||||
// SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
|
||||||
// SDL_ShowCursor(SDL_ENABLE);
|
|
||||||
//
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// // Create helpers for guisan
|
|
||||||
// //-------------------------------------------------
|
|
||||||
// gui_imageLoader = new gcn::SDLImageLoader();
|
|
||||||
// gcn::Image::setImageLoader(gui_imageLoader);
|
|
||||||
// gui_graphics = new gcn::SDLGraphics();
|
|
||||||
// gui_graphics->setTarget(gui_screen);
|
|
||||||
// gui_input = new gcn::SDLInput();
|
|
||||||
// uae_gui = new gcn::Gui();
|
|
||||||
// uae_gui->setGraphics(gui_graphics);
|
|
||||||
// uae_gui->setInput(gui_input);
|
|
||||||
// }
|
|
||||||
{
|
{
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Create new screen for GUI
|
// Create new screen for GUI
|
||||||
|
@ -308,8 +270,6 @@ namespace sdl
|
||||||
// Now we let the Gui object draw itself.
|
// Now we let the Gui object draw itself.
|
||||||
uae_gui->draw();
|
uae_gui->draw();
|
||||||
// Finally we update the screen.
|
// Finally we update the screen.
|
||||||
// wait_for_vsync();
|
|
||||||
// SDL_Flip(gui_screen);
|
|
||||||
|
|
||||||
// Update the texture from the surface
|
// Update the texture from the surface
|
||||||
SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch);
|
SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch);
|
||||||
|
@ -528,7 +488,6 @@ void gui_init()
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
gui_top->add(cmdReset, DISTANCE_BORDER, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
gui_top->add(cmdReset, DISTANCE_BORDER, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
||||||
gui_top->add(cmdQuit, DISTANCE_BORDER + BUTTON_WIDTH + DISTANCE_NEXT_X, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
gui_top->add(cmdQuit, DISTANCE_BORDER + BUTTON_WIDTH + DISTANCE_NEXT_X, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
||||||
// gui_top->add(cmdRestart, DISTANCE_BORDER + 2 * BUTTON_WIDTH + 2 * DISTANCE_NEXT_X, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
|
||||||
gui_top->add(cmdStart, GUI_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
gui_top->add(cmdStart, GUI_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT);
|
||||||
|
|
||||||
gui_top->add(selectors, DISTANCE_BORDER + 1, DISTANCE_BORDER + 1);
|
gui_top->add(selectors, DISTANCE_BORDER + 1, DISTANCE_BORDER + 1);
|
||||||
|
|
|
@ -71,10 +71,6 @@ static char rom_path[MAX_DPATH];
|
||||||
static char rp9_path[MAX_DPATH];
|
static char rp9_path[MAX_DPATH];
|
||||||
char last_loaded_config[MAX_DPATH] = { '\0' };
|
char last_loaded_config[MAX_DPATH] = { '\0' };
|
||||||
|
|
||||||
static bool cpuSpeedChanged = false;
|
|
||||||
static int lastCpuSpeed = 600;
|
|
||||||
int defaultCpuSpeed = 600;
|
|
||||||
|
|
||||||
int max_uae_width;
|
int max_uae_width;
|
||||||
int max_uae_height;
|
int max_uae_height;
|
||||||
|
|
||||||
|
@ -255,7 +251,6 @@ void target_default_options (struct uae_prefs *p, int type)
|
||||||
{
|
{
|
||||||
p->pandora_horizontal_offset = 0;
|
p->pandora_horizontal_offset = 0;
|
||||||
p->pandora_vertical_offset = 0;
|
p->pandora_vertical_offset = 0;
|
||||||
p->pandora_cpu_speed = defaultCpuSpeed;
|
|
||||||
p->pandora_hide_idle_led = 0;
|
p->pandora_hide_idle_led = 0;
|
||||||
|
|
||||||
p->pandora_tapDelay = 10;
|
p->pandora_tapDelay = 10;
|
||||||
|
@ -685,78 +680,6 @@ bool SetVSyncRate(int hz)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCpuSpeed()
|
|
||||||
{
|
|
||||||
#ifdef PANDORA_SPECIFIC
|
|
||||||
char speedCmd[128];
|
|
||||||
|
|
||||||
currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed;
|
|
||||||
|
|
||||||
if(currprefs.pandora_cpu_speed != lastCpuSpeed)
|
|
||||||
{
|
|
||||||
snprintf((char*)speedCmd, 128, "unset DISPLAY; echo y | sudo -n /usr/pandora/scripts/op_cpuspeed.sh %d", currprefs.pandora_cpu_speed);
|
|
||||||
system(speedCmd);
|
|
||||||
lastCpuSpeed = currprefs.pandora_cpu_speed;
|
|
||||||
cpuSpeedChanged = true;
|
|
||||||
}
|
|
||||||
if(changed_prefs.ntscmode != currprefs.ntscmode)
|
|
||||||
{
|
|
||||||
if(changed_prefs.ntscmode)
|
|
||||||
SetVSyncRate(60);
|
|
||||||
else
|
|
||||||
SetVSyncRate(50);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int getDefaultCpuSpeed(void)
|
|
||||||
{
|
|
||||||
#ifdef PANDORA_SPECIFIC
|
|
||||||
int speed = 600;
|
|
||||||
FILE* f = fopen ("/etc/pandora/conf/cpu.conf", "rt");
|
|
||||||
if(f)
|
|
||||||
{
|
|
||||||
char line[128];
|
|
||||||
for(int i=0; i<6; ++i)
|
|
||||||
{
|
|
||||||
fscanf(f, "%s\n", &line);
|
|
||||||
if(strncmp(line, "default:", 8) == 0)
|
|
||||||
{
|
|
||||||
int value = 0;
|
|
||||||
sscanf(line, "default:%d", &value);
|
|
||||||
if(value > 500 && value < 1200)
|
|
||||||
{
|
|
||||||
speed = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
return speed;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void resetCpuSpeed(void)
|
|
||||||
{
|
|
||||||
#ifdef PANDORA_SPECIFIC
|
|
||||||
if(cpuSpeedChanged)
|
|
||||||
{
|
|
||||||
lastCpuSpeed = defaultCpuSpeed - 10;
|
|
||||||
currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed = defaultCpuSpeed;
|
|
||||||
setCpuSpeed();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void target_reset (void)
|
void target_reset (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -787,8 +710,6 @@ int main (int argc, char *argv[])
|
||||||
max_uae_width = 768;
|
max_uae_width = 768;
|
||||||
max_uae_height = 270;
|
max_uae_height = 270;
|
||||||
|
|
||||||
defaultCpuSpeed = getDefaultCpuSpeed();
|
|
||||||
|
|
||||||
// Get startup path
|
// Get startup path
|
||||||
getcwd(start_path_data, MAX_DPATH);
|
getcwd(start_path_data, MAX_DPATH);
|
||||||
loadAdfDir();
|
loadAdfDir();
|
||||||
|
@ -850,9 +771,6 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
logging_cleanup();
|
logging_cleanup();
|
||||||
|
|
||||||
// printf("Threads at exit:\n");
|
|
||||||
// dbg_list_threads();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ int gui_init (void)
|
||||||
if (quit_program == UAE_QUIT)
|
if (quit_program == UAE_QUIT)
|
||||||
ret = -2; // Quit without start of emulator
|
ret = -2; // Quit without start of emulator
|
||||||
|
|
||||||
setCpuSpeed();
|
// setCpuSpeed();
|
||||||
update_display(&changed_prefs);
|
update_display(&changed_prefs);
|
||||||
|
|
||||||
after_leave_gui();
|
after_leave_gui();
|
||||||
|
@ -476,7 +476,7 @@ int gui_init (void)
|
||||||
|
|
||||||
void gui_exit(void)
|
void gui_exit(void)
|
||||||
{
|
{
|
||||||
resetCpuSpeed();
|
// resetCpuSpeed();
|
||||||
sync();
|
sync();
|
||||||
pandora_stop_sound();
|
pandora_stop_sound();
|
||||||
saveAdfDir();
|
saveAdfDir();
|
||||||
|
@ -554,10 +554,6 @@ void gui_display (int shortcut)
|
||||||
prefs_to_gui();
|
prefs_to_gui();
|
||||||
run_gui();
|
run_gui();
|
||||||
gui_to_prefs();
|
gui_to_prefs();
|
||||||
setCpuSpeed();
|
|
||||||
// if(quit_program)
|
|
||||||
// screen_is_picasso = 0;
|
|
||||||
|
|
||||||
update_display(&changed_prefs);
|
update_display(&changed_prefs);
|
||||||
|
|
||||||
/* Clear menu garbage at the bottom of the screen */
|
/* Clear menu garbage at the bottom of the screen */
|
||||||
|
@ -589,7 +585,6 @@ extern char keyboard_type;
|
||||||
|
|
||||||
void gui_handle_events (void)
|
void gui_handle_events (void)
|
||||||
{
|
{
|
||||||
// Uint8 *keystate = SDL_GetKeyState(NULL);
|
|
||||||
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_MENU]))
|
if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_MENU]))
|
||||||
|
|
|
@ -282,7 +282,6 @@ static int init_joystick (void)
|
||||||
for (int cpt; cpt < nr_joysticks; cpt++)
|
for (int cpt; cpt < nr_joysticks; cpt++)
|
||||||
{
|
{
|
||||||
Joysticktable[cpt] = SDL_JoystickOpen(cpt);
|
Joysticktable[cpt] = SDL_JoystickOpen(cpt);
|
||||||
// strncpy(JoystickName[cpt],SDL_JoystickName(cpt),80);
|
|
||||||
strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), 80);
|
strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), 80);
|
||||||
printf("Joystick %i : %s\n", cpt, JoystickName[cpt]);
|
printf("Joystick %i : %s\n", cpt, JoystickName[cpt]);
|
||||||
printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt]));
|
printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt]));
|
||||||
|
@ -422,7 +421,6 @@ static void read_joystick (void)
|
||||||
// First handle fake joystick from pandora...
|
// First handle fake joystick from pandora...
|
||||||
if(currprefs.jports[joyid].id == JSEM_JOYS)
|
if(currprefs.jports[joyid].id == JSEM_JOYS)
|
||||||
{
|
{
|
||||||
//// Uint8 *keystate = SDL_GetKeyState(NULL);
|
|
||||||
// const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
// const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
||||||
//
|
//
|
||||||
// if(!keystate[VK_R])
|
// if(!keystate[VK_R])
|
||||||
|
|
|
@ -27,8 +27,8 @@ void wait_for_vsync(void);
|
||||||
|
|
||||||
void saveAdfDir(void);
|
void saveAdfDir(void);
|
||||||
bool SetVSyncRate(int hz);
|
bool SetVSyncRate(int hz);
|
||||||
void setCpuSpeed(void);
|
//void setCpuSpeed(void);
|
||||||
void resetCpuSpeed(void);
|
//void resetCpuSpeed(void);
|
||||||
void update_display(struct uae_prefs *);
|
void update_display(struct uae_prefs *);
|
||||||
void black_screen_now(void);
|
void black_screen_now(void);
|
||||||
void graphics_subshutdown (void);
|
void graphics_subshutdown (void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue