ssnes_* => rarch_*.

This commit is contained in:
Themaister 2012-04-21 23:25:32 +02:00
parent 9ab51ad23a
commit aab8fb6151
108 changed files with 1494 additions and 1494 deletions

View File

@ -76,7 +76,7 @@ HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
HRESULT hr = xdk360_video_font_init(&m_Font, strFontFileName ); HRESULT hr = xdk360_video_font_init(&m_Font, strFontFileName );
if( FAILED( hr ) ) if( FAILED( hr ) )
{ {
SSNES_ERR( "Could not create font.\n" ); RARCH_ERR( "Could not create font.\n" );
return -1; return -1;
} }
@ -470,14 +470,14 @@ HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * strFontF
} }
else else
{ {
SSNES_ERR( "Incorrect version number on font file.\n" ); RARCH_ERR( "Incorrect version number on font file.\n" );
return E_FAIL; return E_FAIL;
} }
// Create the vertex and pixel shaders for rendering the font // Create the vertex and pixel shaders for rendering the font
if( FAILED( xdk360_video_font_create_shaders(font) ) ) if( FAILED( xdk360_video_font_create_shaders(font) ) )
{ {
SSNES_ERR( "Could not create font shaders.\n" ); RARCH_ERR( "Could not create font shaders.\n" );
return E_FAIL; return E_FAIL;
} }
@ -763,7 +763,7 @@ void xdk360_video_font_draw_text(xdk360_video_font_t * font, float fOriginX, flo
// The ring buffer may run out of space when tiling, doing z-prepasses, // The ring buffer may run out of space when tiling, doing z-prepasses,
// or using BeginCommandBuffer. If so, make the buffer larger. // or using BeginCommandBuffer. If so, make the buffer larger.
if( FAILED( hr ) ) if( FAILED( hr ) )
SSNES_ERR( "Ring buffer out of memory.\n" ); RARCH_ERR( "Ring buffer out of memory.\n" );
// Draw four vertices for each glyph // Draw four vertices for each glyph
while( *strText ) while( *strText )

View File

@ -14,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef SSNES_360_FONTS_H #ifndef RARCH_360_FONTS_H
#define SSNES_360_FONTS_H #define RARCH_360_FONTS_H
#include "xdk360_video_resources.h" #include "xdk360_video_resources.h"

View File

@ -56,7 +56,7 @@ extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);
int Mounted[20]; int Mounted[20];
int ssnes_main(int argc, char *argv[]); int rarch_main(int argc, char *argv[]);
#undef main #undef main
@ -136,26 +136,26 @@ static void set_default_settings (void)
g_settings.video.smooth = true; g_settings.video.smooth = true;
g_settings.video.aspect_ratio = -1.0f; g_settings.video.aspect_ratio = -1.0f;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK360_DEVICE_ID_JOYPAD_A].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[XDK360_DEVICE_ID_JOYPAD_A].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK360_DEVICE_ID_JOYPAD_X].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[XDK360_DEVICE_ID_JOYPAD_X].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_BACK].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_BACK].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[XDK360_DEVICE_ID_JOYPAD_START].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[XDK360_DEVICE_ID_JOYPAD_START].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[XDK360_DEVICE_ID_JOYPAD_UP].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[XDK360_DEVICE_ID_JOYPAD_UP].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[XDK360_DEVICE_ID_JOYPAD_DOWN].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[XDK360_DEVICE_ID_JOYPAD_DOWN].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_LEFT].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_LEFT].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_RIGHT].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[XDK360_DEVICE_ID_JOYPAD_RIGHT].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[XDK360_DEVICE_ID_JOYPAD_B].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[XDK360_DEVICE_ID_JOYPAD_B].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[XDK360_DEVICE_ID_JOYPAD_Y].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[XDK360_DEVICE_ID_JOYPAD_Y].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK360_DEVICE_ID_JOYPAD_LB].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[XDK360_DEVICE_ID_JOYPAD_LB].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK360_DEVICE_ID_JOYPAD_RB].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[XDK360_DEVICE_ID_JOYPAD_RB].joykey;
for(uint32_t x = 0; x < MAX_PLAYERS; x++) for(uint32_t x = 0; x < MAX_PLAYERS; x++)
ssnes_input_set_default_keybinds(x); rarch_input_set_default_keybinds(x);
//g_console //g_console
g_console.block_config_read = true; g_console.block_config_read = true;
g_console.gamma_correction_enable = false; g_console.gamma_correction_enable = false;
g_console.initialize_ssnes_enable = false; g_console.initialize_rarch_enable = false;
g_console.emulator_initialized = 0; g_console.emulator_initialized = 0;
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
g_console.screen_orientation = ORIENTATION_NORMAL; g_console.screen_orientation = ORIENTATION_NORMAL;
@ -180,7 +180,7 @@ static void init_settings (bool load_libretro_path)
if(!path_file_exists(SYS_CONFIG_FILE)) if(!path_file_exists(SYS_CONFIG_FILE))
{ {
FILE * f; FILE * f;
SSNES_ERR("Config file \"%s\" desn't exist. Creating...\n", "game:\\ssnes.cfg"); RARCH_ERR("Config file \"%s\" desn't exist. Creating...\n", "game:\\ssnes.cfg");
f = fopen(SYS_CONFIG_FILE, "w"); f = fopen(SYS_CONFIG_FILE, "w");
fclose(f); fclose(f);
} }
@ -199,7 +199,7 @@ static void init_settings (bool load_libretro_path)
if (!dir_list) if (!dir_list)
{ {
SSNES_ERR("Couldn't read directory.\n"); RARCH_ERR("Couldn't read directory.\n");
return; return;
} }
@ -211,24 +211,24 @@ static void init_settings (bool load_libretro_path)
if(strcmp(fname_tmp, "SSNES-Salamander.xex") == 0) if(strcmp(fname_tmp, "SSNES-Salamander.xex") == 0)
{ {
SSNES_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n"); RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_xex = dir_list[1]; first_xex = dir_list[1];
fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp)); fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp));
if(!first_xex) if(!first_xex)
{ {
//This is very unlikely to happen //This is very unlikely to happen
SSNES_WARN("There is no second entry - no choice but to set it to RetroArch Salamander\n"); RARCH_WARN("There is no second entry - no choice but to set it to RetroArch Salamander\n");
first_xex = dir_list[0]; first_xex = dir_list[0];
fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp)); fill_pathname_base(fname_tmp, first_xex, sizeof(fname_tmp));
} }
} }
SSNES_LOG("Set first .xex entry in dir: [%s] to libretro path.\n", fname_tmp); RARCH_LOG("Set first .xex entry in dir: [%s] to libretro path.\n", fname_tmp);
snprintf(g_settings.libretro, sizeof(g_settings.libretro), "game:\\%s", fname_tmp); snprintf(g_settings.libretro, sizeof(g_settings.libretro), "game:\\%s", fname_tmp);
} }
else else
{ {
SSNES_ERR("Failed to set first .xex entry to libretro path.\n"); RARCH_ERR("Failed to set first .xex entry to libretro path.\n");
} }
dir_list_free(dir_list); dir_list_free(dir_list);
@ -289,7 +289,7 @@ static void save_settings (void)
config_set_int(conf, "audio_mute", g_extern.audio_data.mute); config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
if (!config_file_write(conf, SYS_CONFIG_FILE)) if (!config_file_write(conf, SYS_CONFIG_FILE))
SSNES_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE); RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE);
free(conf); free(conf);
} }
@ -318,14 +318,14 @@ static void get_environment_settings (void)
if(ret != TRUE) if(ret != TRUE)
{ {
SSNES_ERR("Couldn't change number of bytes reserved for file system cache.\n"); RARCH_ERR("Couldn't change number of bytes reserved for file system cache.\n");
} }
ret = XFileCacheInit(XFILECACHE_CLEAR_ALL, 0x100000, XFILECACHE_DEFAULT_THREAD, 0, 1); ret = XFileCacheInit(XFILECACHE_CLEAR_ALL, 0x100000, XFILECACHE_DEFAULT_THREAD, 0, 1);
if(ret != ERROR_SUCCESS) if(ret != ERROR_SUCCESS)
{ {
SSNES_ERR("File cache could not be initialized.\n"); RARCH_ERR("File cache could not be initialized.\n");
} }
XFlushUtilityDrive(); XFlushUtilityDrive();
@ -333,7 +333,7 @@ static void get_environment_settings (void)
//if(result != ERROR_SUCCESS) //if(result != ERROR_SUCCESS)
//{ //{
// SSNES_ERR("Couldn't mount/format utility drive.\n"); // RARCH_ERR("Couldn't mount/format utility drive.\n");
//} //}
// detect install environment // detect install environment
@ -372,13 +372,13 @@ int main(int argc, char *argv[])
{ {
get_environment_settings(); get_environment_settings();
ssnes_main_clear_state(); rarch_main_clear_state();
config_set_defaults(); config_set_defaults();
char full_path[1024]; char full_path[1024];
snprintf(full_path, sizeof(full_path), "game:\\CORE.xex"); snprintf(full_path, sizeof(full_path), "game:\\CORE.xex");
bool load_libretro_path = ssnes_manage_libretro_core(full_path, "game:\\", ".xex"); bool load_libretro_path = rarch_manage_libretro_core(full_path, "game:\\", ".xex");
set_default_settings(); set_default_settings();
init_settings(load_libretro_path); init_settings(load_libretro_path);
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
xdk360_video_init(); xdk360_video_init();
xdk360_input_init(); xdk360_input_init();
ssnes_input_set_default_keybind_names_for_emulator(); rarch_input_set_default_keybind_names_for_emulator();
menu_init(); menu_init();
@ -399,13 +399,13 @@ begin_loop:
input_xdk360.poll(NULL); input_xdk360.poll(NULL);
do{ do{
repeat = ssnes_main_iterate(); repeat = rarch_main_iterate();
}while(repeat && !g_console.frame_advance_enable); }while(repeat && !g_console.frame_advance_enable);
} }
else if(g_console.mode_switch == MODE_MENU) else if(g_console.mode_switch == MODE_MENU)
{ {
menu_loop(); menu_loop();
ssnes_startup(SYS_CONFIG_FILE); rarch_startup(SYS_CONFIG_FILE);
} }
else else
goto begin_shutdown; goto begin_shutdown;
@ -418,7 +418,7 @@ begin_shutdown:
menu_deinit(); menu_deinit();
xdk360_video_deinit(); xdk360_video_deinit();
ssnes_exec(); rarch_exec();
return 0; return 0;
} }

View File

@ -42,7 +42,7 @@ static void return_to_dashboard (void)
{ {
g_console.menu_enable = false; g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
g_console.initialize_ssnes_enable = false; g_console.initialize_rarch_enable = false;
} }
/* Register custom classes */ /* Register custom classes */
@ -186,14 +186,14 @@ HRESULT CSSNESQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
case MENU_ITEM_LOAD_STATE: case MENU_ITEM_LOAD_STATE:
if (g_console.emulator_initialized) if (g_console.emulator_initialized)
{ {
ssnes_load_state(); rarch_load_state();
return_to_game(); return_to_game();
} }
break; break;
case MENU_ITEM_SAVE_STATE: case MENU_ITEM_SAVE_STATE:
if (g_console.emulator_initialized) if (g_console.emulator_initialized)
{ {
ssnes_save_state(); rarch_save_state();
return_to_game(); return_to_game();
} }
break; break;
@ -258,7 +258,7 @@ HRESULT CSSNESQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
if (g_console.emulator_initialized) if (g_console.emulator_initialized)
{ {
return_to_game(); return_to_game();
ssnes_game_reset(); rarch_game_reset();
} }
break; break;
case MENU_ITEM_RETURN_TO_GAME: case MENU_ITEM_RETURN_TO_GAME:
@ -330,14 +330,14 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{ {
char path_tmp[1024]; char path_tmp[1024];
sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
ssnes_extract_zipfile(path_tmp); rarch_extract_zipfile(path_tmp);
} }
else else
{ {
memset(g_console.rom_path, 0, sizeof(g_console.rom_path)); memset(g_console.rom_path, 0, sizeof(g_console.rom_path));
sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
return_to_game(); return_to_game();
g_console.initialize_ssnes_enable = 1; g_console.initialize_rarch_enable = 1;
} }
} }
else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY) else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
@ -350,12 +350,12 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
} }
else if (hObjPressed == m_dir_game) else if (hObjPressed == m_dir_game)
{ {
filebrowser_new(&browser, g_console.default_rom_startup_dir, ssnes_console_get_rom_ext()); filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());
filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle); filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);
} }
else if (hObjPressed == m_dir_cache) else if (hObjPressed == m_dir_cache)
{ {
filebrowser_new(&browser, "cache:", ssnes_console_get_rom_ext()); filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext());
filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle); filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle);
} }
else if(hObjPressed == m_back) else if(hObjPressed == m_back)
@ -439,40 +439,40 @@ HRESULT CSSNESMain::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
if ( hObjPressed == m_filebrowser ) if ( hObjPressed == m_filebrowser )
{ {
hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"ssnes_filebrowser.xur", NULL, &app.hFileBrowser); hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_filebrowser.xur", NULL, &app.hFileBrowser);
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed to load scene.\n"); RARCH_ERR("Failed to load scene.\n");
} }
NavigateForward(app.hFileBrowser); NavigateForward(app.hFileBrowser);
} }
else if ( hObjPressed == m_quick_menu) else if ( hObjPressed == m_quick_menu)
{ {
hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"ssnes_quickmenu.xur", NULL, &app.hQuickMenu); hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_quickmenu.xur", NULL, &app.hQuickMenu);
if (FAILED(hr)) if (FAILED(hr))
SSNES_ERR("Failed to load scene.\n"); RARCH_ERR("Failed to load scene.\n");
NavigateForward(app.hQuickMenu); NavigateForward(app.hQuickMenu);
} }
else if ( hObjPressed == m_change_libsnes_core ) else if ( hObjPressed == m_change_libsnes_core )
{ {
hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"ssnes_libsnescore_browser.xur", NULL, &app.hCoreBrowser); hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_libsnescore_browser.xur", NULL, &app.hCoreBrowser);
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed to load scene.\n"); RARCH_ERR("Failed to load scene.\n");
} }
NavigateForward(app.hCoreBrowser); NavigateForward(app.hCoreBrowser);
} }
else if ( hObjPressed == m_settings ) else if ( hObjPressed == m_settings )
{ {
hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"ssnes_settings.xur", NULL, &app.hSSNESSettings); hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_settings.xur", NULL, &app.hSSNESSettings);
if (FAILED(hr)) if (FAILED(hr))
SSNES_ERR("Failed to load scene.\n"); RARCH_ERR("Failed to load scene.\n");
NavigateForward(app.hSSNESSettings); NavigateForward(app.hSSNESSettings);
} }
@ -493,7 +493,7 @@ int menu_init (void)
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed initializing XUI application.\n"); RARCH_ERR("Failed initializing XUI application.\n");
return 1; return 1;
} }
@ -501,27 +501,27 @@ int menu_init (void)
hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/ssnes.ttf" ); hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/ssnes.ttf" );
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed to register default typeface.\n"); RARCH_ERR("Failed to register default typeface.\n");
return 1; return 1;
} }
hr = app.LoadSkin( L"file://game:/media/ssnes_scene_skin.xur"); hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur");
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed to load skin.\n"); RARCH_ERR("Failed to load skin.\n");
return 1; return 1;
} }
hr = XuiSceneCreate(L"file://game:/media/sd/", L"ssnes_main.xur", NULL, &app.hMainScene); hr = XuiSceneCreate(L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene);
if (FAILED(hr)) if (FAILED(hr))
{ {
SSNES_ERR("Failed to create scene 'ssnes_main.xur'.\n"); RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n");
return 1; return 1;
} }
XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS); XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS);
filebrowser_new(&browser, g_console.default_rom_startup_dir, ssnes_console_get_rom_ext()); filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());
return 0; return 0;
} }
@ -546,7 +546,7 @@ void menu_loop(void)
g_frame_count++; g_frame_count++;
if(g_console.emulator_initialized) if(g_console.emulator_initialized)
{ {
ssnes_render_cached_frame(); rarch_render_cached_frame();
} }
else else
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET, vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,

View File

@ -55,7 +55,7 @@ struct XAudio : public IXAudio2VoiceCallback
size_t bufsize_ = latency * rate / 1000; size_t bufsize_ = latency * rate / 1000;
size_t size = bufsize_ * 2 * sizeof(int16_t); size_t size = bufsize_ * 2 * sizeof(int16_t);
SSNES_LOG("XAudio2: Requesting %d ms latency, using %d ms latency.\n", latency, (int)bufsize_ * 1000 / rate); RARCH_LOG("XAudio2: Requesting %d ms latency, using %d ms latency.\n", latency, (int)bufsize_ * 1000 / rate);
if (FAILED(XAudio2Create(&pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR))) if (FAILED(XAudio2Create(&pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
return false; return false;
@ -168,7 +168,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
return xa; return xa;
error: error:
SSNES_ERR("Failed to init XAudio2.\n"); RARCH_ERR("Failed to init XAudio2.\n");
delete xa; delete xa;
return NULL; return NULL;
} }

View File

@ -116,17 +116,17 @@ static bool xdk360_key_pressed(void *data, int key)
switch(key) switch(key)
{ {
case SSNES_FAST_FORWARD_HOLD_KEY: case RARCH_FAST_FORWARD_HOLD_KEY:
return ((state.Gamepad.sThumbRY < -DEADZONE) && !(state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRY < -DEADZONE) && !(state.Gamepad.bRightTrigger > 128));
case SSNES_LOAD_STATE_KEY: case RARCH_LOAD_STATE_KEY:
return ((state.Gamepad.sThumbRY > DEADZONE) && (state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRY > DEADZONE) && (state.Gamepad.bRightTrigger > 128));
case SSNES_SAVE_STATE_KEY: case RARCH_SAVE_STATE_KEY:
return ((state.Gamepad.sThumbRY < -DEADZONE) && (state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRY < -DEADZONE) && (state.Gamepad.bRightTrigger > 128));
case SSNES_STATE_SLOT_PLUS: case RARCH_STATE_SLOT_PLUS:
return ((state.Gamepad.sThumbRX > DEADZONE) && (state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRX > DEADZONE) && (state.Gamepad.bRightTrigger > 128));
case SSNES_STATE_SLOT_MINUS: case RARCH_STATE_SLOT_MINUS:
return ((state.Gamepad.sThumbRX < -DEADZONE) && (state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRX < -DEADZONE) && (state.Gamepad.bRightTrigger > 128));
case SSNES_FRAMEADVANCE: case RARCH_FRAMEADVANCE:
if(g_console.frame_advance_enable) if(g_console.frame_advance_enable)
{ {
g_console.menu_enable = true; g_console.menu_enable = true;
@ -134,9 +134,9 @@ static bool xdk360_key_pressed(void *data, int key)
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
} }
return false; return false;
case SSNES_REWIND: case RARCH_REWIND:
return ((state.Gamepad.sThumbRY > DEADZONE) && !(state.Gamepad.bRightTrigger > 128)); return ((state.Gamepad.sThumbRY > DEADZONE) && !(state.Gamepad.bRightTrigger > 128));
case SSNES_QUIT_KEY: case RARCH_QUIT_KEY:
if(IS_TIMER_EXPIRED()) if(IS_TIMER_EXPIRED())
{ {
uint32_t left_thumb_pressed = (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB); uint32_t left_thumb_pressed = (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB);

View File

@ -152,7 +152,7 @@ HRESULT PackedResource::Create( const char * strFilename )
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL ); OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL );
if( hFile == INVALID_HANDLE_VALUE ) if( hFile == INVALID_HANDLE_VALUE )
{ {
SSNES_ERR( "File <%s> not found.\n", strFilename ); RARCH_ERR( "File <%s> not found.\n", strFilename );
return E_FAIL; return E_FAIL;
} }
@ -160,14 +160,14 @@ HRESULT PackedResource::Create( const char * strFilename )
XPR_HEADER xprh; XPR_HEADER xprh;
if( !ReadFile( hFile, &xprh, sizeof( XPR_HEADER ), &dwNumBytesRead, NULL ) ) if( !ReadFile( hFile, &xprh, sizeof( XPR_HEADER ), &dwNumBytesRead, NULL ) )
{ {
SSNES_ERR( "Error reading XPR header in file <%s>.\n", strFilename ); RARCH_ERR( "Error reading XPR header in file <%s>.\n", strFilename );
CloseHandle( hFile ); CloseHandle( hFile );
return E_FAIL; return E_FAIL;
} }
if( xprh.dwMagic != XPR2_MAGIC_VALUE ) if( xprh.dwMagic != XPR2_MAGIC_VALUE )
{ {
SSNES_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic ); RARCH_ERR( "Invalid Xbox Packed Resource (.xpr) file: Magic = 0x%08lx.\n", xprh.dwMagic );
CloseHandle( hFile ); CloseHandle( hFile );
return E_FAIL; return E_FAIL;
} }
@ -180,7 +180,7 @@ HRESULT PackedResource::Create( const char * strFilename )
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize); m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
if( m_pSysMemData == NULL ) if( m_pSysMemData == NULL )
{ {
SSNES_ERR( "Could not allocate system memory.\n" ); RARCH_ERR( "Could not allocate system memory.\n" );
m_dwSysMemDataSize = 0; m_dwSysMemDataSize = 0;
return E_FAIL; return E_FAIL;
} }
@ -189,7 +189,7 @@ HRESULT PackedResource::Create( const char * strFilename )
if( m_pVidMemData == NULL ) if( m_pVidMemData == NULL )
{ {
SSNES_ERR( "Could not allocate physical memory.\n" ); RARCH_ERR( "Could not allocate physical memory.\n" );
m_dwSysMemDataSize = 0; m_dwSysMemDataSize = 0;
m_dwVidMemDataSize = 0; m_dwVidMemDataSize = 0;
free(m_pSysMemData); free(m_pSysMemData);
@ -201,7 +201,7 @@ HRESULT PackedResource::Create( const char * strFilename )
if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL ) || if( !ReadFile( hFile, m_pSysMemData, m_dwSysMemDataSize, &dwNumBytesRead, NULL ) ||
!ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL ) ) !ReadFile( hFile, m_pVidMemData, m_dwVidMemDataSize, &dwNumBytesRead, NULL ) )
{ {
SSNES_ERR( "Unable to read Xbox Packed Resource (.xpr) file.\n" ); RARCH_ERR( "Unable to read Xbox Packed Resource (.xpr) file.\n" );
CloseHandle( hFile ); CloseHandle( hFile );
return E_FAIL; return E_FAIL;
} }
@ -574,9 +574,9 @@ static void xdk360_set_swap_block_swap (void * data, bool toggle)
vid->block_swap = toggle; vid->block_swap = toggle;
if(toggle) if(toggle)
SSNES_LOG("Swap is set to blocked.\n"); RARCH_LOG("Swap is set to blocked.\n");
else else
SSNES_LOG("Swap is set to non-blocked.\n"); RARCH_LOG("Swap is set to non-blocked.\n");
} }
static void xdk360_swap (void * data) static void xdk360_swap (void * data)
@ -589,7 +589,7 @@ static void xdk360_swap (void * data)
static void xdk360_gfx_set_nonblock_state(void *data, bool state) static void xdk360_gfx_set_nonblock_state(void *data, bool state)
{ {
xdk360_video_t *vid = (xdk360_video_t*)data; xdk360_video_t *vid = (xdk360_video_t*)data;
SSNES_LOG("D3D Vsync => %s\n", state ? "off" : "on"); RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
/* XBox 360 specific code */ /* XBox 360 specific code */
if(state) if(state)
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE); vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
@ -638,7 +638,7 @@ void xdk360_video_init(void)
if(FAILED(hr)) if(FAILED(hr))
{ {
SSNES_ERR("Couldn't create debug console.\n"); RARCH_ERR("Couldn't create debug console.\n");
} }
} }

View File

@ -42,10 +42,10 @@ static bool find_float_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{ {
if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0) if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0)
{ {
SSNES_LOG("ALSA: Using floating point format.\n"); RARCH_LOG("ALSA: Using floating point format.\n");
return true; return true;
} }
SSNES_LOG("ALSA: Using signed 16-bit format.\n"); RARCH_LOG("ALSA: Using signed 16-bit format.\n");
return false; return false;
} }
@ -86,9 +86,9 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params)); TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL); snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL);
SSNES_LOG("ALSA: Period size: %d frames\n", (int)buffer_size); RARCH_LOG("ALSA: Period size: %d frames\n", (int)buffer_size);
snd_pcm_hw_params_get_buffer_size(params, &buffer_size); snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
SSNES_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size); RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size); alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
TRY_ALSA(snd_pcm_sw_params_malloc(&sw_params)); TRY_ALSA(snd_pcm_sw_params_malloc(&sw_params));
@ -102,7 +102,7 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
return alsa; return alsa;
error: error:
SSNES_ERR("ALSA: Failed to initialize...\n"); RARCH_ERR("ALSA: Failed to initialize...\n");
if (params) if (params)
snd_pcm_hw_params_free(params); snd_pcm_hw_params_free(params);

View File

@ -158,7 +158,7 @@ static void *coreaudio_init(const char *device, unsigned rate, unsigned latency)
if (res != noErr) if (res != noErr)
goto error; goto error;
SSNES_LOG("[CoreAudio]: Using output sample rate of %.1f Hz\n", (float)real_desc.mSampleRate); RARCH_LOG("[CoreAudio]: Using output sample rate of %.1f Hz\n", (float)real_desc.mSampleRate);
g_settings.audio.out_rate = real_desc.mSampleRate; g_settings.audio.out_rate = real_desc.mSampleRate;
if (real_desc.mChannelsPerFrame != stream_desc.mChannelsPerFrame) if (real_desc.mChannelsPerFrame != stream_desc.mChannelsPerFrame)
@ -198,7 +198,7 @@ static void *coreaudio_init(const char *device, unsigned rate, unsigned latency)
if (!dev->buffer) if (!dev->buffer)
goto error; goto error;
SSNES_LOG("[CoreAudio]: Using buffer size of %u bytes: (latency = %u ms)\n", (unsigned)fifo_size, latency); RARCH_LOG("[CoreAudio]: Using buffer size of %u bytes: (latency = %u ms)\n", (unsigned)fifo_size, latency);
res = AudioOutputUnitStart(dev->dev); res = AudioOutputUnitStart(dev->dev);
if (res != noErr) if (res != noErr)
@ -207,7 +207,7 @@ static void *coreaudio_init(const char *device, unsigned rate, unsigned latency)
return dev; return dev;
error: error:
SSNES_ERR("[CoreAudio]: Failed to initialize driver ...\n"); RARCH_ERR("[CoreAudio]: Failed to initialize driver ...\n");
coreaudio_free(dev); coreaudio_free(dev);
return NULL; return NULL;
} }

View File

@ -95,7 +95,7 @@ static inline bool grab_region(dsound_t *ds, DWORD write_ptr, struct audio_lock
if (err) if (err)
{ {
SSNES_WARN("[DirectSound error]: %s\n", err); RARCH_WARN("[DirectSound error]: %s\n", err);
return false; return false;
} }
@ -257,7 +257,7 @@ struct dsound_dev
static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context) static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context)
{ {
struct dsound_dev *dev = (struct dsound_dev*)context; struct dsound_dev *dev = (struct dsound_dev*)context;
SSNES_LOG("\t%u: %s\n", dev->total_count, desc); RARCH_LOG("\t%u: %s\n", dev->total_count, desc);
if (dev->device == dev->total_count) if (dev->device == dev->total_count)
dev->guid = guid; dev->guid = guid;
dev->total_count++; dev->total_count++;
@ -279,7 +279,7 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency)
if (device) if (device)
dev.device = strtoul(device, NULL, 0); dev.device = strtoul(device, NULL, 0);
SSNES_LOG("DirectSound devices:\n"); RARCH_LOG("DirectSound devices:\n");
DirectSoundEnumerate(enumerate_cb, &dev); DirectSoundEnumerate(enumerate_cb, &dev);
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK) if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
@ -301,8 +301,8 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency)
if (ds->buffer_size < 4 * CHUNK_SIZE) if (ds->buffer_size < 4 * CHUNK_SIZE)
ds->buffer_size = 4 * CHUNK_SIZE; ds->buffer_size = 4 * CHUNK_SIZE;
SSNES_LOG("[DirectSound]: Setting buffer size of %u bytes\n", ds->buffer_size); RARCH_LOG("[DirectSound]: Setting buffer size of %u bytes\n", ds->buffer_size);
SSNES_LOG("[DirectSound]: Latency = %u ms\n", (unsigned)((1000 * ds->buffer_size) / wfx.nAvgBytesPerSec)); RARCH_LOG("[DirectSound]: Latency = %u ms\n", (unsigned)((1000 * ds->buffer_size) / wfx.nAvgBytesPerSec));
bufdesc.dwSize = sizeof(DSBUFFERDESC); bufdesc.dwSize = sizeof(DSBUFFERDESC);
bufdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS; bufdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS;
@ -333,7 +333,7 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency)
return ds; return ds;
error: error:
SSNES_ERR("[DirectSound] Error occured in init.\n"); RARCH_ERR("[DirectSound] Error occured in init.\n");
dsound_free(ds); dsound_free(ds);
return NULL; return NULL;
} }

View File

@ -3,44 +3,44 @@
// //
// //
#ifndef __SSNES_AUDIO_DRIVER_PLUGIN_H #ifndef __RARCH_AUDIO_DRIVER_PLUGIN_H
#define __SSNES_AUDIO_DRIVER_PLUGIN_H #define __RARCH_AUDIO_DRIVER_PLUGIN_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifdef SSNES_DLL_IMPORT #ifdef RARCH_DLL_IMPORT
#define SSNES_API_EXPORT __declspec(dllimport) #define RARCH_API_EXPORT __declspec(dllimport)
#else #else
#define SSNES_API_EXPORT __declspec(dllexport) #define RARCH_API_EXPORT __declspec(dllexport)
#endif #endif
#define SSNES_API_CALLTYPE __cdecl #define RARCH_API_CALLTYPE __cdecl
#else #else
#define SSNES_API_EXPORT #define RARCH_API_EXPORT
#define SSNES_API_CALLTYPE #define RARCH_API_CALLTYPE
#endif #endif
#ifndef SSNES_TRUE #ifndef RARCH_TRUE
#define SSNES_TRUE 1 #define RARCH_TRUE 1
#endif #endif
#ifndef SSNES_FALSE #ifndef RARCH_FALSE
#define SSNES_FALSE 0 #define RARCH_FALSE 0
#endif #endif
#ifndef SSNES_OK #ifndef RARCH_OK
#define SSNES_OK 1 #define RARCH_OK 1
#endif #endif
#ifndef SSNES_ERROR #ifndef RARCH_ERROR
#define SSNES_ERROR 0 #define RARCH_ERROR 0
#endif #endif
#define SSNES_AUDIO_API_VERSION 2 #define RARCH_AUDIO_API_VERSION 2
typedef struct ssnes_audio_driver_info typedef struct rarch_audio_driver_info
{ {
// A hint for a subdevice of the audio driver. // A hint for a subdevice of the audio driver.
// This is driver independent, and not relevant for all // This is driver independent, and not relevant for all
@ -56,12 +56,12 @@ typedef struct ssnes_audio_driver_info
// If driver is not able to provide this latency, it can // If driver is not able to provide this latency, it can
// be disregarded. // be disregarded.
unsigned latency; unsigned latency;
} ssnes_audio_driver_info_t; } rarch_audio_driver_info_t;
typedef struct ssnes_audio_driver typedef struct rarch_audio_driver
{ {
// Initializes the device. // Initializes the device.
void *(*init)(const ssnes_audio_driver_info_t *info); void *(*init)(const rarch_audio_driver_info_t *info);
// Write data in buffer to audio driver. // Write data in buffer to audio driver.
// A frame here is defined as one combined sample of left and right // A frame here is defined as one combined sample of left and right
@ -113,13 +113,13 @@ typedef struct ssnes_audio_driver
// Human readable identification string for the driver. // Human readable identification string for the driver.
const char *ident; const char *ident;
// Must be set to SSNES_AUDIO_API_VERSION. // Must be set to RARCH_AUDIO_API_VERSION.
// Used for detecting API mismatch. // Used for detecting API mismatch.
int api_version; int api_version;
} ssnes_audio_driver_t; } rarch_audio_driver_t;
SSNES_API_EXPORT const ssnes_audio_driver_t* SSNES_API_CALLTYPE RARCH_API_EXPORT const rarch_audio_driver_t* RARCH_API_CALLTYPE
ssnes_audio_driver_init(void); rarch_audio_driver_init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -3,36 +3,36 @@
// //
// //
#ifndef __SSNES_DSP_PLUGIN_H #ifndef __RARCH_DSP_PLUGIN_H
#define __SSNES_DSP_PLUGIN_H #define __RARCH_DSP_PLUGIN_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifdef SSNES_DLL_IMPORT #ifdef RARCH_DLL_IMPORT
#define SSNES_API_EXPORT __declspec(dllimport) #define RARCH_API_EXPORT __declspec(dllimport)
#else #else
#define SSNES_API_EXPORT __declspec(dllexport) #define RARCH_API_EXPORT __declspec(dllexport)
#endif #endif
#define SSNES_API_CALLTYPE __cdecl #define RARCH_API_CALLTYPE __cdecl
#else #else
#define SSNES_API_EXPORT #define RARCH_API_EXPORT
#define SSNES_API_CALLTYPE #define RARCH_API_CALLTYPE
#endif #endif
#ifndef SSNES_FALSE #ifndef RARCH_FALSE
#define SSNES_FALSE 0 #define RARCH_FALSE 0
#endif #endif
#ifndef SSNES_TRUE #ifndef RARCH_TRUE
#define SSNES_TRUE 1 #define RARCH_TRUE 1
#endif #endif
#define SSNES_DSP_API_VERSION 3 #define RARCH_DSP_API_VERSION 3
typedef struct ssnes_dsp_info typedef struct rarch_dsp_info
{ {
// Input sample rate that the DSP plugin receives. This is generally ~32kHz. // Input sample rate that the DSP plugin receives. This is generally ~32kHz.
// Some small variance is allowed due to syncing behavior. // Some small variance is allowed due to syncing behavior.
@ -42,11 +42,11 @@ typedef struct ssnes_dsp_info
// input to a certain frequency. // input to a certain frequency.
// //
// However, the plugin might ignore this // However, the plugin might ignore this
// using the resample field in ssnes_dsp_output_t (see below). // using the resample field in rarch_dsp_output_t (see below).
float output_rate; float output_rate;
} ssnes_dsp_info_t; } rarch_dsp_info_t;
typedef struct ssnes_dsp_output typedef struct rarch_dsp_output
{ {
// The DSP plugin has to provide the buffering for the output samples. // The DSP plugin has to provide the buffering for the output samples.
// This is for performance reasons to avoid redundant copying of data. // This is for performance reasons to avoid redundant copying of data.
@ -69,9 +69,9 @@ typedef struct ssnes_dsp_output
// it is assumed that the output has the same sample rate as given // it is assumed that the output has the same sample rate as given
// in output_rate. // in output_rate.
int should_resample; int should_resample;
} ssnes_dsp_output_t; } rarch_dsp_output_t;
typedef struct ssnes_dsp_input typedef struct rarch_dsp_input
{ {
// Input data for the DSP. The samples are interleaved in order: LRLRLRLR // Input data for the DSP. The samples are interleaved in order: LRLRLRLR
const float *samples; const float *samples;
@ -82,24 +82,24 @@ typedef struct ssnes_dsp_input
// (I.e. 44.1kHz, 16bit stereo will have // (I.e. 44.1kHz, 16bit stereo will have
// 88.2k samples/sec and 44.1k frames/sec.) // 88.2k samples/sec and 44.1k frames/sec.)
unsigned frames; unsigned frames;
} ssnes_dsp_input_t; } rarch_dsp_input_t;
typedef struct ssnes_dsp_plugin typedef struct rarch_dsp_plugin
{ {
// Creates a handle of the plugin. Returns NULL if failed. // Creates a handle of the plugin. Returns NULL if failed.
void *(*init)(const ssnes_dsp_info_t *info); void *(*init)(const rarch_dsp_info_t *info);
// Processes input data. // Processes input data.
// The plugin is allowed to return variable sizes for output data. // The plugin is allowed to return variable sizes for output data.
void (*process)(void *data, ssnes_dsp_output_t *output, void (*process)(void *data, rarch_dsp_output_t *output,
const ssnes_dsp_input_t *input); const rarch_dsp_input_t *input);
// Frees the handle. // Frees the handle.
void (*free)(void *data); void (*free)(void *data);
// API version used to compile the plugin. // API version used to compile the plugin.
// Used to detect mismatches in API. // Used to detect mismatches in API.
// Must be set to SSNES_DSP_API_VERSION on compile. // Must be set to RARCH_DSP_API_VERSION on compile.
int api_version; int api_version;
// Signal plugin that it may open a configuring window or // Signal plugin that it may open a configuring window or
@ -115,12 +115,12 @@ typedef struct ssnes_dsp_plugin
// GUI events can be processed here in a non-blocking fashion. // GUI events can be processed here in a non-blocking fashion.
// Can be set to NULL to ignore it. // Can be set to NULL to ignore it.
void (*events)(void *data); void (*events)(void *data);
} ssnes_dsp_plugin_t; } rarch_dsp_plugin_t;
// Called by RetroArch at startup to get the callback struct. // Called by RetroArch at startup to get the callback struct.
// This is NOT dynamically allocated! // This is NOT dynamically allocated!
SSNES_API_EXPORT const ssnes_dsp_plugin_t* SSNES_API_CALLTYPE RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE
ssnes_dsp_plugin_init(void); rarch_dsp_plugin_init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ext/ssnes_audio.h" #include "ext/rarch_audio.h"
#include "../boolean.h" #include "../boolean.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -25,7 +25,7 @@
typedef struct audio_ext typedef struct audio_ext
{ {
dylib_t lib; dylib_t lib;
const ssnes_audio_driver_t *driver; const rarch_audio_driver_t *driver;
void *handle; void *handle;
bool is_float; bool is_float;
} audio_ext_t; } audio_ext_t;
@ -47,7 +47,7 @@ static void *audio_ext_init(const char *device, unsigned rate, unsigned latency)
{ {
if (!(*g_settings.audio.external_driver)) if (!(*g_settings.audio.external_driver))
{ {
SSNES_ERR("Please define an external audio driver.\n"); RARCH_ERR("Please define an external audio driver.\n");
return NULL; return NULL;
} }
@ -55,36 +55,36 @@ static void *audio_ext_init(const char *device, unsigned rate, unsigned latency)
if (!ext) if (!ext)
return NULL; return NULL;
ssnes_audio_driver_info_t info = {0}; rarch_audio_driver_info_t info = {0};
const ssnes_audio_driver_t *(*plugin_load)(void) = NULL; const rarch_audio_driver_t *(*plugin_load)(void) = NULL;
ext->lib = dylib_load(g_settings.audio.external_driver); ext->lib = dylib_load(g_settings.audio.external_driver);
if (!ext->lib) if (!ext->lib)
{ {
SSNES_ERR("Failed to load external library \"%s\"\n", g_settings.audio.external_driver); RARCH_ERR("Failed to load external library \"%s\"\n", g_settings.audio.external_driver);
goto error; goto error;
} }
plugin_load = (const ssnes_audio_driver_t *(*)(void))dylib_proc(ext->lib, "ssnes_audio_driver_init"); plugin_load = (const rarch_audio_driver_t *(*)(void))dylib_proc(ext->lib, "rarch_audio_driver_init");
if (!plugin_load) if (!plugin_load)
{ {
SSNES_ERR("Failed to find symbol \"ssnes_audio_driver_init\" in plugin.\n"); RARCH_ERR("Failed to find symbol \"rarch_audio_driver_init\" in plugin.\n");
goto error; goto error;
} }
ext->driver = plugin_load(); ext->driver = plugin_load();
if (!ext->driver) if (!ext->driver)
{ {
SSNES_ERR("Received invalid driver from plugin.\n"); RARCH_ERR("Received invalid driver from plugin.\n");
goto error; goto error;
} }
SSNES_LOG("Loaded external audio driver: \"%s\"\n", ext->driver->ident ? ext->driver->ident : "Unknown"); RARCH_LOG("Loaded external audio driver: \"%s\"\n", ext->driver->ident ? ext->driver->ident : "Unknown");
if (ext->driver->api_version != SSNES_AUDIO_API_VERSION) if (ext->driver->api_version != RARCH_AUDIO_API_VERSION)
{ {
SSNES_ERR("API mismatch in external audio plugin. SSNES: %d, Plugin: %d ...\n", SSNES_AUDIO_API_VERSION, ext->driver->api_version); RARCH_ERR("API mismatch in external audio plugin. SSNES: %d, Plugin: %d ...\n", RARCH_AUDIO_API_VERSION, ext->driver->api_version);
goto error; goto error;
} }
@ -95,7 +95,7 @@ static void *audio_ext_init(const char *device, unsigned rate, unsigned latency)
ext->handle = ext->driver->init(&info); ext->handle = ext->driver->init(&info);
if (!ext->handle) if (!ext->handle)
{ {
SSNES_ERR("Failed to init audio driver.\n"); RARCH_ERR("Failed to init audio driver.\n");
goto error; goto error;
} }
@ -103,7 +103,7 @@ static void *audio_ext_init(const char *device, unsigned rate, unsigned latency)
g_settings.audio.out_rate = ext->driver->sample_rate(ext->handle); g_settings.audio.out_rate = ext->driver->sample_rate(ext->handle);
if (!g_settings.audio.sync) if (!g_settings.audio.sync)
ext->driver->set_nonblock_state(ext->handle, SSNES_TRUE); ext->driver->set_nonblock_state(ext->handle, RARCH_TRUE);
return ext; return ext;

View File

@ -22,13 +22,13 @@
#define CHANNELS 2 #define CHANNELS 2
struct ssnes_resampler struct rarch_resampler
{ {
float chan_data[CHANNELS][4]; float chan_data[CHANNELS][4];
double r_frac; double r_frac;
}; };
void resampler_preinit(ssnes_resampler_t *re, double omega, double *samples_offset) void resampler_preinit(rarch_resampler_t *re, double omega, double *samples_offset)
{ {
*samples_offset = 2.0; *samples_offset = 2.0;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -58,12 +58,12 @@ static inline float hermite_kernel(float mu1, float a, float b, float c, float d
return (a0 * b) + (a1 * m0) + (a2 * m1) + (a3 * c); return (a0 * b) + (a1 * m0) + (a2 * m1) + (a3 * c);
} }
ssnes_resampler_t *resampler_new(void) rarch_resampler_t *resampler_new(void)
{ {
return (ssnes_resampler_t*)calloc(1, sizeof(ssnes_resampler_t)); return (rarch_resampler_t*)calloc(1, sizeof(rarch_resampler_t));
} }
void resampler_process(ssnes_resampler_t *re, struct resampler_data *data) void resampler_process(rarch_resampler_t *re, struct resampler_data *data)
{ {
double r_step = 1.0 / data->ratio; double r_step = 1.0 / data->ratio;
size_t processed_out = 0; size_t processed_out = 0;
@ -99,7 +99,7 @@ void resampler_process(ssnes_resampler_t *re, struct resampler_data *data)
data->output_frames = processed_out; data->output_frames = processed_out;
} }
void resampler_free(ssnes_resampler_t *re) void resampler_free(rarch_resampler_t *re)
{ {
free(re); free(re);
} }

View File

@ -111,11 +111,11 @@ static size_t find_buffersize(jack_t *jd, int latency)
jack_latency = range.max; jack_latency = range.max;
} }
SSNES_LOG("JACK: Jack latency is %d frames.\n", jack_latency); RARCH_LOG("JACK: Jack latency is %d frames.\n", jack_latency);
int buffer_frames = frames - jack_latency; int buffer_frames = frames - jack_latency;
int min_buffer_frames = jack_get_buffer_size(jd->client) * 2; int min_buffer_frames = jack_get_buffer_size(jd->client) * 2;
SSNES_LOG("JACK: Minimum buffer size is %d frames.\n", min_buffer_frames); RARCH_LOG("JACK: Minimum buffer size is %d frames.\n", min_buffer_frames);
if (buffer_frames < min_buffer_frames) if (buffer_frames < min_buffer_frames)
buffer_frames = min_buffer_frames; buffer_frames = min_buffer_frames;
@ -150,27 +150,27 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency)
jd->ports[1] = jack_port_register(jd->client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); jd->ports[1] = jack_port_register(jd->client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
if (jd->ports[0] == NULL || jd->ports[1] == NULL) if (jd->ports[0] == NULL || jd->ports[1] == NULL)
{ {
SSNES_ERR("Failed to register ports.\n"); RARCH_ERR("Failed to register ports.\n");
goto error; goto error;
} }
jports = jack_get_ports(jd->client, NULL, NULL, JackPortIsPhysical | JackPortIsInput); jports = jack_get_ports(jd->client, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
if (jports == NULL) if (jports == NULL)
{ {
SSNES_ERR("Failed to get ports.\n"); RARCH_ERR("Failed to get ports.\n");
goto error; goto error;
} }
bufsize = find_buffersize(jd, latency); bufsize = find_buffersize(jd, latency);
jd->buffer_size = bufsize; jd->buffer_size = bufsize;
SSNES_LOG("JACK: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t))); RARCH_LOG("JACK: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t)));
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
jd->buffer[i] = jack_ringbuffer_create(bufsize); jd->buffer[i] = jack_ringbuffer_create(bufsize);
if (jd->buffer[i] == NULL) if (jd->buffer[i] == NULL)
{ {
SSNES_ERR("Failed to create buffers.\n"); RARCH_ERR("Failed to create buffers.\n");
goto error; goto error;
} }
} }
@ -179,7 +179,7 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency)
if (jack_activate(jd->client) < 0) if (jack_activate(jd->client) < 0)
{ {
SSNES_ERR("Failed to activate Jack...\n"); RARCH_ERR("Failed to activate Jack...\n");
goto error; goto error;
} }
@ -187,7 +187,7 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency)
{ {
if (jack_connect(jd->client, jack_port_name(jd->ports[i]), dest_ports[i])) if (jack_connect(jd->client, jack_port_name(jd->ports[i]), dest_ports[i]))
{ {
SSNES_ERR("Failed to connect to Jack port.\n"); RARCH_ERR("Failed to connect to Jack port.\n");
goto error; goto error;
} }
} }

View File

@ -61,7 +61,7 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency)
int frag = (frags << 16) | 10; int frag = (frags << 16) | 10;
if (ioctl(*fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0) if (ioctl(*fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0)
SSNES_WARN("Cannot set fragment sizes. Latency might not be as expected ...\n"); RARCH_WARN("Cannot set fragment sizes. Latency might not be as expected ...\n");
int channels = 2; int channels = 2;
int format = is_little_endian() ? int format = is_little_endian() ?
@ -94,7 +94,7 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency)
if (new_rate != (int)rate) if (new_rate != (int)rate)
{ {
SSNES_WARN("Requested sample rate not supported. Adjusting output rate to %d Hz.\n", new_rate); RARCH_WARN("Requested sample rate not supported. Adjusting output rate to %d Hz.\n", new_rate);
g_settings.audio.out_rate = new_rate; g_settings.audio.out_rate = new_rate;
} }
@ -140,7 +140,7 @@ static void oss_set_nonblock_state(void *data, bool state)
else else
rc = fcntl(*fd, F_SETFL, fcntl(*fd, F_GETFL) & (~O_NONBLOCK)); rc = fcntl(*fd, F_SETFL, fcntl(*fd, F_GETFL) & (~O_NONBLOCK));
if (rc != 0) if (rc != 0)
SSNES_WARN("Could not set nonblocking on OSS file descriptor. Will not be able to fast-forward.\n"); RARCH_WARN("Could not set nonblocking on OSS file descriptor. Will not be able to fast-forward.\n");
} }
static void oss_free(void *data) static void oss_free(void *data)
@ -159,7 +159,7 @@ static size_t oss_write_avail(void *data)
audio_buf_info info; audio_buf_info info;
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0) if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0)
{ {
SSNES_ERR("SNDCTL_DSP_GETOSPACE failed ...\n"); RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n");
return 0; return 0;
} }
@ -173,7 +173,7 @@ static size_t oss_buffer_size(void *data)
audio_buf_info info; audio_buf_info info;
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0) if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0)
{ {
SSNES_ERR("SNDCTL_DSP_GETOSPACE failed ...\n"); RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n");
return 1; // Return something non-zero to avoid SIGFPE. return 1; // Return something non-zero to avoid SIGFPE.
} }

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_RESAMPLER_H #ifndef __RARCH_RESAMPLER_H
#define __SSNES_RESAMPLER_H #define __RARCH_RESAMPLER_H
#include <stddef.h> #include <stddef.h>
#include <math.h> #include <math.h>
@ -25,7 +25,7 @@
#define M_PI 3.14159265358979323846264338327 #define M_PI 3.14159265358979323846264338327
#endif #endif
typedef struct ssnes_resampler ssnes_resampler_t; typedef struct rarch_resampler rarch_resampler_t;
struct resampler_data struct resampler_data
{ {
@ -38,12 +38,12 @@ struct resampler_data
double ratio; double ratio;
}; };
ssnes_resampler_t *resampler_new(void); rarch_resampler_t *resampler_new(void);
void resampler_process(ssnes_resampler_t *re, struct resampler_data *data); void resampler_process(rarch_resampler_t *re, struct resampler_data *data);
void resampler_free(ssnes_resampler_t *re); void resampler_free(rarch_resampler_t *re);
// Generate a starting cosine pulse with given frequency for testing (SNR, etc) purposes. // Generate a starting cosine pulse with given frequency for testing (SNR, etc) purposes.
void resampler_preinit(ssnes_resampler_t *re, double omega, double *samples_offset); void resampler_preinit(rarch_resampler_t *re, double omega, double *samples_offset);
#endif #endif

View File

@ -39,7 +39,7 @@ static void *ra_init(const char *device, unsigned rate, unsigned latency)
roar_vs_t *vss; roar_vs_t *vss;
if ((vss = roar_vs_new_simple(device, "SSNES", rate, 2, ROAR_CODEC_PCM_S, 16, ROAR_DIR_PLAY, &err)) == NULL) if ((vss = roar_vs_new_simple(device, "SSNES", rate, 2, ROAR_CODEC_PCM_S, 16, ROAR_DIR_PLAY, &err)) == NULL)
{ {
SSNES_ERR("RoarAudio: \"%s\"\n", roar_vs_strerr(err)); RARCH_ERR("RoarAudio: \"%s\"\n", roar_vs_strerr(err));
free(roar); free(roar);
return NULL; return NULL;
} }

View File

@ -16,7 +16,7 @@
#include "../driver.h" #include "../driver.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
#include "../console/librsound/rsound.h" #include "../console/librsound/rsound.h"
#else #else
#include <rsound.h> #include <rsound.h>

View File

@ -82,7 +82,7 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
if (SDL_OpenAudio(&spec, &out) < 0) if (SDL_OpenAudio(&spec, &out) < 0)
{ {
SSNES_ERR("Failed to open SDL audio: %s\n", SDL_GetError()); RARCH_ERR("Failed to open SDL audio: %s\n", SDL_GetError());
free(sdl); free(sdl);
return 0; return 0;
} }
@ -91,7 +91,7 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
sdl->lock = slock_new(); sdl->lock = slock_new();
sdl->cond = scond_new(); sdl->cond = scond_new();
SSNES_LOG("SDL audio: Requested %d ms latency, got %d ms\n", latency, (int)(out.samples * 4 * 1000 / g_settings.audio.out_rate)); RARCH_LOG("SDL audio: Requested %d ms latency, got %d ms\n", latency, (int)(out.samples * 4 * 1000 / g_settings.audio.out_rate));
// Create a buffer twice as big as needed and prefill the buffer. // Create a buffer twice as big as needed and prefill the buffer.
size_t bufsize = out.samples * 4 * sizeof(int16_t); size_t bufsize = out.samples * 4 * sizeof(int16_t);

View File

@ -25,7 +25,7 @@
#ifndef RESAMPLER_TEST #ifndef RESAMPLER_TEST
#include "../general.h" #include "../general.h"
#else #else
#define SSNES_LOG(...) #define RARCH_LOG(...)
#endif #endif
#if __SSE__ #if __SSE__
@ -50,7 +50,7 @@
#define PHASE_INDEX 0 #define PHASE_INDEX 0
#define DELTA_INDEX 1 #define DELTA_INDEX 1
struct ssnes_resampler struct rarch_resampler
{ {
float phase_table[PHASES][2][TAPS]; float phase_table[PHASES][2][TAPS];
float buffer_l[2 * TAPS]; float buffer_l[2 * TAPS];
@ -61,7 +61,7 @@ struct ssnes_resampler
uint32_t time; uint32_t time;
}; };
void resampler_preinit(ssnes_resampler_t *re, double omega, double *samples_offset) void resampler_preinit(rarch_resampler_t *re, double omega, double *samples_offset)
{ {
*samples_offset = SIDELOBES + 1; *samples_offset = SIDELOBES + 1;
for (int i = 0; i < 2 * SIDELOBES; i++) for (int i = 0; i < 2 * SIDELOBES; i++)
@ -87,7 +87,7 @@ static inline double lanzcos(double index)
return sinc(index); return sinc(index);
} }
static void init_sinc_table(ssnes_resampler_t *resamp) static void init_sinc_table(rarch_resampler_t *resamp)
{ {
// Sinc phases: [..., p + 3, p + 2, p + 1, p + 0, p - 1, p - 2, p - 3, p - 4, ...] // Sinc phases: [..., p + 3, p + 2, p + 1, p + 0, p - 1, p - 2, p - 3, p - 4, ...]
for (int i = 0; i < PHASES; i++) for (int i = 0; i < PHASES; i++)
@ -143,9 +143,9 @@ static void aligned_free(void *ptr)
free(p[-1]); free(p[-1]);
} }
ssnes_resampler_t *resampler_new(void) rarch_resampler_t *resampler_new(void)
{ {
ssnes_resampler_t *re = (ssnes_resampler_t*)aligned_alloc(16, sizeof(*re)); rarch_resampler_t *re = (rarch_resampler_t*)aligned_alloc(16, sizeof(*re));
if (!re) if (!re)
return NULL; return NULL;
@ -154,16 +154,16 @@ ssnes_resampler_t *resampler_new(void)
init_sinc_table(re); init_sinc_table(re);
#if __SSE__ #if __SSE__
SSNES_LOG("Sinc resampler [SSE]\n"); RARCH_LOG("Sinc resampler [SSE]\n");
#else #else
SSNES_LOG("Sinc resampler [C]\n"); RARCH_LOG("Sinc resampler [C]\n");
#endif #endif
return re; return re;
} }
#if __SSE__ #if __SSE__
static void process_sinc(ssnes_resampler_t *resamp, float *out_buffer) static void process_sinc(rarch_resampler_t *resamp, float *out_buffer)
{ {
__m128 sum_l = _mm_setzero_ps(); __m128 sum_l = _mm_setzero_ps();
__m128 sum_r = _mm_setzero_ps(); __m128 sum_r = _mm_setzero_ps();
@ -214,7 +214,7 @@ static void process_sinc(ssnes_resampler_t *resamp, float *out_buffer)
_mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum)); _mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum));
} }
#else // Plain ol' C99 #else // Plain ol' C99
static void process_sinc(ssnes_resampler_t *resamp, float *out_buffer) static void process_sinc(rarch_resampler_t *resamp, float *out_buffer)
{ {
float sum_l = 0.0f; float sum_l = 0.0f;
float sum_r = 0.0f; float sum_r = 0.0f;
@ -240,7 +240,7 @@ static void process_sinc(ssnes_resampler_t *resamp, float *out_buffer)
} }
#endif #endif
void resampler_process(ssnes_resampler_t *re, struct resampler_data *data) void resampler_process(rarch_resampler_t *re, struct resampler_data *data)
{ {
uint32_t ratio = PHASES_WRAP / data->ratio; uint32_t ratio = PHASES_WRAP / data->ratio;
@ -270,7 +270,7 @@ void resampler_process(ssnes_resampler_t *re, struct resampler_data *data)
data->output_frames = out_frames; data->output_frames = out_frames;
} }
void resampler_free(ssnes_resampler_t *re) void resampler_free(rarch_resampler_t *re)
{ {
aligned_free(re); aligned_free(re);
} }

View File

@ -44,7 +44,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ssnes_resampler_t *resamp = resampler_new(); rarch_resampler_t *resamp = resampler_new();
if (!resamp) if (!resamp)
{ {
fprintf(stderr, "Failed to allocate resampler ...\n"); fprintf(stderr, "Failed to allocate resampler ...\n");

View File

@ -241,7 +241,7 @@ int main(int argc, char *argv[])
assert(input); assert(input);
assert(output); assert(output);
ssnes_resampler_t *re = resampler_new(); rarch_resampler_t *re = resampler_new();
assert(re); assert(re);
test_fft(); test_fft();

View File

@ -36,7 +36,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
size_t bufsize = latency * rate / 1000; size_t bufsize = latency * rate / 1000;
SSNES_LOG("XAudio2: Requesting %d ms latency, using %d ms latency.\n", latency, (int)bufsize * 1000 / rate); RARCH_LOG("XAudio2: Requesting %d ms latency, using %d ms latency.\n", latency, (int)bufsize * 1000 / rate);
xa->bufsize = bufsize * 2 * sizeof(float); xa->bufsize = bufsize * 2 * sizeof(float);
@ -47,7 +47,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device_index); xa->xa = xaudio2_new(rate, 2, xa->bufsize, device_index);
if (!xa->xa) if (!xa->xa)
{ {
SSNES_ERR("Failed to init XAudio2.\n"); RARCH_ERR("Failed to init XAudio2.\n");
free(xa); free(xa);
return NULL; return NULL;
} }

View File

@ -60,18 +60,18 @@ static void autosave_thread(void *data)
// Avoid spamming down stderr ... :) // Avoid spamming down stderr ... :)
if (first_log) if (first_log)
{ {
SSNES_LOG("Autosaving SRAM to \"%s\", will continue to check every %u seconds ...\n", save->path, save->interval); RARCH_LOG("Autosaving SRAM to \"%s\", will continue to check every %u seconds ...\n", save->path, save->interval);
first_log = false; first_log = false;
} }
else else
SSNES_LOG("SRAM changed ... autosaving ...\n"); RARCH_LOG("SRAM changed ... autosaving ...\n");
bool failed = false; bool failed = false;
failed |= fwrite(save->buffer, 1, save->bufsize, file) != save->bufsize; failed |= fwrite(save->buffer, 1, save->bufsize, file) != save->bufsize;
failed |= fflush(file) != 0; failed |= fflush(file) != 0;
failed |= fclose(file) != 0; failed |= fclose(file) != 0;
if (failed) if (failed)
SSNES_WARN("Failed to autosave SRAM. Disk might be full.\n"); RARCH_WARN("Failed to autosave SRAM. Disk might be full.\n");
} }
} }

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_AUTOSAVE_H #ifndef __RARCH_AUTOSAVE_H
#define __SSNES_AUTOSAVE_H #define __RARCH_AUTOSAVE_H
#include <stddef.h> #include <stddef.h>

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_BOOLEAN_H #ifndef __RARCH_BOOLEAN_H
#define __SSNES_BOOLEAN_H #define __RARCH_BOOLEAN_H
#ifndef __cplusplus #ifndef __cplusplus
#include <stdbool.h> #include <stdbool.h>

View File

@ -115,7 +115,7 @@ static bool xml_grab_cheats(cheat_manager_t *handle, xmlNodePtr ptr)
xmlChar *name = xmlNodeGetContent(ptr); xmlChar *name = xmlNodeGetContent(ptr);
if (name) if (name)
{ {
SSNES_LOG("Found cheat for game: \"%s\"\n", name); RARCH_LOG("Found cheat for game: \"%s\"\n", name);
xmlFree(name); xmlFree(name);
} }
} }
@ -199,7 +199,7 @@ static void cheat_manager_save_config(cheat_manager_t *handle, const char *path,
if (!conf) if (!conf)
{ {
SSNES_ERR("Cannot save XML cheat settings.\n"); RARCH_ERR("Cannot save XML cheat settings.\n");
return; return;
} }
@ -221,7 +221,7 @@ static void cheat_manager_save_config(cheat_manager_t *handle, const char *path,
config_set_string(conf, sha256, conf_str); config_set_string(conf, sha256, conf_str);
if (!config_file_write(conf, path)) if (!config_file_write(conf, path))
SSNES_ERR("Failed to write XML cheat settings to \"%s\". Check permissions.\n", path); RARCH_ERR("Failed to write XML cheat settings to \"%s\". Check permissions.\n", path);
config_file_free(conf); config_file_free(conf);
@ -262,13 +262,13 @@ cheat_manager_t* cheat_manager_new(const char *path)
doc = xmlCtxtReadFile(ctx, path, NULL, 0); doc = xmlCtxtReadFile(ctx, path, NULL, 0);
if (!doc) if (!doc)
{ {
SSNES_ERR("Failed to parse XML file: %s\n", path); RARCH_ERR("Failed to parse XML file: %s\n", path);
goto error; goto error;
} }
if (ctx->valid == 0) if (ctx->valid == 0)
{ {
SSNES_ERR("Cannot validate XML file: %s\n", path); RARCH_ERR("Cannot validate XML file: %s\n", path);
goto error; goto error;
} }
@ -308,13 +308,13 @@ cheat_manager_t* cheat_manager_new(const char *path)
if (!xml_grab_cheats(handle, cur->children)) if (!xml_grab_cheats(handle, cur->children))
{ {
SSNES_ERR("Failed to grab cheats. This should not happen.\n"); RARCH_ERR("Failed to grab cheats. This should not happen.\n");
goto error; goto error;
} }
if (handle->size == 0) if (handle->size == 0)
{ {
SSNES_ERR("Did not find any cheats in XML file: %s\n", path); RARCH_ERR("Did not find any cheats in XML file: %s\n", path);
goto error; goto error;
} }
@ -359,7 +359,7 @@ static void cheat_manager_update(cheat_manager_t *handle)
char msg[256]; char msg[256];
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s", handle->ptr, handle->cheats[handle->ptr].state ? "ON" : "OFF", handle->cheats[handle->ptr].desc); snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s", handle->ptr, handle->cheats[handle->ptr].state ? "ON" : "OFF", handle->cheats[handle->ptr].desc);
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
} }

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_CHEATS_H #ifndef __RARCH_CHEATS_H
#define __SSNES_CHEATS_H #define __RARCH_CHEATS_H
typedef struct cheat_manager cheat_manager_t; typedef struct cheat_manager cheat_manager_t;

View File

@ -147,7 +147,7 @@ static void shuffle_block(char **begin, char **last, char **end)
{ {
ptrdiff_t len = last - begin; ptrdiff_t len = last - begin;
const char **tmp = (const char**)calloc(len, sizeof(const char*)); const char **tmp = (const char**)calloc(len, sizeof(const char*));
ssnes_assert(tmp); rarch_assert(tmp);
memcpy(tmp, begin, sizeof(tmp)); memcpy(tmp, begin, sizeof(tmp));
memmove(begin, last, (end - last) * sizeof(char*)); memmove(begin, last, (end - last) * sizeof(char*));
@ -186,7 +186,7 @@ int getopt_long(int argc, char *argv[],
long_index = 0; long_index = 0;
} }
ssnes_assert(short_index == 0 || long_index == 0); rarch_assert(short_index == 0 || long_index == 0);
if (short_index == 0) if (short_index == 0)
return parse_short(optstring, &argv[optind]); return parse_short(optstring, &argv[optind]);
@ -246,7 +246,7 @@ size_t strlcat(char *dest, const char *source, size_t size)
#include <string.h> #include <string.h>
int strcasecmp_ssnes__(const char *a, const char *b) int strcasecmp_rarch__(const char *a, const char *b)
{ {
while (*a && *b) while (*a && *b)
{ {
@ -262,7 +262,7 @@ int strcasecmp_ssnes__(const char *a, const char *b)
return tolower(*a) - tolower(*b); return tolower(*a) - tolower(*b);
} }
char *strdup_ssnes__(const char *orig) char *strdup_rarch__(const char *orig)
{ {
size_t len = strlen(orig) + 1; size_t len = strlen(orig) + 1;
char *ret = (char*)malloc(len); char *ret = (char*)malloc(len);
@ -273,7 +273,7 @@ char *strdup_ssnes__(const char *orig)
return ret; return ret;
} }
int isblank_ssnes__(int c) int isblank_rarch__(int c)
{ {
return (c == ' ') || (c == '\t'); return (c == ' ') || (c == '\t');
} }

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_GETOPT_H #ifndef __RARCH_GETOPT_H
#define __SSNES_GETOPT_H #define __RARCH_GETOPT_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_POSIX_STRING_H #ifndef __RARCH_POSIX_STRING_H
#define __SSNES_POSIX_STRING_H #define __RARCH_POSIX_STRING_H
#ifdef _WIN32 #ifdef _WIN32
@ -23,9 +23,9 @@ extern "C" {
#endif #endif
#undef strcasecmp #undef strcasecmp
#define strcasecmp(a, b) strcasecmp_ssnes__(a, b) #define strcasecmp(a, b) strcasecmp_rarch__(a, b)
#define strdup(orig) strdup_ssnes__(orig) #define strdup(orig) strdup_rarch__(orig)
#define isblank(c) isblank_ssnes__(c) #define isblank(c) isblank_rarch__(c)
int strcasecmp(const char *a, const char *b); int strcasecmp(const char *a, const char *b);
char *strdup(const char *orig); char *strdup(const char *orig);
int isblank(int c); int isblank(int c);

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_STRL_H #ifndef __RARCH_STRL_H
#define __SSNES_STRL_H #define __RARCH_STRL_H
#include <string.h> #include <string.h>
#include <stddef.h> #include <stddef.h>
@ -29,8 +29,8 @@
extern "C" { extern "C" {
#endif #endif
// Avoid possible naming collisions during link since we prefer to use the actual name. // Avoid possible naming collisions during link since we prefer to use the actual name.
#define strlcpy(dst, src, size) strlcpy_ssnes__(dst, src, size) #define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size)
#define strlcat(dst, src, size) strlcat_ssnes__(dst, src, size) #define strlcat(dst, src, size) strlcat_rarch__(dst, src, size)
size_t strlcpy(char *dest, const char *source, size_t size); size_t strlcpy(char *dest, const char *source, size_t size);
size_t strlcat(char *dest, const char *source, size_t size); size_t strlcat(char *dest, const char *source, size_t size);

View File

@ -58,7 +58,7 @@
#define CONFIG_GET_FLOAT_EXTERN(var, key) CONFIG_GET_FLOAT_BASE(conf, g_extern, var, key) #define CONFIG_GET_FLOAT_EXTERN(var, key) CONFIG_GET_FLOAT_BASE(conf, g_extern, var, key)
#define CONFIG_GET_STRING_EXTERN(var, key) CONFIG_GET_STRING_BASE(conf, g_extern, var, key) #define CONFIG_GET_STRING_EXTERN(var, key) CONFIG_GET_STRING_BASE(conf, g_extern, var, key)
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
#define CONFIG_GET_BOOL_CONSOLE(var, key) CONFIG_GET_BOOL_BASE(conf, g_console, var, key) #define CONFIG_GET_BOOL_CONSOLE(var, key) CONFIG_GET_BOOL_BASE(conf, g_console, var, key)
#define CONFIG_GET_INT_CONSOLE(var, key) CONFIG_GET_INT_BASE(conf, g_console, var, key) #define CONFIG_GET_INT_CONSOLE(var, key) CONFIG_GET_INT_BASE(conf, g_console, var, key)
#define CONFIG_GET_FLOAT_CONSOLE(var, key) CONFIG_GET_FLOAT_BASE(conf, g_console, var, key) #define CONFIG_GET_FLOAT_CONSOLE(var, key) CONFIG_GET_FLOAT_BASE(conf, g_console, var, key)

View File

@ -308,31 +308,31 @@ static const struct snes_keybind snes_keybinds_1[] = {
{ true, RETRO_DEVICE_ID_JOYPAD_L, SK_q, NO_BTN, AXIS_NONE }, { true, RETRO_DEVICE_ID_JOYPAD_L, SK_q, NO_BTN, AXIS_NONE },
{ true, RETRO_DEVICE_ID_JOYPAD_R, SK_w, NO_BTN, AXIS_NONE }, { true, RETRO_DEVICE_ID_JOYPAD_R, SK_w, NO_BTN, AXIS_NONE },
{ true, SSNES_FAST_FORWARD_KEY, SK_SPACE, NO_BTN, AXIS_NONE }, { true, RARCH_FAST_FORWARD_KEY, SK_SPACE, NO_BTN, AXIS_NONE },
{ true, SSNES_FAST_FORWARD_HOLD_KEY, SK_l, NO_BTN, AXIS_NONE }, { true, RARCH_FAST_FORWARD_HOLD_KEY, SK_l, NO_BTN, AXIS_NONE },
{ true, SSNES_LOAD_STATE_KEY, SK_F4, NO_BTN, AXIS_NONE }, { true, RARCH_LOAD_STATE_KEY, SK_F4, NO_BTN, AXIS_NONE },
{ true, SSNES_SAVE_STATE_KEY, SK_F2, NO_BTN, AXIS_NONE }, { true, RARCH_SAVE_STATE_KEY, SK_F2, NO_BTN, AXIS_NONE },
{ true, SSNES_FULLSCREEN_TOGGLE_KEY, SK_f, NO_BTN, AXIS_NONE }, { true, RARCH_FULLSCREEN_TOGGLE_KEY, SK_f, NO_BTN, AXIS_NONE },
{ true, SSNES_QUIT_KEY, SK_ESCAPE, NO_BTN, AXIS_NONE }, { true, RARCH_QUIT_KEY, SK_ESCAPE, NO_BTN, AXIS_NONE },
{ true, SSNES_STATE_SLOT_PLUS, SK_F7, NO_BTN, AXIS_NONE }, { true, RARCH_STATE_SLOT_PLUS, SK_F7, NO_BTN, AXIS_NONE },
{ true, SSNES_STATE_SLOT_MINUS, SK_F6, NO_BTN, AXIS_NONE }, { true, RARCH_STATE_SLOT_MINUS, SK_F6, NO_BTN, AXIS_NONE },
{ true, SSNES_AUDIO_INPUT_RATE_PLUS, SK_KP_PLUS, NO_BTN, AXIS_NONE }, { true, RARCH_AUDIO_INPUT_RATE_PLUS, SK_KP_PLUS, NO_BTN, AXIS_NONE },
{ true, SSNES_AUDIO_INPUT_RATE_MINUS, SK_KP_MINUS, NO_BTN, AXIS_NONE }, { true, RARCH_AUDIO_INPUT_RATE_MINUS, SK_KP_MINUS, NO_BTN, AXIS_NONE },
{ true, SSNES_REWIND, SK_r, NO_BTN, AXIS_NONE }, { true, RARCH_REWIND, SK_r, NO_BTN, AXIS_NONE },
{ true, SSNES_MOVIE_RECORD_TOGGLE, SK_o, NO_BTN, AXIS_NONE }, { true, RARCH_MOVIE_RECORD_TOGGLE, SK_o, NO_BTN, AXIS_NONE },
{ true, SSNES_PAUSE_TOGGLE, SK_p, NO_BTN, AXIS_NONE }, { true, RARCH_PAUSE_TOGGLE, SK_p, NO_BTN, AXIS_NONE },
{ true, SSNES_FRAMEADVANCE, SK_k, NO_BTN, AXIS_NONE }, { true, RARCH_FRAMEADVANCE, SK_k, NO_BTN, AXIS_NONE },
{ true, SSNES_RESET, SK_h, NO_BTN, AXIS_NONE }, { true, RARCH_RESET, SK_h, NO_BTN, AXIS_NONE },
{ true, SSNES_SHADER_NEXT, SK_m, NO_BTN, AXIS_NONE }, { true, RARCH_SHADER_NEXT, SK_m, NO_BTN, AXIS_NONE },
{ true, SSNES_SHADER_PREV, SK_n, NO_BTN, AXIS_NONE }, { true, RARCH_SHADER_PREV, SK_n, NO_BTN, AXIS_NONE },
{ true, SSNES_CHEAT_INDEX_PLUS, SK_y, NO_BTN, AXIS_NONE }, { true, RARCH_CHEAT_INDEX_PLUS, SK_y, NO_BTN, AXIS_NONE },
{ true, SSNES_CHEAT_INDEX_MINUS, SK_t, NO_BTN, AXIS_NONE }, { true, RARCH_CHEAT_INDEX_MINUS, SK_t, NO_BTN, AXIS_NONE },
{ true, SSNES_CHEAT_TOGGLE, SK_u, NO_BTN, AXIS_NONE }, { true, RARCH_CHEAT_TOGGLE, SK_u, NO_BTN, AXIS_NONE },
{ true, SSNES_SCREENSHOT, SK_PRINT, NO_BTN, AXIS_NONE }, { true, RARCH_SCREENSHOT, SK_PRINT, NO_BTN, AXIS_NONE },
{ true, SSNES_DSP_CONFIG, SK_c, NO_BTN, AXIS_NONE }, { true, RARCH_DSP_CONFIG, SK_c, NO_BTN, AXIS_NONE },
{ true, SSNES_MUTE, SK_F9, NO_BTN, AXIS_NONE }, { true, RARCH_MUTE, SK_F9, NO_BTN, AXIS_NONE },
{ true, SSNES_NETPLAY_FLIP, SK_i, NO_BTN, AXIS_NONE }, { true, RARCH_NETPLAY_FLIP, SK_i, NO_BTN, AXIS_NONE },
{ true, SSNES_SLOWMOTION, SK_e, NO_BTN, AXIS_NONE }, { true, RARCH_SLOWMOTION, SK_e, NO_BTN, AXIS_NONE },
}; };
// Player 2-5 // Player 2-5

View File

@ -1,5 +1,5 @@
#ifndef __SSNES_FEATURES_H #ifndef __RARCH_FEATURES_H
#define __SSNES_FEATURES_H #define __RARCH_FEATURES_H
#include <stddef.h> #include <stddef.h>
#include "boolean.h" #include "boolean.h"

View File

@ -42,7 +42,7 @@
ROM EXTENSIONS ROM EXTENSIONS
============================================================ */ ============================================================ */
const char *ssnes_console_get_rom_ext(void) const char *rarch_console_get_rom_ext(void)
{ {
const char *retval = NULL; const char *retval = NULL;
@ -57,7 +57,7 @@ const char *ssnes_console_get_rom_ext(void)
return retval; return retval;
} }
void ssnes_console_name_from_id(char *name, size_t size) void rarch_console_name_from_id(char *name, size_t size)
{ {
if (size == 0) if (size == 0)
return; return;
@ -85,7 +85,7 @@ void ssnes_console_name_from_id(char *name, size_t size)
} }
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
static int ssnes_extract_currentfile_in_zip(unzFile uf) static int rarch_extract_currentfile_in_zip(unzFile uf)
{ {
char filename_inzip[PATH_MAX]; char filename_inzip[PATH_MAX];
FILE *fout = NULL; FILE *fout = NULL;
@ -97,7 +97,7 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
if (err != UNZ_OK) if (err != UNZ_OK)
{ {
SSNES_ERR("Error %d with zipfile in unzGetCurrentFileInfo.\n", err); RARCH_ERR("Error %d with zipfile in unzGetCurrentFileInfo.\n", err);
return err; return err;
} }
@ -105,7 +105,7 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
void *buf = malloc(size_buf); void *buf = malloc(size_buf);
if (!buf) if (!buf)
{ {
SSNES_ERR("Error allocating memory\n"); RARCH_ERR("Error allocating memory\n");
return UNZ_INTERNALERROR; return UNZ_INTERNALERROR;
} }
@ -119,26 +119,26 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
err = unzOpenCurrentFile(uf); err = unzOpenCurrentFile(uf);
if (err != UNZ_OK) if (err != UNZ_OK)
SSNES_ERR("Error %d with zipfile in unzOpenCurrentFile.\n", err); RARCH_ERR("Error %d with zipfile in unzOpenCurrentFile.\n", err);
else else
{ {
/* success */ /* success */
fout = fopen(write_filename, "wb"); fout = fopen(write_filename, "wb");
if (!fout) if (!fout)
SSNES_ERR("Error opening %s.\n", write_filename); RARCH_ERR("Error opening %s.\n", write_filename);
} }
if (fout) if (fout)
{ {
SSNES_LOG("Extracting: %s\n", write_filename); RARCH_LOG("Extracting: %s\n", write_filename);
do do
{ {
err = unzReadCurrentFile(uf, buf, size_buf); err = unzReadCurrentFile(uf, buf, size_buf);
if (err < 0) if (err < 0)
{ {
SSNES_ERR("error %d with zipfile in unzReadCurrentFile.\n", err); RARCH_ERR("error %d with zipfile in unzReadCurrentFile.\n", err);
break; break;
} }
@ -146,7 +146,7 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
{ {
if (fwrite(buf, err, 1, fout) != 1) if (fwrite(buf, err, 1, fout) != 1)
{ {
SSNES_ERR("Error in writing extracted file.\n"); RARCH_ERR("Error in writing extracted file.\n");
err = UNZ_ERRNO; err = UNZ_ERRNO;
break; break;
} }
@ -161,7 +161,7 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
{ {
err = unzCloseCurrentFile (uf); err = unzCloseCurrentFile (uf);
if (err != UNZ_OK) if (err != UNZ_OK)
SSNES_ERR("Error %d with zipfile in unzCloseCurrentFile.\n", err); RARCH_ERR("Error %d with zipfile in unzCloseCurrentFile.\n", err);
} }
else else
unzCloseCurrentFile(uf); unzCloseCurrentFile(uf);
@ -170,18 +170,18 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
return err; return err;
} }
int ssnes_extract_zipfile(const char *zip_path) int rarch_extract_zipfile(const char *zip_path)
{ {
unzFile uf = unzOpen(zip_path); unzFile uf = unzOpen(zip_path);
unz_global_info gi; unz_global_info gi;
int err = unzGetGlobalInfo(uf, &gi); int err = unzGetGlobalInfo(uf, &gi);
if (err != UNZ_OK) if (err != UNZ_OK)
SSNES_ERR("error %d with zipfile in unzGetGlobalInfo \n",err); RARCH_ERR("error %d with zipfile in unzGetGlobalInfo \n",err);
for (unsigned i = 0; i < gi.number_entry; i++) for (unsigned i = 0; i < gi.number_entry; i++)
{ {
if (ssnes_extract_currentfile_in_zip(uf) != UNZ_OK) if (rarch_extract_currentfile_in_zip(uf) != UNZ_OK)
break; break;
if ((i + 1) < gi.number_entry) if ((i + 1) < gi.number_entry)
@ -189,7 +189,7 @@ int ssnes_extract_zipfile(const char *zip_path)
err = unzGoToNextFile(uf); err = unzGoToNextFile(uf);
if (err != UNZ_OK) if (err != UNZ_OK)
{ {
SSNES_ERR("error %d with zipfile in unzGoToNextFile\n",err); RARCH_ERR("error %d with zipfile in unzGoToNextFile\n",err);
break; break;
} }
} }
@ -213,9 +213,9 @@ struct platform_bind
const char *label; const char *label;
}; };
uint64_t ssnes_default_keybind_lut[SSNES_FIRST_META_KEY]; uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
char ssnes_default_libretro_keybind_name_lut[SSNES_FIRST_META_KEY][256] = { char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256] = {
"B Button", /* RETRO_DEVICE_ID_JOYPAD_B */ "B Button", /* RETRO_DEVICE_ID_JOYPAD_B */
"Y Button", /* RETRO_DEVICE_ID_JOYPAD_Y */ "Y Button", /* RETRO_DEVICE_ID_JOYPAD_Y */
"Select button", /* RETRO_DEVICE_ID_JOYPAD_SELECT */ "Select button", /* RETRO_DEVICE_ID_JOYPAD_SELECT */
@ -350,7 +350,7 @@ static const struct platform_bind platform_keys[] = {
}; };
#endif #endif
uint64_t ssnes_input_find_previous_platform_key(uint64_t joykey) uint64_t rarch_input_find_previous_platform_key(uint64_t joykey)
{ {
size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]); size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]);
@ -366,7 +366,7 @@ uint64_t ssnes_input_find_previous_platform_key(uint64_t joykey)
return NO_BTN; return NO_BTN;
} }
uint64_t ssnes_input_find_next_platform_key(uint64_t joykey) uint64_t rarch_input_find_next_platform_key(uint64_t joykey)
{ {
size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]); size_t arr_size = sizeof(platform_keys) / sizeof(platform_keys[0]);
if (platform_keys[arr_size - 1].joykey == joykey) if (platform_keys[arr_size - 1].joykey == joykey)
@ -381,7 +381,7 @@ uint64_t ssnes_input_find_next_platform_key(uint64_t joykey)
return NO_BTN; return NO_BTN;
} }
const char *ssnes_input_find_platform_key_label(uint64_t joykey) const char *rarch_input_find_platform_key_label(uint64_t joykey)
{ {
if (joykey == NO_BTN) if (joykey == NO_BTN)
return "No button"; return "No button";
@ -396,22 +396,22 @@ const char *ssnes_input_find_platform_key_label(uint64_t joykey)
return "Unknown"; return "Unknown";
} }
void ssnes_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id) void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id)
{ {
uint64_t *key = &g_settings.input.binds[player][default_retro_joypad_id].joykey; uint64_t *key = &g_settings.input.binds[player][default_retro_joypad_id].joykey;
switch (keybind_action) switch (keybind_action)
{ {
case KEYBIND_DECREMENT: case KEYBIND_DECREMENT:
*key = ssnes_input_find_previous_platform_key(*key); *key = rarch_input_find_previous_platform_key(*key);
break; break;
case KEYBIND_INCREMENT: case KEYBIND_INCREMENT:
*key = ssnes_input_find_next_platform_key(*key); *key = rarch_input_find_next_platform_key(*key);
break; break;
case KEYBIND_DEFAULT: case KEYBIND_DEFAULT:
*key = ssnes_default_keybind_lut[default_retro_joypad_id]; *key = rarch_default_keybind_lut[default_retro_joypad_id];
break; break;
default: default:
@ -419,17 +419,17 @@ void ssnes_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t
} }
} }
void ssnes_input_set_default_keybinds(unsigned player) void rarch_input_set_default_keybinds(unsigned player)
{ {
for (unsigned i = 0; i < SSNES_FIRST_META_KEY; i++) for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
{ {
g_settings.input.binds[player][i].id = i; g_settings.input.binds[player][i].id = i;
g_settings.input.binds[player][i].joykey = ssnes_default_keybind_lut[i]; g_settings.input.binds[player][i].joykey = rarch_default_keybind_lut[i];
} }
g_settings.input.dpad_emulation[player] = DPAD_EMULATION_LSTICK; g_settings.input.dpad_emulation[player] = DPAD_EMULATION_LSTICK;
} }
void ssnes_input_set_default_keybind_names_for_emulator(void) void rarch_input_set_default_keybind_names_for_emulator(void)
{ {
struct retro_system_info info; struct retro_system_info info;
retro_get_system_info(&info); retro_get_system_info(&info);
@ -438,20 +438,20 @@ void ssnes_input_set_default_keybind_names_for_emulator(void)
// Genesis Plus GX/Next // Genesis Plus GX/Next
if (strstr(id, "Genesis Plus GX")) if (strstr(id, "Genesis Plus GX"))
{ {
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B],
"B button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B])); "B button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_B]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A],
"C button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A])); "C button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_A]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X],
"Y button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X])); "Y button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_X]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y],
"A button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y])); "A button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_Y]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L],
"X button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L])); "X button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_L]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R],
"Z button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R])); "Z button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_R]));
strlcpy(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT], strlcpy(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT],
"Mode button", sizeof(ssnes_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT])); "Mode button", sizeof(rarch_default_libretro_keybind_name_lut[RETRO_DEVICE_ID_JOYPAD_SELECT]));
} }
} }
@ -488,14 +488,14 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
============================================================ */ ============================================================ */
#ifdef HAVE_LIBRETRO_MANAGEMENT #ifdef HAVE_LIBRETRO_MANAGEMENT
bool ssnes_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext) bool rarch_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext)
{ {
g_extern.verbose = true; g_extern.verbose = true;
bool return_code; bool return_code;
bool set_libretro_path = false; bool set_libretro_path = false;
char tmp_path2[1024], tmp_pathnewfile[1024]; char tmp_path2[1024], tmp_pathnewfile[1024];
SSNES_LOG("Assumed path of CORE executable: [%s]\n", full_path); RARCH_LOG("Assumed path of CORE executable: [%s]\n", full_path);
if (path_file_exists(full_path)) if (path_file_exists(full_path))
{ {
@ -509,7 +509,7 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
int ret; int ret;
#endif #endif
ssnes_console_name_from_id(tmp_path2, sizeof(tmp_path2)); rarch_console_name_from_id(tmp_path2, sizeof(tmp_path2));
strlcat(tmp_path2, exe_ext, sizeof(tmp_path2)); strlcat(tmp_path2, exe_ext, sizeof(tmp_path2));
snprintf(tmp_pathnewfile, sizeof(tmp_pathnewfile), "%s%s", path, tmp_path2); snprintf(tmp_pathnewfile, sizeof(tmp_pathnewfile), "%s%s", path, tmp_path2);
@ -519,7 +519,7 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
// upgrading the libretro core - so delete pre-existing // upgrading the libretro core - so delete pre-existing
// file first. // file first.
SSNES_LOG("Upgrading emulator core...\n"); RARCH_LOG("Upgrading emulator core...\n");
#if defined(__CELLOS_LV2__) #if defined(__CELLOS_LV2__)
ret = cellFsUnlink(tmp_pathnewfile); ret = cellFsUnlink(tmp_pathnewfile);
if (ret == CELL_FS_SUCCEEDED) if (ret == CELL_FS_SUCCEEDED)
@ -528,10 +528,10 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
if (ret != 0) if (ret != 0)
#endif #endif
{ {
SSNES_LOG("Succeeded in removing pre-existing libretro core: [%s].\n", tmp_pathnewfile); RARCH_LOG("Succeeded in removing pre-existing libretro core: [%s].\n", tmp_pathnewfile);
} }
else else
SSNES_LOG("Failed to remove pre-existing libretro core: [%s].\n", tmp_pathnewfile); RARCH_LOG("Failed to remove pre-existing libretro core: [%s].\n", tmp_pathnewfile);
} }
//now attempt the renaming. //now attempt the renaming.
@ -544,17 +544,17 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
if (ret == 0) if (ret == 0)
#endif #endif
{ {
SSNES_ERR("Failed to rename CORE executable.\n"); RARCH_ERR("Failed to rename CORE executable.\n");
} }
else else
{ {
SSNES_LOG("Libsnes core [%s] renamed to: [%s].\n", full_path, tmp_pathnewfile); RARCH_LOG("Libsnes core [%s] renamed to: [%s].\n", full_path, tmp_pathnewfile);
set_libretro_path = true; set_libretro_path = true;
} }
} }
else else
{ {
SSNES_LOG("CORE executable was not found, libretro core path will be loaded from config file.\n"); RARCH_LOG("CORE executable was not found, libretro core path will be loaded from config file.\n");
} }
if (set_libretro_path) if (set_libretro_path)
@ -581,16 +581,16 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
RetroArch MAIN WRAP RetroArch MAIN WRAP
============================================================ */ ============================================================ */
#ifdef HAVE_SSNES_MAIN_WRAP #ifdef HAVE_RARCH_MAIN_WRAP
void ssnes_startup (const char * config_path) void rarch_startup (const char * config_path)
{ {
if(g_console.initialize_ssnes_enable) if(g_console.initialize_rarch_enable)
{ {
if(g_console.emulator_initialized) if(g_console.emulator_initialized)
ssnes_main_deinit(); rarch_main_deinit();
struct ssnes_main_wrap args = {0}; struct rarch_main_wrap args = {0};
args.verbose = g_extern.verbose; args.verbose = g_extern.verbose;
args.config_path = config_path; args.config_path = config_path;
@ -598,14 +598,14 @@ void ssnes_startup (const char * config_path)
args.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL, args.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL,
args.rom_path = g_console.rom_path; args.rom_path = g_console.rom_path;
int init_ret = ssnes_main_init_wrap(&args); int init_ret = rarch_main_init_wrap(&args);
(void)init_ret; (void)init_ret;
g_console.emulator_initialized = 1; g_console.emulator_initialized = 1;
g_console.initialize_ssnes_enable = 0; g_console.initialize_rarch_enable = 0;
} }
} }
int ssnes_main_init_wrap(const struct ssnes_main_wrap *args) int rarch_main_init_wrap(const struct rarch_main_wrap *args)
{ {
int argc = 0; int argc = 0;
char *argv[MAX_ARGS] = {NULL}; char *argv[MAX_ARGS] = {NULL};
@ -637,13 +637,13 @@ int ssnes_main_init_wrap(const struct ssnes_main_wrap *args)
argv[argc++] = strdup("-v"); argv[argc++] = strdup("-v");
#ifdef HAVE_FILE_LOGGER #ifdef HAVE_FILE_LOGGER
SSNES_LOG("foo\n"); RARCH_LOG("foo\n");
for(int i = 0; i < argc; i++) for(int i = 0; i < argc; i++)
SSNES_LOG("arg #%d: %s\n", i, argv[i]); RARCH_LOG("arg #%d: %s\n", i, argv[i]);
SSNES_LOG("bar\n"); RARCH_LOG("bar\n");
#endif #endif
int ret = ssnes_main_init(argc, argv); int ret = rarch_main_init(argc, argv);
char **tmp = argv; char **tmp = argv;
while (*tmp) while (*tmp)
@ -658,7 +658,7 @@ int ssnes_main_init_wrap(const struct ssnes_main_wrap *args)
#endif #endif
#ifdef HAVE_SSNES_EXEC #ifdef HAVE_RARCH_EXEC
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
#include <cell/sysmodule.h> #include <cell/sysmodule.h>
@ -669,11 +669,11 @@ int ssnes_main_init_wrap(const struct ssnes_main_wrap *args)
#include <np/drm.h> #include <np/drm.h>
#endif #endif
void ssnes_exec (void) void rarch_exec (void)
{ {
if(g_console.return_to_launcher) if(g_console.return_to_launcher)
{ {
SSNES_LOG("Attempt to load executable: [%s].\n", g_console.launch_app_on_exit); RARCH_LOG("Attempt to load executable: [%s].\n", g_console.launch_app_on_exit);
#if defined(_XBOX) #if defined(_XBOX)
XLaunchNewImage(g_console.launch_app_on_exit, NULL); XLaunchNewImage(g_console.launch_app_on_exit, NULL);
#elif defined(__CELLOS_LV2__) #elif defined(__CELLOS_LV2__)
@ -695,7 +695,7 @@ void ssnes_exec (void)
int ret = sceNpDrmProcessExitSpawn2(k_licensee, g_console.launch_app_on_exit, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); int ret = sceNpDrmProcessExitSpawn2(k_licensee, g_console.launch_app_on_exit, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
if(ret < 0) if(ret < 0)
{ {
SSNES_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n"); RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(g_console.launch_app_on_exit, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); sys_game_process_exitspawn(g_console.launch_app_on_exit, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
} }
sceNpTerm(); sceNpTerm();

View File

@ -69,40 +69,40 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
// Get rom extensions for current library. // Get rom extensions for current library.
// Returns NULL if library doesn't have any preferences in particular. // Returns NULL if library doesn't have any preferences in particular.
const char *ssnes_console_get_rom_ext(void); const char *rarch_console_get_rom_ext(void);
// Transforms a library id to a name suitable as a pathname. // Transforms a library id to a name suitable as a pathname.
void ssnes_console_name_from_id(char *name, size_t size); void rarch_console_name_from_id(char *name, size_t size);
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
int ssnes_extract_zipfile(const char *zip_path); int rarch_extract_zipfile(const char *zip_path);
#endif #endif
/*============================================================ /*============================================================
INPUT EXTENSIONS INPUT EXTENSIONS
============================================================ */ ============================================================ */
const char *ssnes_input_find_platform_key_label(uint64_t joykey); const char *rarch_input_find_platform_key_label(uint64_t joykey);
uint64_t ssnes_input_find_previous_platform_key(uint64_t joykey); uint64_t rarch_input_find_previous_platform_key(uint64_t joykey);
uint64_t ssnes_input_find_next_platform_key(uint64_t joykey); uint64_t rarch_input_find_next_platform_key(uint64_t joykey);
// Sets custom default keybind names (some systems emulated by the emulator // Sets custom default keybind names (some systems emulated by the emulator
// will need different keybind names for buttons, etc.) // will need different keybind names for buttons, etc.)
void ssnes_input_set_default_keybind_names_for_emulator(void); void rarch_input_set_default_keybind_names_for_emulator(void);
void ssnes_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id); void rarch_input_set_keybind(unsigned player, unsigned keybind_action, uint64_t default_retro_joypad_id);
#ifdef HAVE_LIBRETRO_MANAGEMENT #ifdef HAVE_LIBRETRO_MANAGEMENT
bool ssnes_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext); bool rarch_manage_libretro_core(const char *full_path, const char *path, const char *exe_ext);
#endif #endif
/*============================================================ /*============================================================
SSNES SSNES
============================================================ */ ============================================================ */
#ifdef HAVE_SSNES_MAIN_WRAP #ifdef HAVE_RARCH_MAIN_WRAP
struct ssnes_main_wrap struct rarch_main_wrap
{ {
const char *rom_path; const char *rom_path;
const char *sram_path; const char *sram_path;
@ -111,12 +111,12 @@ struct ssnes_main_wrap
bool verbose; bool verbose;
}; };
int ssnes_main_init_wrap(const struct ssnes_main_wrap *args); int rarch_main_init_wrap(const struct rarch_main_wrap *args);
void ssnes_startup (const char * config_path); void rarch_startup (const char * config_path);
#endif #endif
#ifdef HAVE_SSNES_EXEC #ifdef HAVE_RARCH_EXEC
void ssnes_exec (void); void rarch_exec (void);
#endif #endif
#endif #endif

View File

@ -78,7 +78,7 @@ enum ps3_device_id
PS3_DEVICE_ID_RSTICK_UP_DPAD, PS3_DEVICE_ID_RSTICK_UP_DPAD,
PS3_DEVICE_ID_RSTICK_DOWN_DPAD, PS3_DEVICE_ID_RSTICK_DOWN_DPAD,
SSNES_LAST_PLATFORM_KEY RARCH_LAST_PLATFORM_KEY
}; };
#elif defined(_XBOX) #elif defined(_XBOX)
@ -119,7 +119,7 @@ enum xdk360_device_id
XDK360_DEVICE_ID_RSTICK_UP_DPAD, XDK360_DEVICE_ID_RSTICK_UP_DPAD,
XDK360_DEVICE_ID_RSTICK_DOWN_DPAD, XDK360_DEVICE_ID_RSTICK_DOWN_DPAD,
SSNES_LAST_PLATFORM_KEY RARCH_LAST_PLATFORM_KEY
}; };
#elif defined(GEKKO) #elif defined(GEKKO)
#include <ogc/pad.h> #include <ogc/pad.h>
@ -128,7 +128,7 @@ enum xdk360_device_id
#endif #endif
#endif #endif
extern uint64_t ssnes_default_keybind_lut[SSNES_FIRST_META_KEY]; extern uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
extern char ssnes_default_libsnes_keybind_name_lut[SSNES_FIRST_META_KEY][256]; extern char rarch_default_libsnes_keybind_name_lut[RARCH_FIRST_META_KEY][256];
#endif #endif

View File

@ -204,7 +204,7 @@ const char * path, const char * extensions)
error: error:
if(error) if(error)
{ {
SSNES_ERR("Failed to open directory: \"%s\"\n", path); RARCH_ERR("Failed to open directory: \"%s\"\n", path);
} }
#ifdef _XBOX #ifdef _XBOX
FindClose(hFind); FindClose(hFind);

View File

@ -23,7 +23,7 @@
#define HAVE_GRIFFIN_OVERRIDE_VIDEO_FRAME_FUNC 1 #define HAVE_GRIFFIN_OVERRIDE_VIDEO_FRAME_FUNC 1
#endif #endif
#define ssnes_render_cached_frame() \ #define rarch_render_cached_frame() \
const char *msg = msg_queue_pull(g_extern.msg_queue); \ const char *msg = msg_queue_pull(g_extern.msg_queue); \
video_frame_func(g_extern.frame_cache.data, g_extern.frame_cache.width, g_extern.frame_cache.height, g_extern.frame_cache.pitch, msg); video_frame_func(g_extern.frame_cache.data, g_extern.frame_cache.width, g_extern.frame_cache.height, g_extern.frame_cache.pitch, msg);

View File

@ -32,8 +32,8 @@ COMPATIBILITY
CONFIG FILE CONFIG FILE
============================================================ */ ============================================================ */
#ifdef _XBOX #ifdef _XBOX
#undef __SSNES_POSIX_STRING_H #undef __RARCH_POSIX_STRING_H
#undef __SSNES_MSVC_COMPAT_H #undef __RARCH_MSVC_COMPAT_H
#undef strcasecmp #undef strcasecmp
#endif #endif
#include "../../conf/config_file.c" #include "../../conf/config_file.c"

View File

@ -14,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _SSNES_FUNC_HOOKS_H #ifndef _RARCH_FUNC_HOOKS_H
#define _SSNES_FUNC_HOOKS_H #define _RARCH_FUNC_HOOKS_H
/*============================================================ /*============================================================
PLAYSTATION3 PLAYSTATION3

View File

@ -48,21 +48,21 @@
#ifdef HAVE_LOGGER #ifdef HAVE_LOGGER
#include "logger.h" #include "logger.h"
#define SSNES_LOG(...) logger_send("RetroArch Salamander: " __VA_ARGS__); #define RARCH_LOG(...) logger_send("RetroArch Salamander: " __VA_ARGS__);
#define SSNES_ERR(...) logger_send("RetroArch Salamander [ERROR] :: " __VA_ARGS__); #define RARCH_ERR(...) logger_send("RetroArch Salamander [ERROR] :: " __VA_ARGS__);
#define SSNES_WARN(...) logger_send("RetroArch Salamander [WARN] :: " __VA_ARGS__); #define RARCH_WARN(...) logger_send("RetroArch Salamander [WARN] :: " __VA_ARGS__);
#else #else
#define SSNES_LOG(...) do { \ #define RARCH_LOG(...) do { \
fprintf(stderr, "RetroArch Salamander: " __VA_ARGS__); \ fprintf(stderr, "RetroArch Salamander: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
#define SSNES_ERR(...) do { \ #define RARCH_ERR(...) do { \
fprintf(stderr, "RetroArch Salamander [ERROR] :: " __VA_ARGS__); \ fprintf(stderr, "RetroArch Salamander [ERROR] :: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
#define SSNES_WARN(...) do { \ #define RARCH_WARN(...) do { \
fprintf(stderr, "RetroArch Salamander [WARN] :: " __VA_ARGS__); \ fprintf(stderr, "RetroArch Salamander [WARN] :: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
@ -96,7 +96,7 @@ static void find_and_set_first_file(void)
if (!dir_list) if (!dir_list)
{ {
SSNES_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
return; return;
} }
@ -113,13 +113,13 @@ static void find_and_set_first_file(void)
if(strcmp(fname_tmp, "SSNES-Salamander.xex") == 0) if(strcmp(fname_tmp, "SSNES-Salamander.xex") == 0)
{ {
SSNES_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n"); RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
first_executable = dir_list[1]; first_executable = dir_list[1];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp)); fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
if(!first_executable) if(!first_executable)
{ {
SSNES_WARN("There is no second entry - no choice but to boot RetroArch Salamander\n"); RARCH_WARN("There is no second entry - no choice but to boot RetroArch Salamander\n");
first_executable = dir_list[0]; first_executable = dir_list[0];
fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp)); fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
} }
@ -127,12 +127,12 @@ static void find_and_set_first_file(void)
snprintf(first_executable, sizeof(first_executable), "game:\\%s", fname_tmp); snprintf(first_executable, sizeof(first_executable), "game:\\%s", fname_tmp);
#endif #endif
SSNES_LOG("Start first entry in libretro cores dir: [%s].\n", first_executable); RARCH_LOG("Start first entry in libretro cores dir: [%s].\n", first_executable);
strlcpy(libretro_path, first_executable, sizeof(libretro_path)); strlcpy(libretro_path, first_executable, sizeof(libretro_path));
} }
else else
{ {
SSNES_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
} }
dir_list_free(dir_list); dir_list_free(dir_list);
@ -147,7 +147,7 @@ static void init_settings(void)
{ {
FILE * f; FILE * f;
config_file_exists = false; config_file_exists = false;
SSNES_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE); RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
f = fopen(SYS_CONFIG_FILE, "w"); f = fopen(SYS_CONFIG_FILE, "w");
fclose(f); fclose(f);
} }
@ -166,7 +166,7 @@ static void init_settings(void)
{ {
//Start CORE executable //Start CORE executable
snprintf(libretro_path, sizeof(libretro_path), core_executable); snprintf(libretro_path, sizeof(libretro_path), core_executable);
SSNES_LOG("Start [%s].\n", libretro_path); RARCH_LOG("Start [%s].\n", libretro_path);
} }
else else
{ {
@ -181,7 +181,7 @@ static void init_settings(void)
find_and_set_first_file(); find_and_set_first_file();
else else
{ {
SSNES_LOG("Start [%s] found in ssnes.cfg.\n", libretro_path); RARCH_LOG("Start [%s] found in ssnes.cfg.\n", libretro_path);
} }
} }
} }
@ -197,13 +197,13 @@ static void get_environment_settings (void)
if(result_filecache != TRUE) if(result_filecache != TRUE)
{ {
SSNES_ERR("Couldn't change number of bytes reserved for file system cache.\n"); RARCH_ERR("Couldn't change number of bytes reserved for file system cache.\n");
} }
unsigned long result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0); unsigned long result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0);
if(result != ERROR_SUCCESS) if(result != ERROR_SUCCESS)
{ {
SSNES_ERR("Couldn't mount/format utility drive.\n"); RARCH_ERR("Couldn't mount/format utility drive.\n");
} }
// detect install environment // detect install environment
@ -211,7 +211,7 @@ static void get_environment_settings (void)
if (XContentGetLicenseMask(&license_mask, NULL) != ERROR_SUCCESS) if (XContentGetLicenseMask(&license_mask, NULL) != ERROR_SUCCESS)
{ {
SSNES_LOG("RetroArch was launched as a standalone DVD, or using DVD emulation, or from the development area of the HDD.\n"); RARCH_LOG("RetroArch was launched as a standalone DVD, or using DVD emulation, or from the development area of the HDD.\n");
} }
else else
{ {
@ -220,16 +220,16 @@ static void get_environment_settings (void)
switch(volume_device_type) switch(volume_device_type)
{ {
case XCONTENTDEVICETYPE_HDD: case XCONTENTDEVICETYPE_HDD:
SSNES_LOG("RetroArch was launched from a content package on HDD.\n"); RARCH_LOG("RetroArch was launched from a content package on HDD.\n");
break; break;
case XCONTENTDEVICETYPE_MU: case XCONTENTDEVICETYPE_MU:
SSNES_LOG("RetroArch was launched from a content package on USB or Memory Unit.\n"); RARCH_LOG("RetroArch was launched from a content package on USB or Memory Unit.\n");
break; break;
case XCONTENTDEVICETYPE_ODD: case XCONTENTDEVICETYPE_ODD:
SSNES_LOG("RetroArch was launched from a content package on Optical Disc Drive.\n"); RARCH_LOG("RetroArch was launched from a content package on Optical Disc Drive.\n");
break; break;
default: default:
SSNES_LOG("RetroArch was launched from a content package on an unknown device type.\n"); RARCH_LOG("RetroArch was launched from a content package on an unknown device type.\n");
break; break;
} }
} }
@ -246,38 +246,38 @@ static void get_environment_settings (void)
int ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName); int ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName);
if(ret < 0) if(ret < 0)
{ {
SSNES_ERR("cellGameBootCheck() Error: 0x%x.\n", ret); RARCH_ERR("cellGameBootCheck() Error: 0x%x.\n", ret);
} }
else else
{ {
SSNES_LOG("cellGameBootCheck() OK.\n"); RARCH_LOG("cellGameBootCheck() OK.\n");
SSNES_LOG("Directory name: [%s].\n", dirName); RARCH_LOG("Directory name: [%s].\n", dirName);
SSNES_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n", size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB); RARCH_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n", size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB);
switch(get_type) switch(get_type)
{ {
case CELL_GAME_GAMETYPE_DISC: case CELL_GAME_GAMETYPE_DISC:
SSNES_LOG("RetroArch was launched on Optical Disc Drive.\n"); RARCH_LOG("RetroArch was launched on Optical Disc Drive.\n");
break; break;
case CELL_GAME_GAMETYPE_HDD: case CELL_GAME_GAMETYPE_HDD:
SSNES_LOG("RetroArch was launched on HDD.\n"); RARCH_LOG("RetroArch was launched on HDD.\n");
break; break;
} }
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME) if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
SSNES_LOG("RetroArch was launched from host machine (APP_HOME).\n"); RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
ret = cellGameContentPermit(contentInfoPath, usrDirPath); ret = cellGameContentPermit(contentInfoPath, usrDirPath);
if(ret < 0) if(ret < 0)
{ {
SSNES_ERR("cellGameContentPermit() Error: 0x%x\n", ret); RARCH_ERR("cellGameContentPermit() Error: 0x%x\n", ret);
} }
else else
{ {
SSNES_LOG("cellGameContentPermit() OK.\n"); RARCH_LOG("cellGameContentPermit() OK.\n");
SSNES_LOG("contentInfoPath : [%s].\n", contentInfoPath); RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
SSNES_LOG("usrDirPath : [%s].\n", usrDirPath); RARCH_LOG("usrDirPath : [%s].\n", usrDirPath);
} }
/* now we fill in all the variables */ /* now we fill in all the variables */
@ -300,7 +300,7 @@ int main(int argc, char *argv[])
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
{ {
//override path, boot first executable in cores directory //override path, boot first executable in cores directory
SSNES_LOG("Fallback - Will boot first executable in RetroArch cores directory.\n"); RARCH_LOG("Fallback - Will boot first executable in RetroArch cores directory.\n");
find_and_set_first_file(); find_and_set_first_file();
} }
else else
@ -310,7 +310,7 @@ int main(int argc, char *argv[])
} }
XLaunchNewImage(libretro_path, NULL); XLaunchNewImage(libretro_path, NULL);
SSNES_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret);
#elif defined(__CELLOS_LV2__) #elif defined(__CELLOS_LV2__)
CellPadData pad_data; CellPadData pad_data;
char spawn_data[256], spawn_data_size[16]; char spawn_data[256], spawn_data_size[16];
@ -340,7 +340,7 @@ int main(int argc, char *argv[])
if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
{ {
//override path, boot first executable in cores directory //override path, boot first executable in cores directory
SSNES_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n"); RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
find_and_set_first_file(); find_and_set_first_file();
} }
else else
@ -368,11 +368,11 @@ int main(int argc, char *argv[])
}; };
ret = sceNpDrmProcessExitSpawn2(k_licensee, libretro_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); ret = sceNpDrmProcessExitSpawn2(k_licensee, libretro_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
SSNES_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret);
if(ret < 0) if(ret < 0)
{ {
SSNES_LOG("Executable file is not of NPDRM type, trying another approach to boot it...\n"); RARCH_LOG("Executable file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn2(libretro_path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); sys_game_process_exitspawn2(libretro_path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
} }

View File

@ -21,12 +21,12 @@
#include "../general.h" #include "../general.h"
#include <string.h> #include <string.h>
int ssnes_main(int argc, char *argv[]); int rarch_main(int argc, char *argv[]);
#undef main #undef main
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
while (ssnes_main(argc, argv) == 0) while (rarch_main(argc, argv) == 0)
{ {
if (optind + 1 >= argc) if (optind + 1 >= argc)
return 0; return 0;
@ -34,7 +34,7 @@ int main(int argc, char *argv[])
memmove(&argv[optind], &argv[optind + 1], (argc - optind - 1) * sizeof(char*)); memmove(&argv[optind], &argv[optind + 1], (argc - optind - 1) * sizeof(char*));
argc--; argc--;
ssnes_main_clear_state(); rarch_main_clear_state();
} }
} }

View File

@ -132,12 +132,12 @@ static void find_audio_driver(void)
return; return;
} }
} }
SSNES_ERR("Couldn't find any audio driver named \"%s\"\n", g_settings.audio.driver); RARCH_ERR("Couldn't find any audio driver named \"%s\"\n", g_settings.audio.driver);
fprintf(stderr, "Available audio drivers are:\n"); fprintf(stderr, "Available audio drivers are:\n");
for (size_t i = 0; i < sizeof(audio_drivers) / sizeof(audio_driver_t*); i++) for (size_t i = 0; i < sizeof(audio_drivers) / sizeof(audio_driver_t*); i++)
fprintf(stderr, "\t%s\n", audio_drivers[i]->ident); fprintf(stderr, "\t%s\n", audio_drivers[i]->ident);
ssnes_fail(1, "find_audio_driver()"); rarch_fail(1, "find_audio_driver()");
} }
static void find_video_driver(void) static void find_video_driver(void)
@ -150,12 +150,12 @@ static void find_video_driver(void)
return; return;
} }
} }
SSNES_ERR("Couldn't find any video driver named \"%s\"\n", g_settings.video.driver); RARCH_ERR("Couldn't find any video driver named \"%s\"\n", g_settings.video.driver);
fprintf(stderr, "Available video drivers are:\n"); fprintf(stderr, "Available video drivers are:\n");
for (size_t i = 0; i < sizeof(video_drivers) / sizeof(video_driver_t*); i++) for (size_t i = 0; i < sizeof(video_drivers) / sizeof(video_driver_t*); i++)
fprintf(stderr, "\t%s\n", video_drivers[i]->ident); fprintf(stderr, "\t%s\n", video_drivers[i]->ident);
ssnes_fail(1, "find_video_driver()"); rarch_fail(1, "find_video_driver()");
} }
static void find_input_driver(void) static void find_input_driver(void)
@ -168,12 +168,12 @@ static void find_input_driver(void)
return; return;
} }
} }
SSNES_ERR("Couldn't find any input driver named \"%s\"\n", g_settings.input.driver); RARCH_ERR("Couldn't find any input driver named \"%s\"\n", g_settings.input.driver);
fprintf(stderr, "Available input drivers are:\n"); fprintf(stderr, "Available input drivers are:\n");
for (size_t i = 0; i < sizeof(input_drivers) / sizeof(input_driver_t*); i++) for (size_t i = 0; i < sizeof(input_drivers) / sizeof(input_driver_t*); i++)
fprintf(stderr, "\t%s\n", input_drivers[i]->ident); fprintf(stderr, "\t%s\n", input_drivers[i]->ident);
ssnes_fail(1, "find_input_driver()"); rarch_fail(1, "find_input_driver()");
} }
void init_drivers_pre(void) void init_drivers_pre(void)
@ -200,37 +200,37 @@ static void init_dsp_plugin(void)
{ {
if (!(*g_settings.audio.dsp_plugin)) if (!(*g_settings.audio.dsp_plugin))
return; return;
ssnes_dsp_info_t info = {0}; rarch_dsp_info_t info = {0};
g_extern.audio_data.dsp_lib = dylib_load(g_settings.audio.dsp_plugin); g_extern.audio_data.dsp_lib = dylib_load(g_settings.audio.dsp_plugin);
if (!g_extern.audio_data.dsp_lib) if (!g_extern.audio_data.dsp_lib)
{ {
SSNES_ERR("Failed to open DSP plugin: \"%s\" ...\n", g_settings.audio.dsp_plugin); RARCH_ERR("Failed to open DSP plugin: \"%s\" ...\n", g_settings.audio.dsp_plugin);
return; return;
} }
const ssnes_dsp_plugin_t* (SSNES_API_CALLTYPE *plugin_init)(void) = const rarch_dsp_plugin_t* (RARCH_API_CALLTYPE *plugin_init)(void) =
(const ssnes_dsp_plugin_t *(SSNES_API_CALLTYPE*)(void))dylib_proc(g_extern.audio_data.dsp_lib, "ssnes_dsp_plugin_init"); (const rarch_dsp_plugin_t *(RARCH_API_CALLTYPE*)(void))dylib_proc(g_extern.audio_data.dsp_lib, "rarch_dsp_plugin_init");
if (!plugin_init) if (!plugin_init)
{ {
SSNES_ERR("Failed to find symbol \"ssnes_dsp_plugin_init\" in DSP plugin.\n"); RARCH_ERR("Failed to find symbol \"rarch_dsp_plugin_init\" in DSP plugin.\n");
goto error; goto error;
} }
g_extern.audio_data.dsp_plugin = plugin_init(); g_extern.audio_data.dsp_plugin = plugin_init();
if (!g_extern.audio_data.dsp_plugin) if (!g_extern.audio_data.dsp_plugin)
{ {
SSNES_ERR("Failed to get a valid DSP plugin.\n"); RARCH_ERR("Failed to get a valid DSP plugin.\n");
goto error; goto error;
} }
if (g_extern.audio_data.dsp_plugin->api_version != SSNES_DSP_API_VERSION) if (g_extern.audio_data.dsp_plugin->api_version != RARCH_DSP_API_VERSION)
{ {
SSNES_ERR("DSP plugin API mismatch. SSNES: %d, Plugin: %d\n", SSNES_DSP_API_VERSION, g_extern.audio_data.dsp_plugin->api_version); RARCH_ERR("DSP plugin API mismatch. SSNES: %d, Plugin: %d\n", RARCH_DSP_API_VERSION, g_extern.audio_data.dsp_plugin->api_version);
goto error; goto error;
} }
SSNES_LOG("Loaded DSP plugin: \"%s\"\n", g_extern.audio_data.dsp_plugin->ident ? g_extern.audio_data.dsp_plugin->ident : "Unknown"); RARCH_LOG("Loaded DSP plugin: \"%s\"\n", g_extern.audio_data.dsp_plugin->ident ? g_extern.audio_data.dsp_plugin->ident : "Unknown");
info.input_rate = g_settings.audio.in_rate; info.input_rate = g_settings.audio.in_rate;
info.output_rate = g_settings.audio.out_rate; info.output_rate = g_settings.audio.out_rate;
@ -238,7 +238,7 @@ static void init_dsp_plugin(void)
g_extern.audio_data.dsp_handle = g_extern.audio_data.dsp_plugin->init(&info); g_extern.audio_data.dsp_handle = g_extern.audio_data.dsp_plugin->init(&info);
if (!g_extern.audio_data.dsp_handle) if (!g_extern.audio_data.dsp_handle)
{ {
SSNES_ERR("Failed to init DSP plugin.\n"); RARCH_ERR("Failed to init DSP plugin.\n");
goto error; goto error;
} }
@ -268,7 +268,7 @@ static void adjust_audio_input_rate(void)
float timing_skew = fabs(1.0f - info->fps / g_settings.video.refresh_rate); float timing_skew = fabs(1.0f - info->fps / g_settings.video.refresh_rate);
if (timing_skew > 0.05f) // We don't want to adjust pitch too much. If we have extreme cases, just don't readjust at all. if (timing_skew > 0.05f) // We don't want to adjust pitch too much. If we have extreme cases, just don't readjust at all.
{ {
SSNES_LOG("Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n", RARCH_LOG("Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n",
g_settings.video.refresh_rate, g_settings.video.refresh_rate,
(float)info->fps); (float)info->fps);
@ -278,7 +278,7 @@ static void adjust_audio_input_rate(void)
g_settings.audio.in_rate = info->sample_rate * g_settings.audio.in_rate = info->sample_rate *
(g_settings.video.refresh_rate / info->fps); (g_settings.video.refresh_rate / info->fps);
SSNES_LOG("Set audio input rate to: %.2f Hz.\n", g_settings.audio.in_rate); RARCH_LOG("Set audio input rate to: %.2f Hz.\n", g_settings.audio.in_rate);
} }
void init_audio(void) void init_audio(void)
@ -288,14 +288,14 @@ void init_audio(void)
size_t outsamples_max = max_bufsamples * AUDIO_MAX_RATIO * g_settings.slowmotion_ratio; size_t outsamples_max = max_bufsamples * AUDIO_MAX_RATIO * g_settings.slowmotion_ratio;
// Used for recording even if audio isn't enabled. // Used for recording even if audio isn't enabled.
ssnes_assert(g_extern.audio_data.conv_outsamples = (int16_t*)malloc(outsamples_max * sizeof(int16_t))); rarch_assert(g_extern.audio_data.conv_outsamples = (int16_t*)malloc(outsamples_max * sizeof(int16_t)));
g_extern.audio_data.block_chunk_size = AUDIO_CHUNK_SIZE_BLOCKING; g_extern.audio_data.block_chunk_size = AUDIO_CHUNK_SIZE_BLOCKING;
g_extern.audio_data.nonblock_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING; g_extern.audio_data.nonblock_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
g_extern.audio_data.chunk_size = g_extern.audio_data.block_chunk_size; g_extern.audio_data.chunk_size = g_extern.audio_data.block_chunk_size;
// Needs to be able to hold full content of a full max_bufsamples in addition to its own. // Needs to be able to hold full content of a full max_bufsamples in addition to its own.
ssnes_assert(g_extern.audio_data.rewind_buf = (int16_t*)malloc(max_bufsamples * sizeof(int16_t))); rarch_assert(g_extern.audio_data.rewind_buf = (int16_t*)malloc(max_bufsamples * sizeof(int16_t)));
g_extern.audio_data.rewind_size = max_bufsamples; g_extern.audio_data.rewind_size = max_bufsamples;
if (!g_settings.audio.enable) if (!g_settings.audio.enable)
@ -311,7 +311,7 @@ void init_audio(void)
if (!driver.audio_data) if (!driver.audio_data)
{ {
SSNES_ERR("Failed to initialize audio driver. Will continue without audio.\n"); RARCH_ERR("Failed to initialize audio driver. Will continue without audio.\n");
g_extern.audio_active = false; g_extern.audio_active = false;
} }
@ -328,11 +328,11 @@ void init_audio(void)
if (!g_extern.audio_data.source) if (!g_extern.audio_data.source)
g_extern.audio_active = false; g_extern.audio_active = false;
ssnes_assert(g_extern.audio_data.data = (float*)malloc(max_bufsamples * sizeof(float))); rarch_assert(g_extern.audio_data.data = (float*)malloc(max_bufsamples * sizeof(float)));
g_extern.audio_data.data_ptr = 0; g_extern.audio_data.data_ptr = 0;
ssnes_assert(g_settings.audio.out_rate < g_settings.audio.in_rate * AUDIO_MAX_RATIO); rarch_assert(g_settings.audio.out_rate < g_settings.audio.in_rate * AUDIO_MAX_RATIO);
ssnes_assert(g_extern.audio_data.outsamples = (float*)malloc(outsamples_max * sizeof(float))); rarch_assert(g_extern.audio_data.outsamples = (float*)malloc(outsamples_max * sizeof(float)));
g_extern.audio_data.orig_src_ratio = g_extern.audio_data.orig_src_ratio =
g_extern.audio_data.src_ratio = g_extern.audio_data.src_ratio =
@ -346,7 +346,7 @@ void init_audio(void)
g_extern.audio_data.rate_control = true; g_extern.audio_data.rate_control = true;
} }
else else
SSNES_WARN("Audio rate control was desired, but driver does not support needed features.\n"); RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
} }
#ifdef HAVE_DYLIB #ifdef HAVE_DYLIB
@ -394,11 +394,11 @@ static void init_filter(void)
if (*g_settings.video.filter_path == '\0') if (*g_settings.video.filter_path == '\0')
return; return;
SSNES_LOG("Loading bSNES filter from \"%s\"\n", g_settings.video.filter_path); RARCH_LOG("Loading bSNES filter from \"%s\"\n", g_settings.video.filter_path);
g_extern.filter.lib = dylib_load(g_settings.video.filter_path); g_extern.filter.lib = dylib_load(g_settings.video.filter_path);
if (!g_extern.filter.lib) if (!g_extern.filter.lib)
{ {
SSNES_ERR("Failed to load filter \"%s\"\n", g_settings.video.filter_path); RARCH_ERR("Failed to load filter \"%s\"\n", g_settings.video.filter_path);
return; return;
} }
@ -410,7 +410,7 @@ static void init_filter(void)
unsigned, unsigned, unsigned))dylib_proc(g_extern.filter.lib, "filter_render"); unsigned, unsigned, unsigned))dylib_proc(g_extern.filter.lib, "filter_render");
if (!g_extern.filter.psize || !g_extern.filter.prender) if (!g_extern.filter.psize || !g_extern.filter.prender)
{ {
SSNES_ERR("Failed to find functions in filter...\n"); RARCH_ERR("Failed to find functions in filter...\n");
dylib_close(g_extern.filter.lib); dylib_close(g_extern.filter.lib);
g_extern.filter.lib = NULL; g_extern.filter.lib = NULL;
return; return;
@ -426,14 +426,14 @@ static void init_filter(void)
unsigned pow2_x = next_pow2(width); unsigned pow2_x = next_pow2(width);
unsigned pow2_y = next_pow2(height); unsigned pow2_y = next_pow2(height);
unsigned maxsize = pow2_x > pow2_y ? pow2_x : pow2_y; unsigned maxsize = pow2_x > pow2_y ? pow2_x : pow2_y;
g_extern.filter.scale = maxsize / SSNES_SCALE_BASE; g_extern.filter.scale = maxsize / RARCH_SCALE_BASE;
g_extern.filter.buffer = (uint32_t*)malloc(SSNES_SCALE_BASE * SSNES_SCALE_BASE * g_extern.filter.scale * g_extern.filter.scale * sizeof(uint32_t)); g_extern.filter.buffer = (uint32_t*)malloc(RARCH_SCALE_BASE * RARCH_SCALE_BASE * g_extern.filter.scale * g_extern.filter.scale * sizeof(uint32_t));
g_extern.filter.pitch = SSNES_SCALE_BASE * g_extern.filter.scale * sizeof(uint32_t); g_extern.filter.pitch = RARCH_SCALE_BASE * g_extern.filter.scale * sizeof(uint32_t);
ssnes_assert(g_extern.filter.buffer); rarch_assert(g_extern.filter.buffer);
g_extern.filter.colormap = (uint32_t*)malloc(32768 * sizeof(uint32_t)); g_extern.filter.colormap = (uint32_t*)malloc(32768 * sizeof(uint32_t));
ssnes_assert(g_extern.filter.colormap); rarch_assert(g_extern.filter.colormap);
// Set up conversion map from 16-bit XRGB1555 to 32-bit ARGB. // Set up conversion map from 16-bit XRGB1555 to 32-bit ARGB.
for (unsigned i = 0; i < 32768; i++) for (unsigned i = 0; i < 32768; i++)
@ -475,7 +475,7 @@ static void init_shader_dir(void)
{ {
while (g_extern.shader_dir.elems[g_extern.shader_dir.size]) while (g_extern.shader_dir.elems[g_extern.shader_dir.size])
{ {
SSNES_LOG("Found shader \"%s\"\n", g_extern.shader_dir.elems[g_extern.shader_dir.size]); RARCH_LOG("Found shader \"%s\"\n", g_extern.shader_dir.elems[g_extern.shader_dir.size]);
g_extern.shader_dir.size++; g_extern.shader_dir.size++;
} }
} }
@ -503,7 +503,7 @@ void init_video_input(void)
const struct retro_game_geometry *geom = &g_extern.system.av_info.geometry; const struct retro_game_geometry *geom = &g_extern.system.av_info.geometry;
unsigned max_dim = max(geom->max_width, geom->max_height); unsigned max_dim = max(geom->max_width, geom->max_height);
unsigned scale = next_pow2(max_dim) / SSNES_SCALE_BASE; unsigned scale = next_pow2(max_dim) / RARCH_SCALE_BASE;
scale = max(scale, 1); scale = max(scale, 1);
if (g_extern.filter.active) if (g_extern.filter.active)
@ -516,7 +516,7 @@ void init_video_input(void)
else else
g_settings.video.aspect_ratio = (float)geom->base_width / geom->base_height; // 1:1 PAR. g_settings.video.aspect_ratio = (float)geom->base_width / geom->base_height; // 1:1 PAR.
SSNES_LOG("Adjusting aspect ratio to %.2f\n", g_settings.video.aspect_ratio); RARCH_LOG("Adjusting aspect ratio to %.2f\n", g_settings.video.aspect_ratio);
} }
unsigned width; unsigned width;
@ -540,7 +540,7 @@ void init_video_input(void)
} }
} }
SSNES_LOG("Video @ %ux%u\n", width, height); RARCH_LOG("Video @ %ux%u\n", width, height);
video_info_t video = {0}; video_info_t video = {0};
video.width = width; video.width = width;
@ -557,8 +557,8 @@ void init_video_input(void)
if (driver.video_data == NULL) if (driver.video_data == NULL)
{ {
SSNES_ERR("Cannot open video driver ... Exiting ...\n"); RARCH_ERR("Cannot open video driver ... Exiting ...\n");
ssnes_fail(1, "init_video_input()"); rarch_fail(1, "init_video_input()");
} }
if (driver.video->set_rotation && g_extern.system.rotation) if (driver.video->set_rotation && g_extern.system.rotation)
@ -573,14 +573,14 @@ void init_video_input(void)
driver.input_data = input_init_func(); driver.input_data = input_init_func();
if (driver.input_data == NULL) if (driver.input_data == NULL)
{ {
SSNES_ERR("Cannot init input driver. Exiting ...\n"); RARCH_ERR("Cannot init input driver. Exiting ...\n");
ssnes_fail(1, "init_video_input()"); rarch_fail(1, "init_video_input()");
} }
} }
else else
{ {
SSNES_ERR("Cannot find input driver. Exiting ...\n"); RARCH_ERR("Cannot find input driver. Exiting ...\n");
ssnes_fail(1, "init_video_input()"); rarch_fail(1, "init_video_input()");
} }
} }
} }

View File

@ -29,48 +29,48 @@
#define AUDIO_MAX_RATIO 16 #define AUDIO_MAX_RATIO 16
// libretro has 12 buttons from 0-11 (libretro.h) // libretro has 12 buttons from 0-11 (libretro.h)
#define SSNES_FIRST_META_KEY 12 #define RARCH_FIRST_META_KEY 12
enum enum
{ {
SSNES_FAST_FORWARD_KEY = SSNES_FIRST_META_KEY, RARCH_FAST_FORWARD_KEY = RARCH_FIRST_META_KEY,
SSNES_FAST_FORWARD_HOLD_KEY, RARCH_FAST_FORWARD_HOLD_KEY,
SSNES_LOAD_STATE_KEY, RARCH_LOAD_STATE_KEY,
SSNES_SAVE_STATE_KEY, RARCH_SAVE_STATE_KEY,
SSNES_FULLSCREEN_TOGGLE_KEY, RARCH_FULLSCREEN_TOGGLE_KEY,
SSNES_QUIT_KEY, RARCH_QUIT_KEY,
SSNES_STATE_SLOT_PLUS, RARCH_STATE_SLOT_PLUS,
SSNES_STATE_SLOT_MINUS, RARCH_STATE_SLOT_MINUS,
SSNES_AUDIO_INPUT_RATE_PLUS, RARCH_AUDIO_INPUT_RATE_PLUS,
SSNES_AUDIO_INPUT_RATE_MINUS, RARCH_AUDIO_INPUT_RATE_MINUS,
SSNES_REWIND, RARCH_REWIND,
SSNES_MOVIE_RECORD_TOGGLE, RARCH_MOVIE_RECORD_TOGGLE,
SSNES_PAUSE_TOGGLE, RARCH_PAUSE_TOGGLE,
SSNES_FRAMEADVANCE, RARCH_FRAMEADVANCE,
SSNES_RESET, RARCH_RESET,
SSNES_SHADER_NEXT, RARCH_SHADER_NEXT,
SSNES_SHADER_PREV, RARCH_SHADER_PREV,
SSNES_CHEAT_INDEX_PLUS, RARCH_CHEAT_INDEX_PLUS,
SSNES_CHEAT_INDEX_MINUS, RARCH_CHEAT_INDEX_MINUS,
SSNES_CHEAT_TOGGLE, RARCH_CHEAT_TOGGLE,
SSNES_SCREENSHOT, RARCH_SCREENSHOT,
SSNES_DSP_CONFIG, RARCH_DSP_CONFIG,
SSNES_MUTE, RARCH_MUTE,
SSNES_NETPLAY_FLIP, RARCH_NETPLAY_FLIP,
SSNES_SLOWMOTION, RARCH_SLOWMOTION,
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
SSNES_CHEAT_INPUT, RARCH_CHEAT_INPUT,
SSNES_SRAM_WRITE_PROTECT, RARCH_SRAM_WRITE_PROTECT,
#endif #endif
SSNES_BIND_LIST_END RARCH_BIND_LIST_END
}; };
struct snes_keybind struct snes_keybind
{ {
bool valid; bool valid;
int id; int id;
enum ssnes_key key; enum rarch_key key;
// PC only uses lower 16-bits. // PC only uses lower 16-bits.
// Full 64-bit can be used for port-specific purposes, like simplifying multiple binds, etc. // Full 64-bit can be used for port-specific purposes, like simplifying multiple binds, etc.
@ -87,7 +87,7 @@ typedef struct video_info
bool vsync; bool vsync;
bool force_aspect; bool force_aspect;
bool smooth; bool smooth;
unsigned input_scale; // Maximum input size: SSNES_SCALE_BASE * input_scale unsigned input_scale; // Maximum input size: RARCH_SCALE_BASE * input_scale
bool rgb32; // Use 32-bit RGBA rather than native XBGR1555. bool rgb32; // Use 32-bit RGBA rather than native XBGR1555.
} video_info_t; } video_info_t;
@ -150,7 +150,7 @@ typedef struct video_driver
const char *ident; const char *ident;
// Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff. // Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff.
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
void (*set_swap_block_state)(void *data, bool toggle); // Block swapping from being called in ::frame(). void (*set_swap_block_state)(void *data, bool toggle); // Block swapping from being called in ::frame().
void (*swap)(void *data); // Explicitly swap buffers. Only useful when set_swap_block_state() is set to true. void (*swap)(void *data); // Explicitly swap buffers. Only useful when set_swap_block_state() is set to true.
void (*set_aspect_ratio)(void *data, unsigned aspectratio_idx); // TODO: refactor this properly to float. void (*set_aspect_ratio)(void *data, unsigned aspectratio_idx); // TODO: refactor this properly to float.

View File

@ -18,7 +18,7 @@
#include "compat/strl.h" #include "compat/strl.h"
#include <string.h> #include <string.h>
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
#include "console/console_ext.h" #include "console/console_ext.h"
#endif #endif
@ -41,7 +41,7 @@
#define SYM(x) do { \ #define SYM(x) do { \
function_t func = dylib_proc(lib_handle, #x); \ function_t func = dylib_proc(lib_handle, #x); \
memcpy(&p##x, &func, sizeof(func)); \ memcpy(&p##x, &func, sizeof(func)); \
if (p##x == NULL) { SSNES_ERR("Failed to load symbol: \"%s\"\n", #x); ssnes_fail(1, "init_libretro_sym()"); } \ if (p##x == NULL) { RARCH_ERR("Failed to load symbol: \"%s\"\n", #x); rarch_fail(1, "init_libretro_sym()"); } \
} while (0) } while (0)
static dylib_t lib_handle = NULL; static dylib_t lib_handle = NULL;
@ -92,12 +92,12 @@ static void set_environment_defaults(void);
static void load_symbols(void) static void load_symbols(void)
{ {
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
SSNES_LOG("Loading dynamic libsnes from: \"%s\"\n", g_settings.libretro); RARCH_LOG("Loading dynamic libsnes from: \"%s\"\n", g_settings.libretro);
lib_handle = dylib_load(g_settings.libretro); lib_handle = dylib_load(g_settings.libretro);
if (!lib_handle) if (!lib_handle)
{ {
SSNES_ERR("Failed to open dynamic library: \"%s\"\n", g_settings.libretro); RARCH_ERR("Failed to open dynamic library: \"%s\"\n", g_settings.libretro);
ssnes_fail(1, "load_dynamic()"); rarch_fail(1, "load_dynamic()");
} }
#endif #endif
@ -140,7 +140,7 @@ void init_libretro_sym(void)
{ {
// Guarantee that we can do "dirty" casting. // Guarantee that we can do "dirty" casting.
// Every OS that this program supports should pass this ... // Every OS that this program supports should pass this ...
ssnes_assert(sizeof(void*) == sizeof(void (*)(void))); rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
// Try to verify that -lsnes was not linked in from other modules // Try to verify that -lsnes was not linked in from other modules
@ -148,10 +148,10 @@ void init_libretro_sym(void)
function_t sym = dylib_proc(NULL, "retro_init"); function_t sym = dylib_proc(NULL, "retro_init");
if (sym) if (sym)
{ {
SSNES_ERR("Serious problem. RetroArch wants to load libsnes dyamically, but it is already linked.\n"); RARCH_ERR("Serious problem. RetroArch wants to load libsnes dyamically, but it is already linked.\n");
SSNES_ERR("This could happen if other modules RetroArch depends on link against libsnes directly.\n"); RARCH_ERR("This could happen if other modules RetroArch depends on link against libsnes directly.\n");
SSNES_ERR("Proceeding could cause a crash. Aborting ...\n"); RARCH_ERR("Proceeding could cause a crash. Aborting ...\n");
ssnes_fail(1, "init_libretro_sym()"); rarch_fail(1, "init_libretro_sym()");
} }
if (!*g_settings.libretro) if (!*g_settings.libretro)
@ -188,7 +188,7 @@ dylib_t dylib_load(const char *path)
#ifdef _WIN32 #ifdef _WIN32
dylib_t lib = LoadLibrary(path); dylib_t lib = LoadLibrary(path);
if (!lib) if (!lib)
SSNES_ERR("Failed to load library, error code: 0x%x\n", (unsigned)GetLastError()); RARCH_ERR("Failed to load library, error code: 0x%x\n", (unsigned)GetLastError());
return lib; return lib;
#else #else
return dlopen(path, RTLD_LAZY); return dlopen(path, RTLD_LAZY);
@ -237,16 +237,16 @@ static bool environment_cb(unsigned cmd, void *data)
{ {
case RETRO_ENVIRONMENT_GET_OVERSCAN: case RETRO_ENVIRONMENT_GET_OVERSCAN:
*(bool*)data = !g_settings.video.crop_overscan; *(bool*)data = !g_settings.video.crop_overscan;
SSNES_LOG("Environ GET_OVERSCAN: %u\n", (unsigned)!g_settings.video.crop_overscan); RARCH_LOG("Environ GET_OVERSCAN: %u\n", (unsigned)!g_settings.video.crop_overscan);
break; break;
case RETRO_ENVIRONMENT_GET_CAN_DUPE: case RETRO_ENVIRONMENT_GET_CAN_DUPE:
#ifdef HAVE_FFMPEG #ifdef HAVE_FFMPEG
*(bool*)data = true; *(bool*)data = true;
SSNES_LOG("Environ GET_CAN_DUPE: true\n"); RARCH_LOG("Environ GET_CAN_DUPE: true\n");
#else #else
*(bool*)data = false; *(bool*)data = false;
SSNES_LOG("Environ GET_CAN_DUPE: false\n"); RARCH_LOG("Environ GET_CAN_DUPE: false\n");
#endif #endif
break; break;
@ -270,7 +270,7 @@ static bool environment_cb(unsigned cmd, void *data)
else else
var->value = g_extern.system.environment; var->value = g_extern.system.environment;
SSNES_LOG("Environ GET_VARIABLE: %s=%s\n", RARCH_LOG("Environ GET_VARIABLE: %s=%s\n",
var->key ? var->key : "null", var->key ? var->key : "null",
var->value ? var->value : "null"); var->value ? var->value : "null");
@ -279,25 +279,25 @@ static bool environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SET_VARIABLES: case RETRO_ENVIRONMENT_SET_VARIABLES:
{ {
SSNES_LOG("Environ SET_VARIABLES:\n"); RARCH_LOG("Environ SET_VARIABLES:\n");
SSNES_LOG("=======================\n"); RARCH_LOG("=======================\n");
const struct retro_variable *vars = (const struct retro_variable*)data; const struct retro_variable *vars = (const struct retro_variable*)data;
while (vars->key) while (vars->key)
{ {
SSNES_LOG("\t%s :: %s\n", RARCH_LOG("\t%s :: %s\n",
vars->key, vars->key,
vars->value ? vars->value : "N/A"); vars->value ? vars->value : "N/A");
vars++; vars++;
} }
SSNES_LOG("=======================\n"); RARCH_LOG("=======================\n");
break; break;
} }
case RETRO_ENVIRONMENT_SET_MESSAGE: case RETRO_ENVIRONMENT_SET_MESSAGE:
{ {
const struct retro_message *msg = (const struct retro_message*)data; const struct retro_message *msg = (const struct retro_message*)data;
SSNES_LOG("Environ SET_MESSAGE: %s\n", msg->msg); RARCH_LOG("Environ SET_MESSAGE: %s\n", msg->msg);
if (g_extern.msg_queue) if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, msg->msg, 1, msg->frames); msg_queue_push(g_extern.msg_queue, msg->msg, 1, msg->frames);
break; break;
@ -306,7 +306,7 @@ static bool environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SET_ROTATION: case RETRO_ENVIRONMENT_SET_ROTATION:
{ {
unsigned rotation = *(const unsigned*)data; unsigned rotation = *(const unsigned*)data;
SSNES_LOG("Environ SET_ROTATION: %u\n", rotation); RARCH_LOG("Environ SET_ROTATION: %u\n", rotation);
if (!g_settings.video.allow_rotate) if (!g_settings.video.allow_rotate)
break; break;
@ -323,7 +323,7 @@ static bool environment_cb(unsigned cmd, void *data)
} }
default: default:
SSNES_LOG("Environ UNSUPPORTED (#%u).\n", cmd); RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
return false; return false;
} }

90
file.c
View File

@ -52,12 +52,12 @@ ssize_t read_file(const char *path, void **buf)
rom_buf = malloc(len + 1); rom_buf = malloc(len + 1);
if (!rom_buf) if (!rom_buf)
{ {
SSNES_ERR("Couldn't allocate memory.\n"); RARCH_ERR("Couldn't allocate memory.\n");
goto error; goto error;
} }
if ((rc = fread(rom_buf, 1, len, file)) < (ssize_t)len) if ((rc = fread(rom_buf, 1, len, file)) < (ssize_t)len)
SSNES_WARN("Didn't read whole file.\n"); RARCH_WARN("Didn't read whole file.\n");
*buf = rom_buf; *buf = rom_buf;
// Allow for easy reading of strings to be safe. // Allow for easy reading of strings to be safe.
@ -134,7 +134,7 @@ static void patch_rom(uint8_t **buf, ssize_t *size)
if (g_extern.ups_pref + g_extern.bps_pref + g_extern.ips_pref > 1) if (g_extern.ups_pref + g_extern.bps_pref + g_extern.ips_pref > 1)
{ {
SSNES_WARN("Several patches are explicitly defined, ignoring all ...\n"); RARCH_WARN("Several patches are explicitly defined, ignoring all ...\n");
return; return;
} }
@ -162,28 +162,28 @@ static void patch_rom(uint8_t **buf, ssize_t *size)
} }
else else
{ {
SSNES_LOG("Did not find a valid ROM patch.\n"); RARCH_LOG("Did not find a valid ROM patch.\n");
return; return;
} }
SSNES_LOG("Found %s file in \"%s\", attempting to patch ...\n", patch_desc, patch_path); RARCH_LOG("Found %s file in \"%s\", attempting to patch ...\n", patch_desc, patch_path);
size_t target_size = ret_size * 4; // Just to be sure ... size_t target_size = ret_size * 4; // Just to be sure ...
uint8_t *patched_rom = (uint8_t*)malloc(target_size); uint8_t *patched_rom = (uint8_t*)malloc(target_size);
if (!patched_rom) if (!patched_rom)
{ {
SSNES_ERR("Failed to allocate memory for patched ROM ...\n"); RARCH_ERR("Failed to allocate memory for patched ROM ...\n");
goto error; goto error;
} }
err = func((const uint8_t*)patch_data, patch_size, ret_buf, ret_size, patched_rom, &target_size); err = func((const uint8_t*)patch_data, patch_size, ret_buf, ret_size, patched_rom, &target_size);
if (err == PATCH_SUCCESS) if (err == PATCH_SUCCESS)
{ {
SSNES_LOG("ROM patched successfully (%s).\n", patch_desc); RARCH_LOG("ROM patched successfully (%s).\n", patch_desc);
success = true; success = true;
} }
else else
SSNES_ERR("Failed to patch %s: Error #%u\n", patch_desc, (unsigned)err); RARCH_ERR("Failed to patch %s: Error #%u\n", patch_desc, (unsigned)err);
if (success) if (success)
{ {
@ -216,13 +216,13 @@ static ssize_t read_rom_file(FILE *file, void **buf)
setmode(0, O_BINARY); setmode(0, O_BINARY);
#endif #endif
SSNES_LOG("Reading ROM from stdin ...\n"); RARCH_LOG("Reading ROM from stdin ...\n");
size_t buf_size = 0xFFFFF; // Some initial guesstimate. size_t buf_size = 0xFFFFF; // Some initial guesstimate.
size_t buf_ptr = 0; size_t buf_ptr = 0;
uint8_t *rom_buf = (uint8_t*)malloc(buf_size); uint8_t *rom_buf = (uint8_t*)malloc(buf_size);
if (rom_buf == NULL) if (rom_buf == NULL)
{ {
SSNES_ERR("Couldn't allocate memory.\n"); RARCH_ERR("Couldn't allocate memory.\n");
return -1; return -1;
} }
@ -238,7 +238,7 @@ static ssize_t read_rom_file(FILE *file, void **buf)
rom_buf = (uint8_t*)realloc(rom_buf, buf_size * 2); rom_buf = (uint8_t*)realloc(rom_buf, buf_size * 2);
if (rom_buf == NULL) if (rom_buf == NULL)
{ {
SSNES_ERR("Couldn't allocate memory.\n"); RARCH_ERR("Couldn't allocate memory.\n");
return -1; return -1;
} }
@ -257,13 +257,13 @@ static ssize_t read_rom_file(FILE *file, void **buf)
void *rom_buf = malloc(ret); void *rom_buf = malloc(ret);
if (rom_buf == NULL) if (rom_buf == NULL)
{ {
SSNES_ERR("Couldn't allocate memory.\n"); RARCH_ERR("Couldn't allocate memory.\n");
return -1; return -1;
} }
if (fread(rom_buf, 1, ret, file) < (size_t)ret) if (fread(rom_buf, 1, ret, file) < (size_t)ret)
{ {
SSNES_ERR("Didn't read whole file.\n"); RARCH_ERR("Didn't read whole file.\n");
free(rom_buf); free(rom_buf);
return -1; return -1;
} }
@ -287,7 +287,7 @@ static ssize_t read_rom_file(FILE *file, void **buf)
g_extern.cart_crc = crc32_calculate(ret_buf, ret); g_extern.cart_crc = crc32_calculate(ret_buf, ret);
#ifdef HAVE_XML #ifdef HAVE_XML
sha256_hash(g_extern.sha256, ret_buf, ret); sha256_hash(g_extern.sha256, ret_buf, ret);
SSNES_LOG("SHA256 sum: %s\n", g_extern.sha256); RARCH_LOG("SHA256 sum: %s\n", g_extern.sha256);
#endif #endif
*buf = ret_buf; *buf = ret_buf;
return ret; return ret;
@ -359,19 +359,19 @@ static void dump_to_file_desperate(const void *data, size_t size, int type)
strlcat(path, ramtype2str(type), sizeof(path)); strlcat(path, ramtype2str(type), sizeof(path));
if (dump_to_file(path, data, size)) if (dump_to_file(path, data, size))
SSNES_WARN("Succeeded in saving RAM data to \"%s\". Phew ... :D\n", path); RARCH_WARN("Succeeded in saving RAM data to \"%s\". Phew ... :D\n", path);
else else
goto error; goto error;
return; return;
error: error:
SSNES_WARN("Failed ... Tough luck ... :(\n"); RARCH_WARN("Failed ... Tough luck ... :(\n");
} }
bool save_state(const char *path) bool save_state(const char *path)
{ {
SSNES_LOG("Saving state: \"%s\".\n", path); RARCH_LOG("Saving state: \"%s\".\n", path);
size_t size = pretro_serialize_size(); size_t size = pretro_serialize_size();
if (size == 0) if (size == 0)
return false; return false;
@ -379,17 +379,17 @@ bool save_state(const char *path)
void *data = malloc(size); void *data = malloc(size);
if (!data) if (!data)
{ {
SSNES_ERR("Failed to allocate memory for save state buffer.\n"); RARCH_ERR("Failed to allocate memory for save state buffer.\n");
return false; return false;
} }
SSNES_LOG("State size: %d bytes.\n", (int)size); RARCH_LOG("State size: %d bytes.\n", (int)size);
bool ret = pretro_serialize(data, size); bool ret = pretro_serialize(data, size);
if (ret) if (ret)
ret = dump_to_file(path, data, size); ret = dump_to_file(path, data, size);
if (!ret) if (!ret)
SSNES_ERR("Failed to save state to \"%s\".\n", path); RARCH_ERR("Failed to save state to \"%s\".\n", path);
free(data); free(data);
return ret; return ret;
@ -397,18 +397,18 @@ bool save_state(const char *path)
bool load_state(const char *path) bool load_state(const char *path)
{ {
SSNES_LOG("Loading state: \"%s\".\n", path); RARCH_LOG("Loading state: \"%s\".\n", path);
void *buf = NULL; void *buf = NULL;
ssize_t size = read_file(path, &buf); ssize_t size = read_file(path, &buf);
if (size < 0) if (size < 0)
{ {
SSNES_ERR("Failed to load state from \"%s\".\n", path); RARCH_ERR("Failed to load state from \"%s\".\n", path);
return false; return false;
} }
bool ret = true; bool ret = true;
SSNES_LOG("State size: %u bytes.\n", (unsigned)size); RARCH_LOG("State size: %u bytes.\n", (unsigned)size);
void *block_buf[2] = {NULL, NULL}; void *block_buf[2] = {NULL, NULL};
int block_type[2] = {-1, -1}; int block_type[2] = {-1, -1};
@ -416,26 +416,26 @@ bool load_state(const char *path)
if (g_settings.block_sram_overwrite) if (g_settings.block_sram_overwrite)
{ {
SSNES_LOG("Blocking SRAM overwrite.\n"); RARCH_LOG("Blocking SRAM overwrite.\n");
switch (g_extern.game_type) switch (g_extern.game_type)
{ {
case SSNES_CART_NORMAL: case RARCH_CART_NORMAL:
block_type[0] = RETRO_MEMORY_SAVE_RAM; block_type[0] = RETRO_MEMORY_SAVE_RAM;
block_type[1] = RETRO_MEMORY_RTC; block_type[1] = RETRO_MEMORY_RTC;
break; break;
case SSNES_CART_BSX: case RARCH_CART_BSX:
case SSNES_CART_BSX_SLOTTED: case RARCH_CART_BSX_SLOTTED:
block_type[0] = RETRO_MEMORY_SNES_BSX_RAM; block_type[0] = RETRO_MEMORY_SNES_BSX_RAM;
block_type[1] = RETRO_MEMORY_SNES_BSX_PRAM; block_type[1] = RETRO_MEMORY_SNES_BSX_PRAM;
break; break;
case SSNES_CART_SUFAMI: case RARCH_CART_SUFAMI:
block_type[0] = RETRO_MEMORY_SNES_SUFAMI_TURBO_A_RAM; block_type[0] = RETRO_MEMORY_SNES_SUFAMI_TURBO_A_RAM;
block_type[1] = RETRO_MEMORY_SNES_SUFAMI_TURBO_B_RAM; block_type[1] = RETRO_MEMORY_SNES_SUFAMI_TURBO_B_RAM;
break; break;
case SSNES_CART_SGB: case RARCH_CART_SGB:
block_type[0] = RETRO_MEMORY_SNES_GAME_BOY_RAM; block_type[0] = RETRO_MEMORY_SNES_GAME_BOY_RAM;
block_type[1] = RETRO_MEMORY_SNES_GAME_BOY_RTC; block_type[1] = RETRO_MEMORY_SNES_GAME_BOY_RTC;
break; break;
@ -507,8 +507,8 @@ void save_ram_file(const char *path, int type)
{ {
if (!dump_to_file(path, data, size)) if (!dump_to_file(path, data, size))
{ {
SSNES_ERR("Failed to save SRAM.\n"); RARCH_ERR("Failed to save SRAM.\n");
SSNES_WARN("Attempting to recover ...\n"); RARCH_WARN("Attempting to recover ...\n");
dump_to_file_desperate(data, size, type); dump_to_file_desperate(data, size, type);
} }
} }
@ -520,7 +520,7 @@ static char *load_xml_map(const char *path)
if (*path) if (*path)
{ {
if (read_file_string(path, &xml_buf)) if (read_file_string(path, &xml_buf))
SSNES_LOG("Found XML memory map in \"%s\"\n", path); RARCH_LOG("Found XML memory map in \"%s\"\n", path);
} }
return xml_buf; return xml_buf;
@ -546,25 +546,25 @@ static bool load_roms(unsigned rom_type, const char **rom_paths, size_t roms)
{ {
if ((rom_len[0] = read_rom_file(g_extern.rom_file, &rom_buf[0])) == -1) if ((rom_len[0] = read_rom_file(g_extern.rom_file, &rom_buf[0])) == -1)
{ {
SSNES_ERR("Could not read ROM file.\n"); RARCH_ERR("Could not read ROM file.\n");
return false; return false;
} }
if (g_extern.rom_file) if (g_extern.rom_file)
fclose(g_extern.rom_file); fclose(g_extern.rom_file);
SSNES_LOG("ROM size: %u bytes.\n", (unsigned)rom_len[0]); RARCH_LOG("ROM size: %u bytes.\n", (unsigned)rom_len[0]);
} }
else else
{ {
if (!g_extern.rom_file) if (!g_extern.rom_file)
{ {
SSNES_ERR("Implementation requires a full path to be set, cannot load ROM from stdin. Aborting ...\n"); RARCH_ERR("Implementation requires a full path to be set, cannot load ROM from stdin. Aborting ...\n");
return false; return false;
} }
fclose(g_extern.rom_file); fclose(g_extern.rom_file);
SSNES_LOG("ROM loading skipped. Implementation will load it on its own.\n"); RARCH_LOG("ROM loading skipped. Implementation will load it on its own.\n");
} }
char *xml_buf = load_xml_map(g_extern.xml_name); char *xml_buf = load_xml_map(g_extern.xml_name);
@ -580,7 +580,7 @@ static bool load_roms(unsigned rom_type, const char **rom_paths, size_t roms)
!g_extern.system.info.need_fullpath && !g_extern.system.info.need_fullpath &&
(rom_len[i] = read_file(rom_paths[i], &rom_buf[i])) == -1) (rom_len[i] = read_file(rom_paths[i], &rom_buf[i])) == -1)
{ {
SSNES_ERR("Could not read ROM file: \"%s\".\n", rom_paths[i]); RARCH_ERR("Could not read ROM file: \"%s\".\n", rom_paths[i]);
ret = false; ret = false;
goto end; goto end;
} }
@ -596,7 +596,7 @@ static bool load_roms(unsigned rom_type, const char **rom_paths, size_t roms)
ret = pretro_load_game_special(rom_type, info, roms); ret = pretro_load_game_special(rom_type, info, roms);
if (!ret) if (!ret)
SSNES_ERR("Failed to load game.\n"); RARCH_ERR("Failed to load game.\n");
end: end:
for (unsigned i = 0; i < MAX_ROMS; i++) for (unsigned i = 0; i < MAX_ROMS; i++)
@ -643,37 +643,37 @@ static bool load_sufami_rom(void)
return load_roms(RETRO_GAME_TYPE_SUFAMI_TURBO, path, 3); return load_roms(RETRO_GAME_TYPE_SUFAMI_TURBO, path, 3);
} }
bool init_rom_file(enum ssnes_game_type type) bool init_rom_file(enum rarch_game_type type)
{ {
switch (type) switch (type)
{ {
case SSNES_CART_SGB: case RARCH_CART_SGB:
if (!load_sgb_rom()) if (!load_sgb_rom())
return false; return false;
break; break;
case SSNES_CART_NORMAL: case RARCH_CART_NORMAL:
if (!load_normal_rom()) if (!load_normal_rom())
return false; return false;
break; break;
case SSNES_CART_BSX: case RARCH_CART_BSX:
if (!load_bsx_rom(false)) if (!load_bsx_rom(false))
return false; return false;
break; break;
case SSNES_CART_BSX_SLOTTED: case RARCH_CART_BSX_SLOTTED:
if (!load_bsx_rom(true)) if (!load_bsx_rom(true))
return false; return false;
break; break;
case SSNES_CART_SUFAMI: case RARCH_CART_SUFAMI:
if (!load_sufami_rom()) if (!load_sufami_rom())
return false; return false;
break; break;
default: default:
SSNES_ERR("Invalid ROM type.\n"); RARCH_ERR("Invalid ROM type.\n");
return false; return false;
} }

6
file.h
View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_FILE_H #ifndef __RARCH_FILE_H
#define __SSNES_FILE_H #define __RARCH_FILE_H
#include "boolean.h" #include "boolean.h"
#include <stdio.h> #include <stdio.h>
@ -38,7 +38,7 @@ bool save_state(const char *path);
void load_ram_file(const char *path, int type); void load_ram_file(const char *path, int type);
void save_ram_file(const char *path, int type); void save_ram_file(const char *path, int type);
bool init_rom_file(enum ssnes_game_type type); bool init_rom_file(enum rarch_game_type type);
// Returns a NULL-terminated list of files in a directory with full paths. // Returns a NULL-terminated list of files in a directory with full paths.
// If ext is NULL, any file will be picked. // If ext is NULL, any file will be picked.

View File

@ -141,7 +141,7 @@ char **dir_list_new(const char *dir, const char *ext)
return dir_list; return dir_list;
error: error:
SSNES_ERR("Failed to open directory: \"%s\"\n", dir); RARCH_ERR("Failed to open directory: \"%s\"\n", dir);
#ifdef _WIN32 #ifdef _WIN32
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
FindClose(hFind); FindClose(hFind);
@ -203,24 +203,24 @@ void fill_pathname(char *out_path, const char *in_path, const char *replace, siz
{ {
char tmp_path[PATH_MAX]; char tmp_path[PATH_MAX];
ssnes_assert(strlcpy(tmp_path, in_path, sizeof(tmp_path)) < sizeof(tmp_path)); rarch_assert(strlcpy(tmp_path, in_path, sizeof(tmp_path)) < sizeof(tmp_path));
char *tok = strrchr(tmp_path, '.'); char *tok = strrchr(tmp_path, '.');
if (tok) if (tok)
*tok = '\0'; *tok = '\0';
ssnes_assert(strlcpy(out_path, tmp_path, size) < size); rarch_assert(strlcpy(out_path, tmp_path, size) < size);
ssnes_assert(strlcat(out_path, replace, size) < size); rarch_assert(strlcat(out_path, replace, size) < size);
} }
void fill_pathname_noext(char *out_path, const char *in_path, const char *replace, size_t size) void fill_pathname_noext(char *out_path, const char *in_path, const char *replace, size_t size)
{ {
ssnes_assert(strlcpy(out_path, in_path, size) < size); rarch_assert(strlcpy(out_path, in_path, size) < size);
ssnes_assert(strlcat(out_path, replace, size) < size); rarch_assert(strlcat(out_path, replace, size) < size);
} }
void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replace, size_t size) void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replace, size_t size)
{ {
ssnes_assert(strlcat(in_dir, "/", size) < size); rarch_assert(strlcat(in_dir, "/", size) < size);
const char *base = strrchr(in_basename, '/'); const char *base = strrchr(in_basename, '/');
if (!base) if (!base)
@ -231,8 +231,8 @@ void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replac
else else
base = in_basename; base = in_basename;
ssnes_assert(strlcat(in_dir, base, size) < size); rarch_assert(strlcat(in_dir, base, size) < size);
ssnes_assert(strlcat(in_dir, replace, size) < size); rarch_assert(strlcat(in_dir, replace, size) < size);
} }
void fill_pathname_base(char *out_dir, const char *in_path, size_t size) void fill_pathname_base(char *out_dir, const char *in_path, size_t size)
@ -246,6 +246,6 @@ void fill_pathname_base(char *out_dir, const char *in_path, size_t size)
else else
ptr = in_path; ptr = in_path;
ssnes_assert(strlcpy(out_dir, ptr, size) < size); rarch_assert(strlcpy(out_dir, ptr, size) < size);
} }

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_GENERAL_H #ifndef __RARCH_GENERAL_H
#define __SSNES_GENERAL_H #define __RARCH_GENERAL_H
#include "boolean.h" #include "boolean.h"
#include <stdio.h> #include <stdio.h>
@ -30,7 +30,7 @@
#include "autosave.h" #include "autosave.h"
#include "dynamic.h" #include "dynamic.h"
#include "cheats.h" #include "cheats.h"
#include "audio/ext/ssnes_dsp.h" #include "audio/ext/rarch_dsp.h"
#include "compat/strl.h" #include "compat/strl.h"
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
@ -70,12 +70,12 @@
#define MAX_PLAYERS 8 #define MAX_PLAYERS 8
enum ssnes_shader_type enum rarch_shader_type
{ {
SSNES_SHADER_CG, RARCH_SHADER_CG,
SSNES_SHADER_BSNES, RARCH_SHADER_BSNES,
SSNES_SHADER_AUTO, RARCH_SHADER_AUTO,
SSNES_SHADER_NONE RARCH_SHADER_NONE
}; };
// All config related settings go here. // All config related settings go here.
@ -98,7 +98,7 @@ struct settings
char cg_shader_path[PATH_MAX]; char cg_shader_path[PATH_MAX];
char bsnes_shader_path[PATH_MAX]; char bsnes_shader_path[PATH_MAX];
char filter_path[PATH_MAX]; char filter_path[PATH_MAX];
enum ssnes_shader_type shader_type; enum rarch_shader_type shader_type;
float refresh_rate; float refresh_rate;
bool render_to_texture; bool render_to_texture;
@ -150,10 +150,10 @@ struct settings
struct struct
{ {
char driver[32]; char driver[32];
struct snes_keybind binds[MAX_PLAYERS][SSNES_BIND_LIST_END]; struct snes_keybind binds[MAX_PLAYERS][RARCH_BIND_LIST_END];
float axis_threshold; float axis_threshold;
int joypad_map[MAX_PLAYERS]; int joypad_map[MAX_PLAYERS];
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
unsigned dpad_emulation[MAX_PLAYERS]; unsigned dpad_emulation[MAX_PLAYERS];
#endif #endif
bool netplay_client_swap_input; bool netplay_client_swap_input;
@ -179,7 +179,7 @@ struct settings
}; };
// Settings and/or global state that is specific to a console-style implementation. // Settings and/or global state that is specific to a console-style implementation.
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
struct console_settings struct console_settings
{ {
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
@ -190,7 +190,7 @@ struct console_settings
bool default_savestate_dir_enable; bool default_savestate_dir_enable;
bool frame_advance_enable; bool frame_advance_enable;
bool gamma_correction_enable; bool gamma_correction_enable;
bool initialize_ssnes_enable; bool initialize_rarch_enable;
bool ingame_menu_enable; bool ingame_menu_enable;
bool menu_enable; bool menu_enable;
bool overscan_enable; bool overscan_enable;
@ -236,13 +236,13 @@ struct console_settings
}; };
#endif #endif
enum ssnes_game_type enum rarch_game_type
{ {
SSNES_CART_NORMAL = 0, RARCH_CART_NORMAL = 0,
SSNES_CART_SGB, RARCH_CART_SGB,
SSNES_CART_BSX, RARCH_CART_BSX,
SSNES_CART_BSX_SLOTTED, RARCH_CART_BSX_SLOTTED,
SSNES_CART_SUFAMI RARCH_CART_SUFAMI
}; };
// All run-time- / command line flag-related globals go here. // All run-time- / command line flag-related globals go here.
@ -261,7 +261,7 @@ struct global
bool disconnect_device[2]; bool disconnect_device[2];
FILE *rom_file; FILE *rom_file;
enum ssnes_game_type game_type; enum rarch_game_type game_type;
uint32_t cart_crc; uint32_t cart_crc;
char gb_rom_path[PATH_MAX]; char gb_rom_path[PATH_MAX];
@ -307,7 +307,7 @@ struct global
struct struct
{ {
ssnes_resampler_t *source; rarch_resampler_t *source;
float *data; float *data;
size_t data_ptr; size_t data_ptr;
@ -328,7 +328,7 @@ struct global
size_t rewind_size; size_t rewind_size;
dylib_t dsp_lib; dylib_t dsp_lib;
const ssnes_dsp_plugin_t *dsp_plugin; const rarch_dsp_plugin_t *dsp_plugin;
void *dsp_handle; void *dsp_handle;
bool rate_control; bool rate_control;
@ -446,48 +446,48 @@ bool config_read_keybinds(const char *path);
bool config_save_keybinds(const char *path); bool config_save_keybinds(const char *path);
#endif #endif
void ssnes_game_reset(void); void rarch_game_reset(void);
void ssnes_main_clear_state(void); void rarch_main_clear_state(void);
int ssnes_main_init(int argc, char *argv[]); int rarch_main_init(int argc, char *argv[]);
bool ssnes_main_iterate(void); bool rarch_main_iterate(void);
void ssnes_main_deinit(void); void rarch_main_deinit(void);
void ssnes_render_cached_frame(void); void rarch_render_cached_frame(void);
void ssnes_load_state(void); void rarch_load_state(void);
void ssnes_save_state(void); void rarch_save_state(void);
void ssnes_state_slot_increase(void); void rarch_state_slot_increase(void);
void ssnes_state_slot_decrease(void); void rarch_state_slot_decrease(void);
///////// /////////
// Public data structures // Public data structures
extern struct settings g_settings; extern struct settings g_settings;
extern struct global g_extern; extern struct global g_extern;
#ifdef SSNES_CONSOLE #ifdef RARCH_CONSOLE
extern struct console_settings g_console; extern struct console_settings g_console;
#endif #endif
///////// /////////
#if defined(SSNES_CONSOLE) && (defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)) #if defined(RARCH_CONSOLE) && (defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER))
#include "logger_override.h" #include "logger_override.h"
#else #else
#ifndef SSNES_LOG #ifndef RARCH_LOG
#define SSNES_LOG(...) do { \ #define RARCH_LOG(...) do { \
if (g_extern.verbose) \ if (g_extern.verbose) \
fprintf(stderr, "SSNES: " __VA_ARGS__); \ fprintf(stderr, "SSNES: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
#endif #endif
#ifndef SSNES_ERR #ifndef RARCH_ERR
#define SSNES_ERR(...) do { \ #define RARCH_ERR(...) do { \
fprintf(stderr, "RetroArch [ERROR] :: " __VA_ARGS__); \ fprintf(stderr, "RetroArch [ERROR] :: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
#endif #endif
#ifndef SSNES_WARN #ifndef RARCH_WARN
#define SSNES_WARN(...) do { \ #define RARCH_WARN(...) do { \
fprintf(stderr, "RetroArch [WARN] :: " __VA_ARGS__); \ fprintf(stderr, "RetroArch [WARN] :: " __VA_ARGS__); \
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
@ -502,7 +502,7 @@ extern struct console_settings g_console;
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#endif #endif
#define SSNES_SCALE_BASE 256 #define RARCH_SCALE_BASE 256
static inline uint32_t next_pow2(uint32_t v) static inline uint32_t next_pow2(uint32_t v)
{ {
@ -564,7 +564,7 @@ static inline uint16_t swap_if_little16(uint16_t val)
#include <unistd.h> #include <unistd.h>
#endif #endif
static inline void ssnes_sleep(unsigned msec) static inline void rarch_sleep(unsigned msec)
{ {
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
sys_timer_usleep(1000 * msec); sys_timer_usleep(1000 * msec);
@ -582,14 +582,14 @@ static inline void ssnes_sleep(unsigned msec)
#endif #endif
} }
#define ssnes_assert(cond) \ #define rarch_assert(cond) \
if (!(cond)) { SSNES_ERR("Assertion failed at %s:%d.\n", __FILE__, __LINE__); exit(2); } if (!(cond)) { RARCH_ERR("Assertion failed at %s:%d.\n", __FILE__, __LINE__); exit(2); }
static inline void ssnes_fail(int error_code, const char *error) static inline void rarch_fail(int error_code, const char *error)
{ {
// We cannot longjmp unless we're in ssnes_main_init(). // We cannot longjmp unless we're in rarch_main_init().
// If not, something went very wrong, and we should just exit right away. // If not, something went very wrong, and we should just exit right away.
ssnes_assert(g_extern.error_in_init); rarch_assert(g_extern.error_in_init);
strlcpy(g_extern.error_string, error, sizeof(g_extern.error_string)); strlcpy(g_extern.error_string, error, sizeof(g_extern.error_string));
longjmp(g_extern.error_sjlj_context, error_code); longjmp(g_extern.error_sjlj_context, error_code);

View File

@ -3,8 +3,8 @@
// //
// //
#ifndef __SSNES_VIDEO_DRIVER_H #ifndef __RARCH_VIDEO_DRIVER_H
#define __SSNES_VIDEO_DRIVER_H #define __RARCH_VIDEO_DRIVER_H
#include <stddef.h> #include <stddef.h>
@ -13,42 +13,42 @@ extern "C" {
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifdef SSNES_DLL_IMPORT #ifdef RARCH_DLL_IMPORT
#define SSNES_API_EXPORT __declspec(dllimport) #define RARCH_API_EXPORT __declspec(dllimport)
#else #else
#define SSNES_API_EXPORT __declspec(dllexport) #define RARCH_API_EXPORT __declspec(dllexport)
#endif #endif
#define SSNES_API_CALLTYPE __cdecl #define RARCH_API_CALLTYPE __cdecl
#else #else
#define SSNES_API_EXPORT #define RARCH_API_EXPORT
#define SSNES_API_CALLTYPE #define RARCH_API_CALLTYPE
#endif #endif
#define SSNES_GRAPHICS_API_VERSION 2 #define RARCH_GRAPHICS_API_VERSION 2
// Since we don't want to rely on C++ or C99 for a proper boolean type, // Since we don't want to rely on C++ or C99 for a proper boolean type,
// make sure return semantics are perfectly clear ... ;) // make sure return semantics are perfectly clear ... ;)
#ifndef SSNES_OK #ifndef RARCH_OK
#define SSNES_OK 1 #define RARCH_OK 1
#endif #endif
#ifndef SSNES_ERROR #ifndef RARCH_ERROR
#define SSNES_ERROR 0 #define RARCH_ERROR 0
#endif #endif
#ifndef SSNES_TRUE #ifndef RARCH_TRUE
#define SSNES_TRUE 1 #define RARCH_TRUE 1
#endif #endif
#ifndef SSNES_FALSE #ifndef RARCH_FALSE
#define SSNES_FALSE 0 #define RARCH_FALSE 0
#endif #endif
#define SSNES_COLOR_FORMAT_XRGB1555 0 #define RARCH_COLOR_FORMAT_XRGB1555 0
#define SSNES_COLOR_FORMAT_ARGB8888 1 #define RARCH_COLOR_FORMAT_ARGB8888 1
#define SSNES_INPUT_SCALE_BASE 256 #define RARCH_INPUT_SCALE_BASE 256
typedef struct py_state py_state_t; typedef struct py_state py_state_t;
@ -65,7 +65,7 @@ typedef float (*python_state_get_cb)(py_state_t *handle, const char *id, unsigne
// Frees the runtime. // Frees the runtime.
typedef void (*python_state_free_cb)(py_state_t *handle); typedef void (*python_state_free_cb)(py_state_t *handle);
typedef struct ssnes_video_info typedef struct rarch_video_info
{ {
// Width of window. // Width of window.
// If fullscreen mode is requested, // If fullscreen mode is requested,
@ -98,7 +98,7 @@ typedef struct ssnes_video_info
// input_scale defines the maximum size of the picture that will // input_scale defines the maximum size of the picture that will
// ever be used with the frame callback. // ever be used with the frame callback.
// The maximum resolution is a multiple of 256x256 size (SSNES_INPUT_SCALE_BASE), // The maximum resolution is a multiple of 256x256 size (RARCH_INPUT_SCALE_BASE),
// so an input scale of 2 // so an input scale of 2
// means you should allocate a texture or of 512x512. // means you should allocate a texture or of 512x512.
unsigned input_scale; unsigned input_scale;
@ -135,40 +135,40 @@ typedef struct ssnes_video_info
python_state_new_cb python_state_new; python_state_new_cb python_state_new;
python_state_get_cb python_state_get; python_state_get_cb python_state_get;
python_state_free_cb python_state_free; python_state_free_cb python_state_free;
} ssnes_video_info_t; } rarch_video_info_t;
// Some convenience macros. // Some convenience macros.
// Extract which axes to test for in negative or positive direction. // Extract which axes to test for in negative or positive direction.
// May be equal to SSNES_NO_AXIS, which means testing should not occur. // May be equal to RARCH_NO_AXIS, which means testing should not occur.
#define SSNES_AXIS_NEG_GET(x) (((unsigned)(x) >> 16) & 0xFFFFU) #define RARCH_AXIS_NEG_GET(x) (((unsigned)(x) >> 16) & 0xFFFFU)
#define SSNES_AXIS_POS_GET(x) ((unsigned)(x) & 0xFFFFU) #define RARCH_AXIS_POS_GET(x) ((unsigned)(x) & 0xFFFFU)
// I hope no joypad will ever have this many buttons or axes ... ;) // I hope no joypad will ever have this many buttons or axes ... ;)
// If joykey is this value, do not check that button. // If joykey is this value, do not check that button.
#define SSNES_NO_AXIS (0xFFFFFFFFU) #define RARCH_NO_AXIS (0xFFFFFFFFU)
#define SSNES_NO_BTN ((unsigned short)0xFFFFU) #define RARCH_NO_BTN ((unsigned short)0xFFFFU)
// Masks to test on joykey which hat direction is to be tested for. // Masks to test on joykey which hat direction is to be tested for.
#define SSNES_HAT_UP_MASK (1 << 15) #define RARCH_HAT_UP_MASK (1 << 15)
#define SSNES_HAT_DOWN_MASK (1 << 14) #define RARCH_HAT_DOWN_MASK (1 << 14)
#define SSNES_HAT_LEFT_MASK (1 << 13) #define RARCH_HAT_LEFT_MASK (1 << 13)
#define SSNES_HAT_RIGHT_MASK (1 << 12) #define RARCH_HAT_RIGHT_MASK (1 << 12)
#define SSNES_HAT_MAP(x, hat) ((x & ((1 << 12) - 1)) | hat) #define RARCH_HAT_MAP(x, hat) ((x & ((1 << 12) - 1)) | hat)
#define SSNES_HAT_MASK (SSNES_HAT_UP_MASK | SSNES_HAT_DOWN_MASK | \ #define RARCH_HAT_MASK (RARCH_HAT_UP_MASK | RARCH_HAT_DOWN_MASK | \
SSNES_HAT_LEFT_MASK | SSNES_HAT_RIGHT_MASK) RARCH_HAT_LEFT_MASK | RARCH_HAT_RIGHT_MASK)
// Test this on the joykey. If true, we want to test for a joypad hat // Test this on the joykey. If true, we want to test for a joypad hat
// rather than a button. // rather than a button.
#define SSNES_GET_HAT_DIR(x) (x & SSNES_HAT_MASK) #define RARCH_GET_HAT_DIR(x) (x & RARCH_HAT_MASK)
// Gets the joypad hat to be tested for. // Gets the joypad hat to be tested for.
// Only valid when SSNES_GET_HAT_DIR() returns true. // Only valid when RARCH_GET_HAT_DIR() returns true.
#define SSNES_GET_HAT(x) (x & (~SSNES_HAT_MASK)) #define RARCH_GET_HAT(x) (x & (~RARCH_HAT_MASK))
// key, joykey and joyaxis are all checked at the same time. // key, joykey and joyaxis are all checked at the same time.
// If any one of these are pressed, return 1 in state callback. // If any one of these are pressed, return 1 in state callback.
struct ssnes_keybind struct rarch_keybind
{ {
// If analog_x is true, we request an analog device to be polled // If analog_x is true, we request an analog device to be polled
// rather than normal keys. // rather than normal keys.
@ -193,7 +193,7 @@ struct ssnes_keybind
unsigned joyaxis; unsigned joyaxis;
}; };
typedef struct ssnes_input_driver typedef struct rarch_input_driver
{ {
// Inits input driver. // Inits input driver.
// Joypad index denotes which joypads are desired for the various players. // Joypad index denotes which joypads are desired for the various players.
@ -213,7 +213,7 @@ typedef struct ssnes_input_driver
// Players are 1 - 5. // Players are 1 - 5.
// For digital inputs, pressed key is 1, not pressed key is 0. // For digital inputs, pressed key is 1, not pressed key is 0.
// Analog values have same range as a signed 16-bit integer. // Analog values have same range as a signed 16-bit integer.
int (*input_state)(void *data, const struct ssnes_keybind *bind, int (*input_state)(void *data, const struct rarch_keybind *bind,
unsigned player); unsigned player);
// Frees the input struct. // Frees the input struct.
@ -221,9 +221,9 @@ typedef struct ssnes_input_driver
// Human readable indentification string. // Human readable indentification string.
const char *ident; const char *ident;
} ssnes_input_driver_t; } rarch_input_driver_t;
typedef struct ssnes_video_driver typedef struct rarch_video_driver
{ {
// Inits the video driver. Returns an opaque handle pointer to the driver. // Inits the video driver. Returns an opaque handle pointer to the driver.
// Returns NULL on error. // Returns NULL on error.
@ -231,12 +231,12 @@ typedef struct ssnes_video_driver
// Should the video driver request that a certain input driver is used, // Should the video driver request that a certain input driver is used,
// it is possible to set the driver to *input. // it is possible to set the driver to *input.
// If no certain driver is desired, set *input to NULL. // If no certain driver is desired, set *input to NULL.
void *(*init)(const ssnes_video_info_t *video, void *(*init)(const rarch_video_info_t *video,
const ssnes_input_driver_t **input); const rarch_input_driver_t **input);
// Updates frame on the screen. // Updates frame on the screen.
// Frame can be either XRGB1555 or ARGB32 format // Frame can be either XRGB1555 or ARGB32 format
// depending on rgb32 setting in ssnes_video_info_t. // depending on rgb32 setting in rarch_video_info_t.
// Pitch is the distance in bytes between two scanlines in memory. // Pitch is the distance in bytes between two scanlines in memory.
// //
// When msg is non-NULL, // When msg is non-NULL,
@ -261,15 +261,15 @@ typedef struct ssnes_video_driver
// A human-readable identification of the video driver. // A human-readable identification of the video driver.
const char *ident; const char *ident;
// Needs to be defined to SSNES_GRAPHICS_API_VERSION. // Needs to be defined to RARCH_GRAPHICS_API_VERSION.
// This is used to detect API/ABI mismatches. // This is used to detect API/ABI mismatches.
int api_version; int api_version;
} ssnes_video_driver_t; } rarch_video_driver_t;
// Called by RetroArch on startup to get a driver handle. // Called by RetroArch on startup to get a driver handle.
// This is NOT dynamically allocated. // This is NOT dynamically allocated.
SSNES_API_EXPORT const ssnes_video_driver_t* SSNES_API_CALLTYPE RARCH_API_EXPORT const rarch_video_driver_t* RARCH_API_CALLTYPE
ssnes_video_init(void); rarch_video_init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -15,8 +15,8 @@
// Loader for external API plugins. // Loader for external API plugins.
#define SSNES_DLL_IMPORT #define RARCH_DLL_IMPORT
#include "ext/ssnes_video.h" #include "ext/rarch_video.h"
#include "../boolean.h" #include "../boolean.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -42,7 +42,7 @@ static dylib_t g_lib = NULL;
typedef struct typedef struct
{ {
const ssnes_input_driver_t *driver; const rarch_input_driver_t *driver;
void *handle; void *handle;
} input_ext_t; } input_ext_t;
@ -64,16 +64,16 @@ static int16_t input_ext_input_state(void *data, const struct snes_keybind **sne
unsigned player = port + 1; unsigned player = port + 1;
if (id < SSNES_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
const struct snes_keybind *ssnes_bind = &snes_keybinds[player - 1][id]; const struct snes_keybind *rarch_bind = &snes_keybinds[player - 1][id];
if (!ssnes_bind->valid) if (!rarch_bind->valid)
return 0; return 0;
struct ssnes_keybind bind = {0}; struct rarch_keybind bind = {0};
bind.key = ssnes_bind->key; bind.key = rarch_bind->key;
bind.joykey = ssnes_bind->joykey; bind.joykey = rarch_bind->joykey;
bind.joyaxis = ssnes_bind->joyaxis; bind.joyaxis = rarch_bind->joyaxis;
return ext->driver->input_state(ext->handle, &bind, player); return ext->driver->input_state(ext->handle, &bind, player);
} }
@ -85,16 +85,16 @@ static bool input_ext_key_pressed(void *data, int key)
{ {
input_ext_t *ext = (input_ext_t*)data; input_ext_t *ext = (input_ext_t*)data;
if (key >= 0 && key < SSNES_BIND_LIST_END) if (key >= 0 && key < RARCH_BIND_LIST_END)
{ {
const struct snes_keybind *ssnes_bind = &g_settings.input.binds[0][key]; const struct snes_keybind *rarch_bind = &g_settings.input.binds[0][key];
if (!ssnes_bind->valid) if (!rarch_bind->valid)
return false; return false;
struct ssnes_keybind bind = {0}; struct rarch_keybind bind = {0};
bind.key = ssnes_bind->key; bind.key = rarch_bind->key;
bind.joykey = ssnes_bind->joykey; bind.joykey = rarch_bind->joykey;
bind.joyaxis = ssnes_bind->joyaxis; bind.joyaxis = rarch_bind->joyaxis;
return ext->driver->input_state(ext->handle, &bind, 1); return ext->driver->input_state(ext->handle, &bind, 1);
} }
@ -134,7 +134,7 @@ static const input_driver_t input_ext = {
//////////// Video hook //////////// Video hook
typedef struct typedef struct
{ {
const ssnes_video_driver_t *driver; const rarch_video_driver_t *driver;
void *handle; void *handle;
} ext_t; } ext_t;
@ -182,7 +182,7 @@ static bool video_ext_frame(void *data, const void *frame, unsigned width, unsig
return ext->driver->frame(ext->handle, frame, width, height, pitch, msg); return ext->driver->frame(ext->handle, frame, width, height, pitch, msg);
} }
static void *setup_input(ext_t *ext, const ssnes_input_driver_t *driver) static void *setup_input(ext_t *ext, const rarch_input_driver_t *driver)
{ {
// TODO: Change external API to allow more players. To be done in next major ABI break. // TODO: Change external API to allow more players. To be done in next major ABI break.
int joypad_index[5]; int joypad_index[5];
@ -205,21 +205,21 @@ static void *setup_input(ext_t *ext, const ssnes_input_driver_t *driver)
static bool setup_video(ext_t *ext, const video_info_t *video, const input_driver_t **input, void **input_data) static bool setup_video(ext_t *ext, const video_info_t *video, const input_driver_t **input, void **input_data)
{ {
SSNES_LOG("Loaded driver: \"%s\"\n", ext->driver->ident ? ext->driver->ident : "Unknown"); RARCH_LOG("Loaded driver: \"%s\"\n", ext->driver->ident ? ext->driver->ident : "Unknown");
if (SSNES_GRAPHICS_API_VERSION != ext->driver->api_version) if (RARCH_GRAPHICS_API_VERSION != ext->driver->api_version)
{ {
SSNES_ERR("API version mismatch detected.\n"); RARCH_ERR("API version mismatch detected.\n");
SSNES_ERR("Required API version: %d, Library version: %d\n", SSNES_GRAPHICS_API_VERSION, ext->driver->api_version); RARCH_ERR("Required API version: %d, Library version: %d\n", RARCH_GRAPHICS_API_VERSION, ext->driver->api_version);
return false; return false;
} }
const char *cg_shader = NULL; const char *cg_shader = NULL;
const char *xml_shader = NULL; const char *xml_shader = NULL;
enum ssnes_shader_type type = g_settings.video.shader_type; enum rarch_shader_type type = g_settings.video.shader_type;
if ((type == SSNES_SHADER_CG || type == SSNES_SHADER_AUTO) && *g_settings.video.cg_shader_path) if ((type == RARCH_SHADER_CG || type == RARCH_SHADER_AUTO) && *g_settings.video.cg_shader_path)
cg_shader = g_settings.video.cg_shader_path; cg_shader = g_settings.video.cg_shader_path;
else if ((type == SSNES_SHADER_BSNES || type == SSNES_SHADER_AUTO) && *g_settings.video.bsnes_shader_path) else if ((type == RARCH_SHADER_BSNES || type == RARCH_SHADER_AUTO) && *g_settings.video.bsnes_shader_path)
xml_shader = g_settings.video.bsnes_shader_path; xml_shader = g_settings.video.bsnes_shader_path;
int font_color_r = g_settings.video.msg_color_r * 255; int font_color_r = g_settings.video.msg_color_r * 255;
@ -247,7 +247,7 @@ static bool setup_video(ext_t *ext, const video_info_t *video, const input_drive
gfx_window_title_reset(); gfx_window_title_reset();
gfx_window_title(title_buf, sizeof(title_buf)); gfx_window_title(title_buf, sizeof(title_buf));
ssnes_video_info_t info = {0}; rarch_video_info_t info = {0};
info.width = video->width; info.width = video->width;
info.height = video->height; info.height = video->height;
info.fullscreen = video->fullscreen; info.fullscreen = video->fullscreen;
@ -256,7 +256,7 @@ static bool setup_video(ext_t *ext, const video_info_t *video, const input_drive
info.aspect_ratio = g_settings.video.aspect_ratio; info.aspect_ratio = g_settings.video.aspect_ratio;
info.smooth = video->smooth; info.smooth = video->smooth;
info.input_scale = video->input_scale; info.input_scale = video->input_scale;
info.color_format = video->rgb32 ? SSNES_COLOR_FORMAT_ARGB8888 : SSNES_COLOR_FORMAT_XRGB1555; info.color_format = video->rgb32 ? RARCH_COLOR_FORMAT_ARGB8888 : RARCH_COLOR_FORMAT_XRGB1555;
info.xml_shader = xml_shader; info.xml_shader = xml_shader;
info.cg_shader = cg_shader; info.cg_shader = cg_shader;
info.ttf_font = font; info.ttf_font = font;
@ -270,7 +270,7 @@ static bool setup_video(ext_t *ext, const video_info_t *video, const input_drive
info.python_state_free = py_state_free; info.python_state_free = py_state_free;
#endif #endif
const ssnes_input_driver_t *input_driver = NULL; const rarch_input_driver_t *input_driver = NULL;
ext->handle = ext->driver->init(&info, &input_driver); ext->handle = ext->driver->init(&info, &input_driver);
if (!ext->handle) if (!ext->handle)
return false; return false;
@ -290,38 +290,38 @@ static void *video_ext_init(const video_info_t *video, const input_driver_t **in
if (!ext) if (!ext)
return NULL; return NULL;
const ssnes_video_driver_t *(*video_init)(void) = NULL; const rarch_video_driver_t *(*video_init)(void) = NULL;
if (!(*g_settings.video.external_driver)) if (!(*g_settings.video.external_driver))
{ {
SSNES_ERR("External driver needs video_external_driver path to be set.\n"); RARCH_ERR("External driver needs video_external_driver path to be set.\n");
goto error; goto error;
} }
g_lib = dylib_load(g_settings.video.external_driver); g_lib = dylib_load(g_settings.video.external_driver);
if (!g_lib) if (!g_lib)
{ {
SSNES_ERR("Failed to open library: \"%s\"\n", g_settings.video.external_driver); RARCH_ERR("Failed to open library: \"%s\"\n", g_settings.video.external_driver);
goto error; goto error;
} }
video_init = (const ssnes_video_driver_t *(*)(void))dylib_proc(g_lib, "ssnes_video_init"); video_init = (const rarch_video_driver_t *(*)(void))dylib_proc(g_lib, "rarch_video_init");
if (!video_init) if (!video_init)
{ {
SSNES_ERR("Couldn't find function ssnes_video_init in library ...\n"); RARCH_ERR("Couldn't find function rarch_video_init in library ...\n");
goto error; goto error;
} }
ext->driver = video_init(); ext->driver = video_init();
if (!ext->driver) if (!ext->driver)
{ {
SSNES_ERR("External driver returned invalid driver handle.\n"); RARCH_ERR("External driver returned invalid driver handle.\n");
goto error; goto error;
} }
if (!setup_video(ext, video, input, input_data)) if (!setup_video(ext, video, input, input_data))
{ {
SSNES_ERR("Failed to start driver.\n"); RARCH_ERR("Failed to start driver.\n");
goto error; goto error;
} }

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_FONTS_H #ifndef __RARCH_FONTS_H
#define __SSNES_FONTS_H #define __RARCH_FONTS_H
#include <stdint.h> #include <stdint.h>

View File

@ -109,7 +109,7 @@ void gfx_set_dwm(void)
dwmlib = dylib_load("dwmapi.dll"); dwmlib = dylib_load("dwmapi.dll");
if (!dwmlib) if (!dwmlib)
{ {
SSNES_LOG("Did not find dwmapi.dll.\n"); RARCH_LOG("Did not find dwmapi.dll.\n");
return; return;
} }
atexit(gfx_dwm_shutdown); atexit(gfx_dwm_shutdown);
@ -117,7 +117,7 @@ void gfx_set_dwm(void)
HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
if (mmcss) if (mmcss)
{ {
SSNES_LOG("Setting multimedia scheduling for DWM.\n"); RARCH_LOG("Setting multimedia scheduling for DWM.\n");
mmcss(TRUE); mmcss(TRUE);
} }
@ -127,13 +127,13 @@ void gfx_set_dwm(void)
HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition"); HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition");
if (!composition_enable) if (!composition_enable)
{ {
SSNES_ERR("Did not find DwmEnableComposition ...\n"); RARCH_ERR("Did not find DwmEnableComposition ...\n");
return; return;
} }
HRESULT ret = composition_enable(0); HRESULT ret = composition_enable(0);
if (FAILED(ret)) if (FAILED(ret))
SSNES_ERR("Failed to set composition state ...\n"); RARCH_ERR("Failed to set composition state ...\n");
} }
#endif #endif

View File

@ -35,7 +35,7 @@
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
#include "SDL.h" #include "SDL.h"
#include "SDL_opengl.h" #include "SDL_opengl.h"
#include "../input/ssnes_sdl_input.h" #include "../input/rarch_sdl_input.h"
#ifdef HAVE_CG #ifdef HAVE_CG
#include "shader_cg.h" #include "shader_cg.h"
@ -196,10 +196,10 @@ static bool gl_shader_init(void)
{ {
switch (g_settings.video.shader_type) switch (g_settings.video.shader_type)
{ {
case SSNES_SHADER_AUTO: case RARCH_SHADER_AUTO:
{ {
if (*g_settings.video.cg_shader_path && *g_settings.video.bsnes_shader_path) if (*g_settings.video.cg_shader_path && *g_settings.video.bsnes_shader_path)
SSNES_WARN("Both Cg and bSNES XML shader are defined in config file. Cg shader will be selected by default.\n"); RARCH_WARN("Both Cg and bSNES XML shader are defined in config file. Cg shader will be selected by default.\n");
#ifdef HAVE_CG #ifdef HAVE_CG
if (*g_settings.video.cg_shader_path) if (*g_settings.video.cg_shader_path)
@ -214,7 +214,7 @@ static bool gl_shader_init(void)
} }
#ifdef HAVE_CG #ifdef HAVE_CG
case SSNES_SHADER_CG: case RARCH_SHADER_CG:
{ {
return gl_cg_init(g_settings.video.cg_shader_path); return gl_cg_init(g_settings.video.cg_shader_path);
break; break;
@ -222,7 +222,7 @@ static bool gl_shader_init(void)
#endif #endif
#ifdef HAVE_XML #ifdef HAVE_XML
case SSNES_SHADER_BSNES: case RARCH_SHADER_BSNES:
{ {
return gl_glsl_init(g_settings.video.bsnes_shader_path); return gl_glsl_init(g_settings.video.bsnes_shader_path);
break; break;
@ -369,10 +369,10 @@ static inline void gl_init_font(gl_t *gl, const char *font_path, unsigned font_s
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
} }
else else
SSNES_WARN("Couldn't init font renderer with font \"%s\"...\n", font_path); RARCH_WARN("Couldn't init font renderer with font \"%s\"...\n", font_path);
} }
else else
SSNES_LOG("Did not find default font.\n"); RARCH_LOG("Did not find default font.\n");
for (unsigned i = 0; i < 4; i++) for (unsigned i = 0; i < 4; i++)
{ {
@ -444,7 +444,7 @@ static bool gl_create_fbo_targets(gl_t *gl)
error: error:
pglDeleteFramebuffers(gl->fbo_pass, gl->fbo); pglDeleteFramebuffers(gl->fbo_pass, gl->fbo);
SSNES_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n"); RARCH_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n");
return false; return false;
} }
@ -478,7 +478,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
if (!load_fbo_proc()) if (!load_fbo_proc())
{ {
SSNES_ERR("Failed to locate FBO functions. Won't be able to use render-to-texture.\n"); RARCH_ERR("Failed to locate FBO functions. Won't be able to use render-to-texture.\n");
return; return;
} }
@ -493,7 +493,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
{ {
scale.scale_x = g_settings.video.fbo_scale_x; scale.scale_x = g_settings.video.fbo_scale_x;
scale.scale_y = g_settings.video.fbo_scale_y; scale.scale_y = g_settings.video.fbo_scale_y;
scale.type_x = scale.type_y = SSNES_SCALE_INPUT; scale.type_x = scale.type_y = RARCH_SCALE_INPUT;
scale.valid = true; scale.valid = true;
} }
@ -506,7 +506,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
if (!gl->fbo_scale[i].valid) if (!gl->fbo_scale[i].valid)
{ {
gl->fbo_scale[i].scale_x = gl->fbo_scale[i].scale_y = 1.0f; gl->fbo_scale[i].scale_x = gl->fbo_scale[i].scale_y = 1.0f;
gl->fbo_scale[i].type_x = gl->fbo_scale[i].type_y = SSNES_SCALE_INPUT; gl->fbo_scale[i].type_x = gl->fbo_scale[i].type_y = RARCH_SCALE_INPUT;
gl->fbo_scale[i].valid = true; gl->fbo_scale[i].valid = true;
} }
} }
@ -517,7 +517,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
{ {
gl->fbo_rect[i].width = next_pow2(gl->fbo_rect[i].img_width); gl->fbo_rect[i].width = next_pow2(gl->fbo_rect[i].img_width);
gl->fbo_rect[i].height = next_pow2(gl->fbo_rect[i].img_height); gl->fbo_rect[i].height = next_pow2(gl->fbo_rect[i].img_height);
SSNES_LOG("Creating FBO %d @ %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height); RARCH_LOG("Creating FBO %d @ %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height);
} }
gl_create_fbo_textures(gl); gl_create_fbo_textures(gl);
@ -613,7 +613,7 @@ static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_f
gl->vp_out_height = height; gl->vp_out_height = height;
} }
//SSNES_LOG("Setting viewport @ %ux%u\n", width, height); //RARCH_LOG("Setting viewport @ %ux%u\n", width, height);
} }
static void gl_set_rotation(void *data, unsigned rotation) static void gl_set_rotation(void *data, unsigned rotation)
@ -874,16 +874,16 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
{ {
switch (gl->fbo_scale[i].type_x) switch (gl->fbo_scale[i].type_x)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].img_width = last_width * gl->fbo_scale[i].scale_x; gl->fbo_rect[i].img_width = last_width * gl->fbo_scale[i].scale_x;
gl->fbo_rect[i].max_img_width = last_max_width * gl->fbo_scale[i].scale_x; gl->fbo_rect[i].max_img_width = last_max_width * gl->fbo_scale[i].scale_x;
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].abs_x; gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].abs_x;
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].scale_x * vp_width; gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].scale_x * vp_width;
break; break;
@ -893,16 +893,16 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
switch (gl->fbo_scale[i].type_y) switch (gl->fbo_scale[i].type_y)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].img_height = last_height * gl->fbo_scale[i].scale_y; gl->fbo_rect[i].img_height = last_height * gl->fbo_scale[i].scale_y;
gl->fbo_rect[i].max_img_height = last_max_height * gl->fbo_scale[i].scale_y; gl->fbo_rect[i].max_img_height = last_max_height * gl->fbo_scale[i].scale_y;
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].abs_y; gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].abs_y;
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].scale_y * vp_height; gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].scale_y * vp_height;
break; break;
@ -956,9 +956,9 @@ static void gl_check_fbo_dimensions(gl_t *gl)
GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) if (status != GL_FRAMEBUFFER_COMPLETE)
SSNES_WARN("Failed to reinit FBO texture.\n"); RARCH_WARN("Failed to reinit FBO texture.\n");
SSNES_LOG("Recreating FBO texture #%d: %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height); RARCH_LOG("Recreating FBO texture #%d: %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height);
} }
} }
} }
@ -1202,7 +1202,7 @@ static void gl_set_nonblock_state(void *data, bool state)
gl_t *gl = (gl_t*)data; gl_t *gl = (gl_t*)data;
if (gl->vsync) if (gl->vsync)
{ {
SSNES_LOG("GL VSync => %s\n", state ? "off" : "on"); RARCH_LOG("GL VSync => %s\n", state ? "off" : "on");
sdlwrap_set_swap_interval(state ? 0 : 1, true); sdlwrap_set_swap_interval(state ? 0 : 1, true);
} }
} }
@ -1217,10 +1217,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
return NULL; return NULL;
const SDL_VideoInfo *video_info = SDL_GetVideoInfo(); const SDL_VideoInfo *video_info = SDL_GetVideoInfo();
ssnes_assert(video_info); rarch_assert(video_info);
unsigned full_x = video_info->current_w; unsigned full_x = video_info->current_w;
unsigned full_y = video_info->current_h; unsigned full_y = video_info->current_h;
SSNES_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y); RARCH_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y);
sdlwrap_set_swap_interval(video->vsync ? 1 : 0, false); sdlwrap_set_swap_interval(video->vsync ? 1 : 0, false);
@ -1270,22 +1270,22 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gl->win_width = win_width; gl->win_width = win_width;
gl->win_height = win_height; gl->win_height = win_height;
SSNES_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height); RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
if (!gl_shader_init()) if (!gl_shader_init())
{ {
SSNES_ERR("Shader init failed.\n"); RARCH_ERR("Shader init failed.\n");
sdlwrap_destroy(); sdlwrap_destroy();
free(gl); free(gl);
return NULL; return NULL;
} }
SSNES_LOG("GL: Loaded %u program(s).\n", gl_shader_num()); RARCH_LOG("GL: Loaded %u program(s).\n", gl_shader_num());
#ifdef HAVE_FBO #ifdef HAVE_FBO
// Set up render to texture. // Set up render to texture.
gl_init_fbo(gl, SSNES_SCALE_BASE * video->input_scale, gl_init_fbo(gl, RARCH_SCALE_BASE * video->input_scale,
SSNES_SCALE_BASE * video->input_scale); RARCH_SCALE_BASE * video->input_scale);
#endif #endif
gl->keep_aspect = video->force_aspect; gl->keep_aspect = video->force_aspect;
@ -1339,8 +1339,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
set_lut_texture_coords(tex_coords); set_lut_texture_coords(tex_coords);
gl->tex_w = SSNES_SCALE_BASE * video->input_scale; gl->tex_w = RARCH_SCALE_BASE * video->input_scale;
gl->tex_h = SSNES_SCALE_BASE * video->input_scale; gl->tex_h = RARCH_SCALE_BASE * video->input_scale;
// Empty buffer that we use to clear out the texture with on res change. // Empty buffer that we use to clear out the texture with on res change.
gl->empty_buf = calloc(gl->tex_w * gl->tex_h, gl->base_size); gl->empty_buf = calloc(gl->tex_w * gl->tex_h, gl->base_size);

View File

@ -41,27 +41,27 @@ static inline bool gl_check_error(void)
switch (error) switch (error)
{ {
case GL_INVALID_ENUM: case GL_INVALID_ENUM:
SSNES_ERR("GL: Invalid enum.\n"); RARCH_ERR("GL: Invalid enum.\n");
break; break;
case GL_INVALID_VALUE: case GL_INVALID_VALUE:
SSNES_ERR("GL: Invalid value. (You're not alone.)\n"); RARCH_ERR("GL: Invalid value. (You're not alone.)\n");
break; break;
case GL_INVALID_OPERATION: case GL_INVALID_OPERATION:
SSNES_ERR("GL: Invalid operation.\n"); RARCH_ERR("GL: Invalid operation.\n");
break; break;
case GL_STACK_OVERFLOW: case GL_STACK_OVERFLOW:
SSNES_ERR("GL: Stack overflow. (wtf)\n"); RARCH_ERR("GL: Stack overflow. (wtf)\n");
break; break;
case GL_STACK_UNDERFLOW: case GL_STACK_UNDERFLOW:
SSNES_ERR("GL: Stack underflow. (:v)\n"); RARCH_ERR("GL: Stack underflow. (:v)\n");
break; break;
case GL_OUT_OF_MEMORY: case GL_OUT_OF_MEMORY:
SSNES_ERR("GL: Out of memory. Harhar.\n"); RARCH_ERR("GL: Out of memory. Harhar.\n");
break; break;
case GL_NO_ERROR: case GL_NO_ERROR:
return true; return true;
default: default:
SSNES_ERR("Non specified error :v\n"); RARCH_ERR("Non specified error :v\n");
} }
return false; return false;
@ -79,9 +79,9 @@ struct gl_fbo_rect
enum gl_scale_type enum gl_scale_type
{ {
SSNES_SCALE_ABSOLUTE, RARCH_SCALE_ABSOLUTE,
SSNES_SCALE_INPUT, RARCH_SCALE_INPUT,
SSNES_SCALE_VIEWPORT RARCH_SCALE_VIEWPORT
}; };
struct gl_fbo_scale struct gl_fbo_scale

View File

@ -47,7 +47,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
const SDL_PixelFormat *fmt = img->format; const SDL_PixelFormat *fmt = img->format;
SSNES_LOG("SDL_image: %dx%d @ %d bpp\n", img->w, img->h, img->format->BitsPerPixel); RARCH_LOG("SDL_image: %dx%d @ %d bpp\n", img->w, img->h, img->format->BitsPerPixel);
if (img->format->BitsPerPixel == 32) if (img->format->BitsPerPixel == 32)
{ {
for (int y = 0; y < img->h; y++) for (int y = 0; y < img->h; y++)
@ -88,7 +88,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
} }
else else
{ {
SSNES_ERR("8-bit and 16-bit image support are not implemented.\n"); RARCH_ERR("8-bit and 16-bit image support are not implemented.\n");
SDL_FreeSurface(img); SDL_FreeSurface(img);
return false; return false;
} }
@ -129,7 +129,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
height = info[2] + ((unsigned)info[3] * 256); height = info[2] + ((unsigned)info[3] * 256);
unsigned bits = info[4]; unsigned bits = info[4];
SSNES_LOG("Loaded TGA: (%ux%u @ %u bpp)\n", width, height, bits); RARCH_LOG("Loaded TGA: (%ux%u @ %u bpp)\n", width, height, bits);
unsigned size = width * height * sizeof(uint32_t); unsigned size = width * height * sizeof(uint32_t);
out_img->pixels = (uint32_t*)malloc(size); out_img->pixels = (uint32_t*)malloc(size);

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_IMAGE_H #ifndef __RARCH_IMAGE_H
#define __SSNES_IMAGE_H #define __RARCH_IMAGE_H
#include <stdint.h> #include <stdint.h>
#include "../boolean.h" #include "../boolean.h"

View File

@ -65,7 +65,7 @@ static PyObject *py_read_input(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "II", &player, &key)) if (!PyArg_ParseTuple(args, "II", &player, &key))
return NULL; return NULL;
if (player > MAX_PLAYERS || player < 1 || key >= SSNES_FIRST_META_KEY) if (player > MAX_PLAYERS || player < 1 || key >= RARCH_FIRST_META_KEY)
return NULL; return NULL;
static const struct snes_keybind *binds[MAX_PLAYERS] = { static const struct snes_keybind *binds[MAX_PLAYERS] = {
@ -95,7 +95,7 @@ static PyObject *py_read_input_meta(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "I", &key)) if (!PyArg_ParseTuple(args, "I", &key))
return NULL; return NULL;
if (key < SSNES_FIRST_META_KEY) if (key < RARCH_FIRST_META_KEY)
return NULL; return NULL;
bool ret = input_key_pressed_func(key); bool ret = input_key_pressed_func(key);
@ -110,7 +110,7 @@ static PyMethodDef SNESMethods[] = {
}; };
#define DECL_ATTR_SNES(attr) PyObject_SetAttrString(mod, #attr, PyLong_FromLong(RETRO_DEVICE_ID_JOYPAD_##attr)) #define DECL_ATTR_SNES(attr) PyObject_SetAttrString(mod, #attr, PyLong_FromLong(RETRO_DEVICE_ID_JOYPAD_##attr))
#define DECL_ATTR_SSNES(attr) PyObject_SetAttrString(mod, #attr, PyLong_FromLong(SSNES_##attr)) #define DECL_ATTR_SSNES(attr) PyObject_SetAttrString(mod, #attr, PyLong_FromLong(RARCH_##attr))
static void py_set_attrs(PyObject *mod) static void py_set_attrs(PyObject *mod)
{ {
DECL_ATTR_SNES(B); DECL_ATTR_SNES(B);
@ -232,10 +232,10 @@ static char *align_program(const char *program)
py_state_t *py_state_new(const char *script, unsigned is_file, const char *pyclass) py_state_t *py_state_new(const char *script, unsigned is_file, const char *pyclass)
{ {
SSNES_LOG("Initializing Python runtime ...\n"); RARCH_LOG("Initializing Python runtime ...\n");
PyImport_AppendInittab("snes", &PyInit_SNES); PyImport_AppendInittab("snes", &PyInit_SNES);
Py_Initialize(); Py_Initialize();
SSNES_LOG("Initialized Python runtime.\n"); RARCH_LOG("Initialized Python runtime.\n");
py_state_t *handle = (py_state_t*)calloc(1, sizeof(*handle)); py_state_t *handle = (py_state_t*)calloc(1, sizeof(*handle));
PyObject *hook = NULL; PyObject *hook = NULL;
@ -254,7 +254,7 @@ py_state_t *py_state_new(const char *script, unsigned is_file, const char *pycla
char *script_ = NULL; char *script_ = NULL;
if (read_file(script, (void**)&script_) < 0) if (read_file(script, (void**)&script_) < 0)
{ {
SSNES_ERR("Python: Failed to read script\n"); RARCH_ERR("Python: Failed to read script\n");
goto error; goto error;
} }
@ -271,11 +271,11 @@ py_state_t *py_state_new(const char *script, unsigned is_file, const char *pycla
} }
} }
SSNES_LOG("Python: Script loaded.\n"); RARCH_LOG("Python: Script loaded.\n");
handle->dict = PyModule_GetDict(handle->main); handle->dict = PyModule_GetDict(handle->main);
if (!handle->dict) if (!handle->dict)
{ {
SSNES_ERR("Python: PyModule_GetDict() failed.\n"); RARCH_ERR("Python: PyModule_GetDict() failed.\n");
goto error; goto error;
} }
Py_INCREF(handle->dict); Py_INCREF(handle->dict);
@ -283,14 +283,14 @@ py_state_t *py_state_new(const char *script, unsigned is_file, const char *pycla
hook = PyDict_GetItemString(handle->dict, pyclass); hook = PyDict_GetItemString(handle->dict, pyclass);
if (!hook) if (!hook)
{ {
SSNES_ERR("Python: PyDict_GetItemString() failed.\n"); RARCH_ERR("Python: PyDict_GetItemString() failed.\n");
goto error; goto error;
} }
handle->inst = PyObject_CallFunction(hook, NULL); handle->inst = PyObject_CallFunction(hook, NULL);
if (!handle->inst) if (!handle->inst)
{ {
SSNES_ERR("Python: PyObject_CallFunction() failed.\n"); RARCH_ERR("Python: PyObject_CallFunction() failed.\n");
goto error; goto error;
} }
Py_INCREF(handle->inst); Py_INCREF(handle->inst);
@ -327,7 +327,7 @@ float py_state_get(py_state_t *handle, const char *id,
if (!ret) if (!ret)
{ {
if (!handle->warned_ret) if (!handle->warned_ret)
SSNES_WARN("Didn't get return value from script. Bug?\n"); RARCH_WARN("Didn't get return value from script. Bug?\n");
handle->warned_ret = true; handle->warned_ret = true;
return 0.0f; return 0.0f;
} }

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_PY_STATE_H #ifndef __RARCH_PY_STATE_H
#define __SSNES_PY_STATE_H #define __RARCH_PY_STATE_H
#include <stdint.h> #include <stdint.h>
#include "../../boolean.h" #include "../../boolean.h"

View File

@ -18,7 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../general.h" #include "../general.h"
#include "../input/ssnes_sdl_input.h" #include "../input/rarch_sdl_input.h"
#include "gfx_common.h" #include "gfx_common.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -109,10 +109,10 @@ static void sdl_init_font(sdl_video_t *vid, const char *font_path, unsigned font
vid->font_b = b; vid->font_b = b;
} }
else else
SSNES_WARN("Failed to init font.\n"); RARCH_WARN("Failed to init font.\n");
} }
else else
SSNES_LOG("Did not find default font.\n"); RARCH_LOG("Did not find default font.\n");
#else #else
(void)vid; (void)vid;
(void)font_path; (void)font_path;
@ -256,16 +256,16 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
return NULL; return NULL;
const SDL_VideoInfo *video_info = SDL_GetVideoInfo(); const SDL_VideoInfo *video_info = SDL_GetVideoInfo();
ssnes_assert(video_info); rarch_assert(video_info);
unsigned full_x = video_info->current_w; unsigned full_x = video_info->current_w;
unsigned full_y = video_info->current_h; unsigned full_y = video_info->current_h;
SSNES_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y); RARCH_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y);
sdl_input_t *sdl_input = NULL; sdl_input_t *sdl_input = NULL;
const SDL_PixelFormat *fmt = NULL; const SDL_PixelFormat *fmt = NULL;
if (!video->fullscreen) if (!video->fullscreen)
SSNES_LOG("Creating window @ %ux%u\n", video->width, video->height); RARCH_LOG("Creating window @ %ux%u\n", video->width, video->height);
vid->render32 = video->rgb32 && !g_settings.video.force_16bit; vid->render32 = video->rgb32 && !g_settings.video.force_16bit;
vid->screen = SDL_SetVideoMode(video->width, video->height, vid->render32 ? 32 : 15, SDL_HWSURFACE | SDL_HWACCEL | SDL_DOUBLEBUF | (video->fullscreen ? SDL_FULLSCREEN : 0)); vid->screen = SDL_SetVideoMode(video->width, video->height, vid->render32 ? 32 : 15, SDL_HWSURFACE | SDL_HWACCEL | SDL_DOUBLEBUF | (video->fullscreen ? SDL_FULLSCREEN : 0));
@ -274,13 +274,13 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
{ {
vid->upsample = true; vid->upsample = true;
vid->screen = SDL_SetVideoMode(video->width, video->height, 32, SDL_HWSURFACE | SDL_HWACCEL | SDL_DOUBLEBUF | (video->fullscreen ? SDL_FULLSCREEN : 0)); vid->screen = SDL_SetVideoMode(video->width, video->height, 32, SDL_HWSURFACE | SDL_HWACCEL | SDL_DOUBLEBUF | (video->fullscreen ? SDL_FULLSCREEN : 0));
SSNES_WARN("SDL: 15-bit colors failed, attempting 32-bit colors.\n"); RARCH_WARN("SDL: 15-bit colors failed, attempting 32-bit colors.\n");
vid->render32 = true; vid->render32 = true;
} }
if (!vid->screen) if (!vid->screen)
{ {
SSNES_ERR("Failed to init SDL surface: %s\n", SDL_GetError()); RARCH_ERR("Failed to init SDL surface: %s\n", SDL_GetError());
goto error; goto error;
} }
@ -289,24 +289,24 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
fmt = vid->screen->format; fmt = vid->screen->format;
if (vid->render32) if (vid->render32)
{ {
SSNES_LOG("SDL: Creating 32-bit buffer.\n"); RARCH_LOG("SDL: Creating 32-bit buffer.\n");
vid->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, SSNES_SCALE_BASE * video->input_scale, vid->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, RARCH_SCALE_BASE * video->input_scale,
SSNES_SCALE_BASE * video->input_scale, 32, RARCH_SCALE_BASE * video->input_scale, 32,
fmt->Rmask, fmt->Bmask, fmt->Gmask, fmt->Amask); fmt->Rmask, fmt->Bmask, fmt->Gmask, fmt->Amask);
} }
else else
{ {
SSNES_LOG("SDL: Creating 15-bit buffer.\n"); RARCH_LOG("SDL: Creating 15-bit buffer.\n");
vid->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, SSNES_SCALE_BASE * video->input_scale, vid->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, RARCH_SCALE_BASE * video->input_scale,
SSNES_SCALE_BASE * video->input_scale, 15, RARCH_SCALE_BASE * video->input_scale, 15,
fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask); fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
} }
SSNES_LOG("[Debug]: SDL Pixel format: Rshift = %u, Gshift = %u, Bshift = %u\n", RARCH_LOG("[Debug]: SDL Pixel format: Rshift = %u, Gshift = %u, Bshift = %u\n",
(unsigned)fmt->Rshift, (unsigned)fmt->Gshift, (unsigned)fmt->Bshift); (unsigned)fmt->Rshift, (unsigned)fmt->Gshift, (unsigned)fmt->Bshift);
if (!vid->buffer) if (!vid->buffer)
{ {
SSNES_ERR("SDL_CreateRGBSurface failed: %s\n", SDL_GetError()); RARCH_ERR("SDL_CreateRGBSurface failed: %s\n", SDL_GetError());
goto error; goto error;
} }
@ -328,23 +328,23 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu
if (fmt->Rshift == 10 && fmt->Gshift == 5 && fmt->Bshift == 0) // XRGB1555 if (fmt->Rshift == 10 && fmt->Gshift == 5 && fmt->Bshift == 0) // XRGB1555
{ {
SSNES_LOG("SDL: 15-bit format matches. Fast blit.\n"); RARCH_LOG("SDL: 15-bit format matches. Fast blit.\n");
vid->convert_15_func = convert_15bit_15bit_direct; vid->convert_15_func = convert_15bit_15bit_direct;
} }
else else
{ {
SSNES_LOG("SDL: 15-bit format does not match. Needs conversion.\n"); RARCH_LOG("SDL: 15-bit format does not match. Needs conversion.\n");
vid->convert_15_func = convert_15bit_15bit_shift; vid->convert_15_func = convert_15bit_15bit_shift;
} }
if (fmt->Rshift == 16 && fmt->Gshift == 8 && fmt->Bshift == 0) // ARGB8888 if (fmt->Rshift == 16 && fmt->Gshift == 8 && fmt->Bshift == 0) // ARGB8888
{ {
SSNES_LOG("SDL: 32-bit format matches. Fast blit.\n"); RARCH_LOG("SDL: 32-bit format matches. Fast blit.\n");
vid->convert_32_func = convert_32bit_32bit_direct; vid->convert_32_func = convert_32bit_32bit_direct;
} }
else else
{ {
SSNES_LOG("SDL: 32-bit format does not match. Needs conversion.\n"); RARCH_LOG("SDL: 32-bit format does not match. Needs conversion.\n");
vid->convert_32_func = convert_32bit_32bit_shift; vid->convert_32_func = convert_32bit_32bit_shift;
} }

View File

@ -65,13 +65,13 @@ void sdlwrap_set_swap_interval(unsigned interval, bool inited)
if (glx_swap_interval) if (glx_swap_interval)
success = glx_swap_interval(g_interval) == 0; success = glx_swap_interval(g_interval) == 0;
else else
SSNES_WARN("Could not find GLX VSync call.\n"); RARCH_WARN("Could not find GLX VSync call.\n");
#endif #endif
} }
#endif #endif
if (!success) if (!success)
SSNES_WARN("Failed to set swap interval.\n"); RARCH_WARN("Failed to set swap interval.\n");
} }
bool sdlwrap_init(void) bool sdlwrap_init(void)
@ -85,7 +85,7 @@ bool sdlwrap_init(void)
bool ret = SDL_Init(SDL_INIT_VIDEO) == 0; bool ret = SDL_Init(SDL_INIT_VIDEO) == 0;
#endif #endif
if (!ret) if (!ret)
SSNES_ERR("Failed to init SDL video.\n"); RARCH_ERR("Failed to init SDL video.\n");
return ret; return ret;
} }
@ -145,7 +145,7 @@ bool sdlwrap_set_video_mode(
width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | (fullscreen ? SDL_WINDOW_FULLSCREEN : resizable)); width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | (fullscreen ? SDL_WINDOW_FULLSCREEN : resizable));
if (!g_window) if (!g_window)
{ {
SSNES_ERR("Failed to create SDL window.\n"); RARCH_ERR("Failed to create SDL window.\n");
return false; return false;
} }
@ -154,7 +154,7 @@ bool sdlwrap_set_video_mode(
if (!SDL_SetVideoMode(width, height, bits, if (!SDL_SetVideoMode(width, height, bits,
SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : resizable))) SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : resizable)))
{ {
SSNES_ERR("Failed to create SDL window.\n"); RARCH_ERR("Failed to create SDL window.\n");
return false; return false;
} }
#endif #endif
@ -166,7 +166,7 @@ bool sdlwrap_set_video_mode(
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr); SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr);
if (attr <= 0 && g_interval) if (attr <= 0 && g_interval)
{ {
SSNES_WARN("SDL failed to setup VSync, attempting to recover using native calls.\n"); RARCH_WARN("SDL failed to setup VSync, attempting to recover using native calls.\n");
sdlwrap_set_swap_interval(g_interval, true); sdlwrap_set_swap_interval(g_interval, true);
} }
#endif #endif
@ -176,7 +176,7 @@ bool sdlwrap_set_video_mode(
attr = 0; attr = 0;
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &attr); SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &attr);
if (attr <= 0) if (attr <= 0)
SSNES_WARN("GL double buffer has not been enabled.\n"); RARCH_WARN("GL double buffer has not been enabled.\n");
return true; return true;
} }
@ -326,7 +326,7 @@ void sdlwrap_check_window(bool *quit,
*resize = true; *resize = true;
*width = new_width; *width = new_width;
*height = new_height; *height = new_height;
SSNES_LOG("GL: Verified window size: %u x %u\n", *width, *height); RARCH_LOG("GL: Verified window size: %u x %u\n", *width, *height);
} }
} }
#endif #endif

View File

@ -35,7 +35,7 @@
// Not legal to cast (void*) to fn-pointer. Need workaround to be compliant. // Not legal to cast (void*) to fn-pointer. Need workaround to be compliant.
#define SDL_SYM_WRAP(sym, symbol) { \ #define SDL_SYM_WRAP(sym, symbol) { \
ssnes_assert(sizeof(void*) == sizeof(void (*)(void))); \ rarch_assert(sizeof(void*) == sizeof(void (*)(void))); \
void *sym__ = SDL_GL_GetProcAddress(symbol); \ void *sym__ = SDL_GL_GetProcAddress(symbol); \
memcpy(&(sym), &sym__, sizeof(void*)); \ memcpy(&(sym), &sym__, sizeof(void*)); \
} }

View File

@ -28,7 +28,7 @@
#include "state_tracker.h" #include "state_tracker.h"
#endif #endif
//#define SSNES_CG_DEBUG //#define RARCH_CG_DEBUG
// Used when we call deactivate() since just unbinding the program didn't seem to work... :( // Used when we call deactivate() since just unbinding the program didn't seem to work... :(
static const char *stock_cg_program = static const char *stock_cg_program =
@ -57,7 +57,7 @@ static const char *stock_cg_program =
static char *menu_cg_program; static char *menu_cg_program;
#ifdef SSNES_CG_DEBUG #ifdef RARCH_CG_DEBUG
static void cg_error_handler(CGcontext ctx, CGerror error, void *data) static void cg_error_handler(CGcontext ctx, CGerror error, void *data)
{ {
(void)ctx; (void)ctx;
@ -66,18 +66,18 @@ static void cg_error_handler(CGcontext ctx, CGerror error, void *data)
switch (error) switch (error)
{ {
case CG_INVALID_PARAM_HANDLE_ERROR: case CG_INVALID_PARAM_HANDLE_ERROR:
SSNES_ERR("Invalid param handle.\n"); RARCH_ERR("Invalid param handle.\n");
break; break;
case CG_INVALID_PARAMETER_ERROR: case CG_INVALID_PARAMETER_ERROR:
SSNES_ERR("Invalid parameter.\n"); RARCH_ERR("Invalid parameter.\n");
break; break;
default: default:
break; break;
} }
SSNES_ERR("CG error!: \"%s\".\n", cgGetErrorString(error)); RARCH_ERR("CG error!: \"%s\".\n", cgGetErrorString(error));
} }
#endif #endif
@ -113,7 +113,7 @@ struct cg_program
CGparameter frame_dir_v; CGparameter frame_dir_v;
CGparameter mvp; CGparameter mvp;
struct cg_fbo_params fbo[SSNES_CG_MAX_SHADERS]; struct cg_fbo_params fbo[RARCH_CG_MAX_SHADERS];
struct cg_fbo_params orig; struct cg_fbo_params orig;
struct cg_fbo_params prev[PREV_TEXTURES]; struct cg_fbo_params prev[PREV_TEXTURES];
}; };
@ -122,20 +122,20 @@ struct cg_program
#define FILTER_LINEAR 1 #define FILTER_LINEAR 1
#define FILTER_NEAREST 2 #define FILTER_NEAREST 2
static struct cg_program prg[SSNES_CG_MAX_SHADERS]; static struct cg_program prg[RARCH_CG_MAX_SHADERS];
static const char **cg_arguments; static const char **cg_arguments;
static bool cg_active = false; static bool cg_active = false;
static CGprofile cgVProf, cgFProf; static CGprofile cgVProf, cgFProf;
static unsigned active_index = 0; static unsigned active_index = 0;
static unsigned cg_shader_num = 0; static unsigned cg_shader_num = 0;
static struct gl_fbo_scale cg_scale[SSNES_CG_MAX_SHADERS]; static struct gl_fbo_scale cg_scale[RARCH_CG_MAX_SHADERS];
static unsigned fbo_smooth[SSNES_CG_MAX_SHADERS]; static unsigned fbo_smooth[RARCH_CG_MAX_SHADERS];
static GLuint lut_textures[MAX_TEXTURES]; static GLuint lut_textures[MAX_TEXTURES];
static unsigned lut_textures_num = 0; static unsigned lut_textures_num = 0;
static char lut_textures_uniform[MAX_TEXTURES][64]; static char lut_textures_uniform[MAX_TEXTURES][64];
static CGparameter cg_attribs[PREV_TEXTURES + 1 + SSNES_CG_MAX_SHADERS]; static CGparameter cg_attribs[PREV_TEXTURES + 1 + RARCH_CG_MAX_SHADERS];
static unsigned cg_attrib_index; static unsigned cg_attrib_index;
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
@ -185,7 +185,7 @@ void gl_cg_set_params(unsigned width, unsigned height,
set_param_1f(prg[active_index].frame_cnt_v, (float)frame_count); set_param_1f(prg[active_index].frame_cnt_v, (float)frame_count);
set_param_1f(prg[active_index].frame_dir_v, g_extern.frame_is_reverse ? -1.0 : 1.0); set_param_1f(prg[active_index].frame_dir_v, g_extern.frame_is_reverse ? -1.0 : 1.0);
if (active_index == SSNES_CG_MENU_SHADER_INDEX) if (active_index == RARCH_CG_MENU_SHADER_INDEX)
return; return;
// Set orig texture. // Set orig texture.
@ -294,7 +294,7 @@ static void gl_cg_deinit_progs(void)
cgGLUnbindProgram(cgVProf); cgGLUnbindProgram(cgVProf);
// Programs may alias [0]. // Programs may alias [0].
for (unsigned i = 1; i < SSNES_CG_MAX_SHADERS; i++) for (unsigned i = 1; i < RARCH_CG_MAX_SHADERS; i++)
{ {
if (prg[i].fprg != prg[0].fprg) if (prg[i].fprg != prg[0].fprg)
cgDestroyProgram(prg[i].fprg); cgDestroyProgram(prg[i].fprg);
@ -404,11 +404,11 @@ static bool load_program(unsigned index, const char *prog, bool path_is_file)
if (!prg[index].fprg || !prg[index].vprg) if (!prg[index].fprg || !prg[index].vprg)
{ {
SSNES_ERR("CG error: %s\n", cgGetErrorString(cgGetError())); RARCH_ERR("CG error: %s\n", cgGetErrorString(cgGetError()));
if (listing_f) if (listing_f)
SSNES_ERR("Fragment:\n%s\n", listing_f); RARCH_ERR("Fragment:\n%s\n", listing_f);
else if (listing_v) else if (listing_v)
SSNES_ERR("Vertex:\n%s\n", listing_v); RARCH_ERR("Vertex:\n%s\n", listing_v);
ret = false; ret = false;
goto end; goto end;
@ -427,7 +427,7 @@ static bool load_stock(void)
{ {
if (!load_program(0, stock_cg_program, false)) if (!load_program(0, stock_cg_program, false))
{ {
SSNES_ERR("Failed to compile passthrough shader, is something wrong with your environment?\n"); RARCH_ERR("Failed to compile passthrough shader, is something wrong with your environment?\n");
return false; return false;
} }
@ -439,7 +439,7 @@ static bool load_plain(const char *path)
if (!load_stock()) if (!load_stock())
return false; return false;
SSNES_LOG("Loading Cg file: %s\n", path); RARCH_LOG("Loading Cg file: %s\n", path);
if (!load_program(1, path, true)) if (!load_program(1, path, true))
return false; return false;
@ -462,7 +462,7 @@ static bool load_plain(const char *path)
static bool load_menu_shader(void) static bool load_menu_shader(void)
{ {
return load_program(SSNES_CG_MENU_SHADER_INDEX, menu_cg_program, true); return load_program(RARCH_CG_MENU_SHADER_INDEX, menu_cg_program, true);
} }
#define print_buf(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__) #define print_buf(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__)
@ -506,7 +506,7 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
char path[PATH_MAX]; char path[PATH_MAX];
if (!config_get_array(conf, id, path, sizeof(path))) if (!config_get_array(conf, id, path, sizeof(path)))
{ {
SSNES_ERR("Cannot find path to texture \"%s\" ...\n", id); RARCH_ERR("Cannot find path to texture \"%s\" ...\n", id);
ret = false; ret = false;
goto end; goto end;
} }
@ -531,11 +531,11 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
else else
print_buf(image_path, "%s%s", dir_path, path); print_buf(image_path, "%s%s", dir_path, path);
SSNES_LOG("Loading image from: \"%s\".\n", image_path); RARCH_LOG("Loading image from: \"%s\".\n", image_path);
struct texture_image img; struct texture_image img;
if (!texture_image_load(image_path, &img)) if (!texture_image_load(image_path, &img))
{ {
SSNES_ERR("Failed to load picture ...\n"); RARCH_ERR("Failed to load picture ...\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -594,38 +594,38 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
if (!semantic) if (!semantic)
{ {
SSNES_ERR("No semantic for import variable.\n"); RARCH_ERR("No semantic for import variable.\n");
ret = false; ret = false;
goto end; goto end;
} }
enum state_tracker_type tracker_type; enum state_tracker_type tracker_type;
enum state_ram_type ram_type = SSNES_STATE_NONE; enum state_ram_type ram_type = RARCH_STATE_NONE;
if (strcmp(semantic, "capture") == 0) if (strcmp(semantic, "capture") == 0)
tracker_type = SSNES_STATE_CAPTURE; tracker_type = RARCH_STATE_CAPTURE;
else if (strcmp(semantic, "transition") == 0) else if (strcmp(semantic, "transition") == 0)
tracker_type = SSNES_STATE_TRANSITION; tracker_type = RARCH_STATE_TRANSITION;
else if (strcmp(semantic, "transition_count") == 0) else if (strcmp(semantic, "transition_count") == 0)
tracker_type = SSNES_STATE_TRANSITION_COUNT; tracker_type = RARCH_STATE_TRANSITION_COUNT;
else if (strcmp(semantic, "capture_previous") == 0) else if (strcmp(semantic, "capture_previous") == 0)
tracker_type = SSNES_STATE_CAPTURE_PREV; tracker_type = RARCH_STATE_CAPTURE_PREV;
else if (strcmp(semantic, "transition_previous") == 0) else if (strcmp(semantic, "transition_previous") == 0)
tracker_type = SSNES_STATE_TRANSITION_PREV; tracker_type = RARCH_STATE_TRANSITION_PREV;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
else if (strcmp(semantic, "python") == 0) else if (strcmp(semantic, "python") == 0)
tracker_type = SSNES_STATE_PYTHON; tracker_type = RARCH_STATE_PYTHON;
#endif #endif
else else
{ {
SSNES_ERR("Invalid semantic.\n"); RARCH_ERR("Invalid semantic.\n");
ret = false; ret = false;
goto end; goto end;
} }
unsigned addr = 0; unsigned addr = 0;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
if (tracker_type != SSNES_STATE_PYTHON) if (tracker_type != RARCH_STATE_PYTHON)
#endif #endif
{ {
unsigned input_slot = 0; unsigned input_slot = 0;
@ -634,24 +634,24 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
switch (input_slot) switch (input_slot)
{ {
case 1: case 1:
ram_type = SSNES_STATE_INPUT_SLOT1; ram_type = RARCH_STATE_INPUT_SLOT1;
break; break;
case 2: case 2:
ram_type = SSNES_STATE_INPUT_SLOT2; ram_type = RARCH_STATE_INPUT_SLOT2;
break; break;
default: default:
SSNES_ERR("Invalid input slot for import.\n"); RARCH_ERR("Invalid input slot for import.\n");
ret = false; ret = false;
goto end; goto end;
} }
} }
else if (config_get_hex(conf, wram_buf, &addr)) else if (config_get_hex(conf, wram_buf, &addr))
ram_type = SSNES_STATE_WRAM; ram_type = RARCH_STATE_WRAM;
else else
{ {
SSNES_ERR("No address assigned to semantic.\n"); RARCH_ERR("No address assigned to semantic.\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -660,7 +660,7 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
unsigned memtype; unsigned memtype;
switch (ram_type) switch (ram_type)
{ {
case SSNES_STATE_WRAM: case RARCH_STATE_WRAM:
memtype = RETRO_MEMORY_SYSTEM_RAM; memtype = RETRO_MEMORY_SYSTEM_RAM;
break; break;
@ -670,7 +670,7 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
if ((memtype != -1u) && (addr >= pretro_get_memory_size(memtype))) if ((memtype != -1u) && (addr >= pretro_get_memory_size(memtype)))
{ {
SSNES_ERR("Address out of bounds.\n"); RARCH_ERR("Address out of bounds.\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -715,7 +715,7 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
state_tracker = state_tracker_init(&tracker_info); state_tracker = state_tracker_init(&tracker_info);
if (!state_tracker) if (!state_tracker)
SSNES_WARN("Failed to initialize state tracker.\n"); RARCH_WARN("Failed to initialize state tracker.\n");
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
if (script) if (script)
@ -745,11 +745,11 @@ static bool load_shader(const char *dir_path, unsigned i, config_file_t *conf)
} }
else else
{ {
SSNES_ERR("Didn't find shader path in config ...\n"); RARCH_ERR("Didn't find shader path in config ...\n");
return false; return false;
} }
SSNES_LOG("Loading Cg shader: \"%s\".\n", path_buf); RARCH_LOG("Loading Cg shader: \"%s\".\n", path_buf);
if (!load_program(i + 1, path_buf, true)) if (!load_program(i + 1, path_buf, true))
return false; return false;
@ -796,8 +796,8 @@ static bool load_shader_params(unsigned i, config_file_t *conf)
struct gl_fbo_scale *scale = &cg_scale[i + 1]; // Shader 0 is passthrough shader. Start at 1. struct gl_fbo_scale *scale = &cg_scale[i + 1]; // Shader 0 is passthrough shader. Start at 1.
scale->valid = true; scale->valid = true;
scale->type_x = SSNES_SCALE_INPUT; scale->type_x = RARCH_SCALE_INPUT;
scale->type_y = SSNES_SCALE_INPUT; scale->type_y = RARCH_SCALE_INPUT;
scale->scale_x = 1.0; scale->scale_x = 1.0;
scale->scale_y = 1.0; scale->scale_y = 1.0;
@ -806,32 +806,32 @@ static bool load_shader_params(unsigned i, config_file_t *conf)
scale->abs_y = geom->base_height; scale->abs_y = geom->base_height;
if (strcmp(scale_type_x, "source") == 0) if (strcmp(scale_type_x, "source") == 0)
scale->type_x = SSNES_SCALE_INPUT; scale->type_x = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_x, "viewport") == 0) else if (strcmp(scale_type_x, "viewport") == 0)
scale->type_x = SSNES_SCALE_VIEWPORT; scale->type_x = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_x, "absolute") == 0) else if (strcmp(scale_type_x, "absolute") == 0)
scale->type_x = SSNES_SCALE_ABSOLUTE; scale->type_x = RARCH_SCALE_ABSOLUTE;
else else
{ {
SSNES_ERR("Invalid attribute.\n"); RARCH_ERR("Invalid attribute.\n");
ret = false; ret = false;
goto end; goto end;
} }
if (strcmp(scale_type_y, "source") == 0) if (strcmp(scale_type_y, "source") == 0)
scale->type_y = SSNES_SCALE_INPUT; scale->type_y = RARCH_SCALE_INPUT;
else if (strcmp(scale_type_y, "viewport") == 0) else if (strcmp(scale_type_y, "viewport") == 0)
scale->type_y = SSNES_SCALE_VIEWPORT; scale->type_y = RARCH_SCALE_VIEWPORT;
else if (strcmp(scale_type_y, "absolute") == 0) else if (strcmp(scale_type_y, "absolute") == 0)
scale->type_y = SSNES_SCALE_ABSOLUTE; scale->type_y = RARCH_SCALE_ABSOLUTE;
else else
{ {
SSNES_ERR("Invalid attribute.\n"); RARCH_ERR("Invalid attribute.\n");
ret = false; ret = false;
goto end; goto end;
} }
if (scale->type_x == SSNES_SCALE_ABSOLUTE) if (scale->type_x == RARCH_SCALE_ABSOLUTE)
{ {
print_buf(attr_name_buf, "scale%u", i); print_buf(attr_name_buf, "scale%u", i);
if (config_get_int(conf, attr_name_buf, &iattr)) if (config_get_int(conf, attr_name_buf, &iattr))
@ -856,7 +856,7 @@ static bool load_shader_params(unsigned i, config_file_t *conf)
} }
} }
if (scale->type_y == SSNES_SCALE_ABSOLUTE) if (scale->type_y == RARCH_SCALE_ABSOLUTE)
{ {
print_buf(attr_name_buf, "scale%u", i); print_buf(attr_name_buf, "scale%u", i);
if (config_get_int(conf, attr_name_buf, &iattr)) if (config_get_int(conf, attr_name_buf, &iattr))
@ -901,34 +901,34 @@ static bool load_preset(const char *path)
char dir_path[PATH_MAX]; char dir_path[PATH_MAX];
char *ptr = NULL; char *ptr = NULL;
SSNES_LOG("Loading Cg meta-shader: %s\n", path); RARCH_LOG("Loading Cg meta-shader: %s\n", path);
config_file_t *conf = config_file_new(path); config_file_t *conf = config_file_new(path);
if (!conf) if (!conf)
{ {
SSNES_ERR("Failed to load preset.\n"); RARCH_ERR("Failed to load preset.\n");
ret = false; ret = false;
goto end; goto end;
} }
if (!config_get_int(conf, "shaders", &shaders)) if (!config_get_int(conf, "shaders", &shaders))
{ {
SSNES_ERR("Cannot find \"shaders\" param.\n"); RARCH_ERR("Cannot find \"shaders\" param.\n");
ret = false; ret = false;
goto end; goto end;
} }
if (shaders < 1) if (shaders < 1)
{ {
SSNES_ERR("Need to define at least 1 shader.\n"); RARCH_ERR("Need to define at least 1 shader.\n");
ret = false; ret = false;
goto end; goto end;
} }
cg_shader_num = shaders; cg_shader_num = shaders;
if (shaders > SSNES_CG_MAX_SHADERS - 3) if (shaders > RARCH_CG_MAX_SHADERS - 3)
{ {
SSNES_WARN("Too many shaders ... Capping shader amount to %d.\n", SSNES_CG_MAX_SHADERS - 3); RARCH_WARN("Too many shaders ... Capping shader amount to %d.\n", RARCH_CG_MAX_SHADERS - 3);
cg_shader_num = shaders = SSNES_CG_MAX_SHADERS - 3; cg_shader_num = shaders = RARCH_CG_MAX_SHADERS - 3;
} }
// If we aren't using last pass non-FBO shader, // If we aren't using last pass non-FBO shader,
// this shader will be assumed to be "fixed-function". // this shader will be assumed to be "fixed-function".
@ -958,14 +958,14 @@ static bool load_preset(const char *path)
{ {
if (!load_shader_params(i, conf)) if (!load_shader_params(i, conf))
{ {
SSNES_ERR("Failed to load shader params ...\n"); RARCH_ERR("Failed to load shader params ...\n");
ret = false; ret = false;
goto end; goto end;
} }
if (!load_shader(dir_path, i, conf)) if (!load_shader(dir_path, i, conf))
{ {
SSNES_ERR("Failed to load shaders ...\n"); RARCH_ERR("Failed to load shaders ...\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -973,14 +973,14 @@ static bool load_preset(const char *path)
if (!load_textures(dir_path, conf)) if (!load_textures(dir_path, conf))
{ {
SSNES_ERR("Failed to load lookup textures ...\n"); RARCH_ERR("Failed to load lookup textures ...\n");
ret = false; ret = false;
goto end; goto end;
} }
if (!load_imports(dir_path, conf)) if (!load_imports(dir_path, conf))
{ {
SSNES_ERR("Failed to load imports ...\n"); RARCH_ERR("Failed to load imports ...\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -992,7 +992,7 @@ end:
#else #else
(void)path; (void)path;
SSNES_ERR("No config file support compiled in.\n"); RARCH_ERR("No config file support compiled in.\n");
return false; return false;
#endif #endif
} }
@ -1016,7 +1016,7 @@ static void set_program_attributes(unsigned i)
if (prg[i].mvp) if (prg[i].mvp)
cgGLSetStateMatrixParameter(prg[i].mvp, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); cgGLSetStateMatrixParameter(prg[i].mvp, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);
if (i == SSNES_CG_MENU_SHADER_INDEX) if (i == RARCH_CG_MENU_SHADER_INDEX)
return; return;
prg[i].orig.tex = cgGetNamedParameter(prg[i].fprg, "ORIG.texture"); prg[i].orig.tex = cgGetNamedParameter(prg[i].fprg, "ORIG.texture");
@ -1089,11 +1089,11 @@ bool gl_cg_init(const char *path)
if (cgCtx == NULL) if (cgCtx == NULL)
{ {
SSNES_ERR("Failed to create Cg context\n"); RARCH_ERR("Failed to create Cg context\n");
return false; return false;
} }
#ifdef SSNES_CG_DEBUG #ifdef RARCH_CG_DEBUG
cgGLSetDebugMode(CG_TRUE); cgGLSetDebugMode(CG_TRUE);
cgSetErrorHandler(cg_error_handler, NULL); cgSetErrorHandler(cg_error_handler, NULL);
#endif #endif
@ -1102,7 +1102,7 @@ bool gl_cg_init(const char *path)
cgVProf = cgGLGetLatestProfile(CG_GL_VERTEX); cgVProf = cgGLGetLatestProfile(CG_GL_VERTEX);
if (cgFProf == CG_PROFILE_UNKNOWN || cgVProf == CG_PROFILE_UNKNOWN) if (cgFProf == CG_PROFILE_UNKNOWN || cgVProf == CG_PROFILE_UNKNOWN)
{ {
SSNES_ERR("Invalid profile type\n"); RARCH_ERR("Invalid profile type\n");
return false; return false;
} }
cgGLSetOptimalOptions(cgFProf); cgGLSetOptimalOptions(cgFProf);
@ -1132,7 +1132,7 @@ bool gl_cg_init(const char *path)
set_program_attributes(i); set_program_attributes(i);
if (menu_cg_program) if (menu_cg_program)
set_program_attributes(SSNES_CG_MENU_SHADER_INDEX); set_program_attributes(RARCH_CG_MENU_SHADER_INDEX);
cgGLBindProgram(prg[1].fprg); cgGLBindProgram(prg[1].fprg);
cgGLBindProgram(prg[1].vprg); cgGLBindProgram(prg[1].vprg);

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_CG_H #ifndef __RARCH_CG_H
#define __SSNES_CG_H #define __RARCH_CG_H
#include "../boolean.h" #include "../boolean.h"
#include "gl_common.h" #include "gl_common.h"
@ -46,8 +46,8 @@ void gl_cg_shader_scale(unsigned index, struct gl_fbo_scale *scale);
// Used on PS3, but not really platform specific. // Used on PS3, but not really platform specific.
#define SSNES_CG_MAX_SHADERS 16 #define RARCH_CG_MAX_SHADERS 16
#define SSNES_CG_MENU_SHADER_INDEX (SSNES_CG_MAX_SHADERS - 1) #define RARCH_CG_MENU_SHADER_INDEX (RARCH_CG_MAX_SHADERS - 1)
void gl_cg_set_menu_shader(const char *path); void gl_cg_set_menu_shader(const char *path);
void gl_cg_set_compiler_args(const char **argv); void gl_cg_set_compiler_args(const char **argv);

View File

@ -102,14 +102,14 @@ static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
enum filter_type enum filter_type
{ {
SSNES_GL_NOFORCE, RARCH_GL_NOFORCE,
SSNES_GL_LINEAR, RARCH_GL_LINEAR,
SSNES_GL_NEAREST RARCH_GL_NEAREST
}; };
static bool glsl_enable = false; static bool glsl_enable = false;
static GLuint gl_program[MAX_PROGRAMS] = {0}; static GLuint gl_program[MAX_PROGRAMS] = {0};
static enum filter_type gl_filter_type[MAX_PROGRAMS] = {SSNES_GL_NOFORCE}; static enum filter_type gl_filter_type[MAX_PROGRAMS] = {RARCH_GL_NOFORCE};
static struct gl_fbo_scale gl_scale[MAX_PROGRAMS]; static struct gl_fbo_scale gl_scale[MAX_PROGRAMS];
static unsigned gl_num_programs = 0; static unsigned gl_num_programs = 0;
static unsigned active_index = 0; static unsigned active_index = 0;
@ -164,7 +164,7 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
{ {
prog->scale_x = 1.0; prog->scale_x = 1.0;
prog->scale_y = 1.0; prog->scale_y = 1.0;
prog->type_x = prog->type_y = SSNES_SCALE_INPUT; prog->type_x = prog->type_y = RARCH_SCALE_INPUT;
prog->valid_scale = false; prog->valid_scale = false;
// Check if shader forces a certain texture filtering. // Check if shader forces a certain texture filtering.
@ -173,21 +173,21 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
{ {
if (strcmp((const char*)attr, "nearest") == 0) if (strcmp((const char*)attr, "nearest") == 0)
{ {
prog->filter = SSNES_GL_NEAREST; prog->filter = RARCH_GL_NEAREST;
SSNES_LOG("XML: Shader forces GL_NEAREST.\n"); RARCH_LOG("XML: Shader forces GL_NEAREST.\n");
} }
else if (strcmp((const char*)attr, "linear") == 0) else if (strcmp((const char*)attr, "linear") == 0)
{ {
prog->filter = SSNES_GL_LINEAR; prog->filter = RARCH_GL_LINEAR;
SSNES_LOG("XML: Shader forces GL_LINEAR.\n"); RARCH_LOG("XML: Shader forces GL_LINEAR.\n");
} }
else else
SSNES_WARN("XML: Invalid property for filter.\n"); RARCH_WARN("XML: Invalid property for filter.\n");
xmlFree(attr); xmlFree(attr);
} }
else else
prog->filter = SSNES_GL_NOFORCE; prog->filter = RARCH_GL_NOFORCE;
// Check for scaling attributes *lots of code <_<* // Check for scaling attributes *lots of code <_<*
xmlChar *attr_scale = xmlGetProp(ptr, (const xmlChar*)"scale"); xmlChar *attr_scale = xmlGetProp(ptr, (const xmlChar*)"scale");
@ -208,8 +208,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
prog->scale_x = scale; prog->scale_x = scale;
prog->scale_y = scale; prog->scale_y = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = prog->type_y = SSNES_SCALE_INPUT; prog->type_x = prog->type_y = RARCH_SCALE_INPUT;
SSNES_LOG("Got scale attr: %.1f\n", scale); RARCH_LOG("Got scale attr: %.1f\n", scale);
x_attr_cnt++; x_attr_cnt++;
y_attr_cnt++; y_attr_cnt++;
} }
@ -219,8 +219,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
float scale = strtod((const char*)attr_scale_x, NULL); float scale = strtod((const char*)attr_scale_x, NULL);
prog->scale_x = scale; prog->scale_x = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = SSNES_SCALE_INPUT; prog->type_x = RARCH_SCALE_INPUT;
SSNES_LOG("Got scale_x attr: %.1f\n", scale); RARCH_LOG("Got scale_x attr: %.1f\n", scale);
x_attr_cnt++; x_attr_cnt++;
} }
@ -229,8 +229,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
float scale = strtod((const char*)attr_scale_y, NULL); float scale = strtod((const char*)attr_scale_y, NULL);
prog->scale_y = scale; prog->scale_y = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_y = SSNES_SCALE_INPUT; prog->type_y = RARCH_SCALE_INPUT;
SSNES_LOG("Got scale_y attr: %.1f\n", scale); RARCH_LOG("Got scale_y attr: %.1f\n", scale);
y_attr_cnt++; y_attr_cnt++;
} }
@ -238,8 +238,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
{ {
prog->abs_x = prog->abs_y = strtoul((const char*)attr_size, NULL, 0); prog->abs_x = prog->abs_y = strtoul((const char*)attr_size, NULL, 0);
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = prog->type_y = SSNES_SCALE_ABSOLUTE; prog->type_x = prog->type_y = RARCH_SCALE_ABSOLUTE;
SSNES_LOG("Got size attr: %u\n", prog->abs_x); RARCH_LOG("Got size attr: %u\n", prog->abs_x);
x_attr_cnt++; x_attr_cnt++;
y_attr_cnt++; y_attr_cnt++;
} }
@ -248,8 +248,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
{ {
prog->abs_x = strtoul((const char*)attr_size_x, NULL, 0); prog->abs_x = strtoul((const char*)attr_size_x, NULL, 0);
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = SSNES_SCALE_ABSOLUTE; prog->type_x = RARCH_SCALE_ABSOLUTE;
SSNES_LOG("Got size_x attr: %u\n", prog->abs_x); RARCH_LOG("Got size_x attr: %u\n", prog->abs_x);
x_attr_cnt++; x_attr_cnt++;
} }
@ -257,8 +257,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
{ {
prog->abs_y = strtoul((const char*)attr_size_y, NULL, 0); prog->abs_y = strtoul((const char*)attr_size_y, NULL, 0);
prog->valid_scale = true; prog->valid_scale = true;
prog->type_y = SSNES_SCALE_ABSOLUTE; prog->type_y = RARCH_SCALE_ABSOLUTE;
SSNES_LOG("Got size_y attr: %u\n", prog->abs_y); RARCH_LOG("Got size_y attr: %u\n", prog->abs_y);
y_attr_cnt++; y_attr_cnt++;
} }
@ -268,8 +268,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
prog->scale_x = scale; prog->scale_x = scale;
prog->scale_y = scale; prog->scale_y = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = prog->type_y = SSNES_SCALE_VIEWPORT; prog->type_x = prog->type_y = RARCH_SCALE_VIEWPORT;
SSNES_LOG("Got outscale attr: %.1f\n", scale); RARCH_LOG("Got outscale attr: %.1f\n", scale);
x_attr_cnt++; x_attr_cnt++;
y_attr_cnt++; y_attr_cnt++;
} }
@ -279,8 +279,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
float scale = strtod((const char*)attr_outscale_x, NULL); float scale = strtod((const char*)attr_outscale_x, NULL);
prog->scale_x = scale; prog->scale_x = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_x = SSNES_SCALE_VIEWPORT; prog->type_x = RARCH_SCALE_VIEWPORT;
SSNES_LOG("Got outscale_x attr: %.1f\n", scale); RARCH_LOG("Got outscale_x attr: %.1f\n", scale);
x_attr_cnt++; x_attr_cnt++;
} }
@ -289,8 +289,8 @@ static bool get_xml_attrs(struct shader_program *prog, xmlNodePtr ptr)
float scale = strtod((const char*)attr_outscale_y, NULL); float scale = strtod((const char*)attr_outscale_y, NULL);
prog->scale_y = scale; prog->scale_y = scale;
prog->valid_scale = true; prog->valid_scale = true;
prog->type_y = SSNES_SCALE_VIEWPORT; prog->type_y = RARCH_SCALE_VIEWPORT;
SSNES_LOG("Got outscale_y attr: %.1f\n", scale); RARCH_LOG("Got outscale_y attr: %.1f\n", scale);
y_attr_cnt++; y_attr_cnt++;
} }
@ -325,7 +325,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
{ {
if (gl_teximage_cnt >= MAX_TEXTURES) if (gl_teximage_cnt >= MAX_TEXTURES)
{ {
SSNES_WARN("Too many texture images. Ignoring ...\n"); RARCH_WARN("Too many texture images. Ignoring ...\n");
return true; return true;
} }
@ -338,13 +338,13 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
if (!id) if (!id)
{ {
SSNES_ERR("Could not find ID in texture.\n"); RARCH_ERR("Could not find ID in texture.\n");
goto error; goto error;
} }
if (!filename) if (!filename)
{ {
SSNES_ERR("Could not find filename in texture.\n"); RARCH_ERR("Could not find filename in texture.\n");
goto error; goto error;
} }
@ -360,10 +360,10 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
strlcat(tex_path, (const char*)filename, sizeof(tex_path)); strlcat(tex_path, (const char*)filename, sizeof(tex_path));
SSNES_LOG("Loading texture image from: \"%s\" ...\n", tex_path); RARCH_LOG("Loading texture image from: \"%s\" ...\n", tex_path);
if (!texture_image_load(tex_path, &img)) if (!texture_image_load(tex_path, &img))
{ {
SSNES_ERR("Failed to load texture image from: \"%s\"\n", tex_path); RARCH_ERR("Failed to load texture image from: \"%s\"\n", tex_path);
goto error; goto error;
} }
@ -411,7 +411,7 @@ static bool get_script(const char *path, xmlNodePtr ptr)
{ {
if (*gl_tracker_script || gl_script_program) if (*gl_tracker_script || gl_script_program)
{ {
SSNES_ERR("Script already imported.\n"); RARCH_ERR("Script already imported.\n");
return false; return false;
} }
@ -425,7 +425,7 @@ static bool get_script(const char *path, xmlNodePtr ptr)
xmlChar *language = xmlGetProp(ptr, (const xmlChar*)"language"); xmlChar *language = xmlGetProp(ptr, (const xmlChar*)"language");
if (!language || strcmp((const char*)language, "python") != 0) if (!language || strcmp((const char*)language, "python") != 0)
{ {
SSNES_ERR("Script language is not Python.\n"); RARCH_ERR("Script language is not Python.\n");
if (language) if (language)
xmlFree(language); xmlFree(language);
return false; return false;
@ -450,7 +450,7 @@ static bool get_script(const char *path, xmlNodePtr ptr)
xmlChar *script = xmlNodeGetContent(ptr); xmlChar *script = xmlNodeGetContent(ptr);
if (!script) if (!script)
{ {
SSNES_ERR("No content in script.\n"); RARCH_ERR("No content in script.\n");
return false; return false;
} }
gl_script_program = script; gl_script_program = script;
@ -465,7 +465,7 @@ static bool get_import_value(xmlNodePtr ptr)
bool ret = true; bool ret = true;
if (gl_tracker_info_cnt >= MAX_VARIABLES) if (gl_tracker_info_cnt >= MAX_VARIABLES)
{ {
SSNES_ERR("Too many import variables ...\n"); RARCH_ERR("Too many import variables ...\n");
return false; return false;
} }
@ -478,41 +478,41 @@ static bool get_import_value(xmlNodePtr ptr)
unsigned memtype; unsigned memtype;
enum state_tracker_type tracker_type; enum state_tracker_type tracker_type;
enum state_ram_type ram_type = SSNES_STATE_NONE; enum state_ram_type ram_type = RARCH_STATE_NONE;
uint32_t addr = 0; uint32_t addr = 0;
unsigned mask_value = 0; unsigned mask_value = 0;
unsigned mask_equal = 0; unsigned mask_equal = 0;
if (!semantic || !id) if (!semantic || !id)
{ {
SSNES_ERR("No semantic or ID for import value.\n"); RARCH_ERR("No semantic or ID for import value.\n");
ret = false; ret = false;
goto end; goto end;
} }
if (strcmp((const char*)semantic, "capture") == 0) if (strcmp((const char*)semantic, "capture") == 0)
tracker_type = SSNES_STATE_CAPTURE; tracker_type = RARCH_STATE_CAPTURE;
else if (strcmp((const char*)semantic, "capture_previous") == 0) else if (strcmp((const char*)semantic, "capture_previous") == 0)
tracker_type = SSNES_STATE_CAPTURE_PREV; tracker_type = RARCH_STATE_CAPTURE_PREV;
else if (strcmp((const char*)semantic, "transition") == 0) else if (strcmp((const char*)semantic, "transition") == 0)
tracker_type = SSNES_STATE_TRANSITION; tracker_type = RARCH_STATE_TRANSITION;
else if (strcmp((const char*)semantic, "transition_count") == 0) else if (strcmp((const char*)semantic, "transition_count") == 0)
tracker_type = SSNES_STATE_TRANSITION_COUNT; tracker_type = RARCH_STATE_TRANSITION_COUNT;
else if (strcmp((const char*)semantic, "transition_previous") == 0) else if (strcmp((const char*)semantic, "transition_previous") == 0)
tracker_type = SSNES_STATE_TRANSITION_PREV; tracker_type = RARCH_STATE_TRANSITION_PREV;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
else if (strcmp((const char*)semantic, "python") == 0) else if (strcmp((const char*)semantic, "python") == 0)
tracker_type = SSNES_STATE_PYTHON; tracker_type = RARCH_STATE_PYTHON;
#endif #endif
else else
{ {
SSNES_ERR("Invalid semantic for import value.\n"); RARCH_ERR("Invalid semantic for import value.\n");
ret = false; ret = false;
goto end; goto end;
} }
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
if (tracker_type != SSNES_STATE_PYTHON) if (tracker_type != RARCH_STATE_PYTHON)
#endif #endif
{ {
if (input) if (input)
@ -521,14 +521,14 @@ static bool get_import_value(xmlNodePtr ptr)
switch (slot) switch (slot)
{ {
case 1: case 1:
ram_type = SSNES_STATE_INPUT_SLOT1; ram_type = RARCH_STATE_INPUT_SLOT1;
break; break;
case 2: case 2:
ram_type = SSNES_STATE_INPUT_SLOT2; ram_type = RARCH_STATE_INPUT_SLOT2;
break; break;
default: default:
SSNES_ERR("Invalid input slot for import.\n"); RARCH_ERR("Invalid input slot for import.\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -536,11 +536,11 @@ static bool get_import_value(xmlNodePtr ptr)
else if (wram) else if (wram)
{ {
addr = strtoul((const char*)wram, NULL, 16); addr = strtoul((const char*)wram, NULL, 16);
ram_type = SSNES_STATE_WRAM; ram_type = RARCH_STATE_WRAM;
} }
else else
{ {
SSNES_ERR("No RAM address specificed for import value.\n"); RARCH_ERR("No RAM address specificed for import value.\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -548,7 +548,7 @@ static bool get_import_value(xmlNodePtr ptr)
switch (ram_type) switch (ram_type)
{ {
case SSNES_STATE_WRAM: case RARCH_STATE_WRAM:
memtype = RETRO_MEMORY_SYSTEM_RAM; memtype = RETRO_MEMORY_SYSTEM_RAM;
break; break;
@ -558,7 +558,7 @@ static bool get_import_value(xmlNodePtr ptr)
if ((memtype != -1u) && (addr >= pretro_get_memory_size(memtype))) if ((memtype != -1u) && (addr >= pretro_get_memory_size(memtype)))
{ {
SSNES_ERR("Address out of bounds.\n"); RARCH_ERR("Address out of bounds.\n");
ret = false; ret = false;
goto end; goto end;
} }
@ -593,11 +593,11 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
xmlParserCtxtPtr ctx = xmlNewParserCtxt(); xmlParserCtxtPtr ctx = xmlNewParserCtxt();
if (!ctx) if (!ctx)
{ {
SSNES_ERR("Failed to load libxml2 context.\n"); RARCH_ERR("Failed to load libxml2 context.\n");
return false; return false;
} }
SSNES_LOG("Loading XML shader: %s\n", path); RARCH_LOG("Loading XML shader: %s\n", path);
xmlDocPtr doc = xmlCtxtReadFile(ctx, path, NULL, 0); xmlDocPtr doc = xmlCtxtReadFile(ctx, path, NULL, 0);
xmlNodePtr head = NULL; xmlNodePtr head = NULL;
xmlNodePtr cur = NULL; xmlNodePtr cur = NULL;
@ -605,13 +605,13 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
if (!doc) if (!doc)
{ {
SSNES_ERR("Failed to parse XML file: %s\n", path); RARCH_ERR("Failed to parse XML file: %s\n", path);
goto error; goto error;
} }
if (ctx->valid == 0) if (ctx->valid == 0)
{ {
SSNES_ERR("Cannot validate XML shader: %s\n", path); RARCH_ERR("Cannot validate XML shader: %s\n", path);
goto error; goto error;
} }
@ -653,7 +653,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
{ {
if (prog[num].vertex) if (prog[num].vertex)
{ {
SSNES_ERR("Cannot have more than one vertex shader in a program.\n"); RARCH_ERR("Cannot have more than one vertex shader in a program.\n");
xmlFree(content); xmlFree(content);
goto error; goto error;
} }
@ -665,7 +665,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
prog[num].fragment = (char*)content; prog[num].fragment = (char*)content;
if (!get_xml_attrs(&prog[num], cur)) if (!get_xml_attrs(&prog[num], cur))
{ {
SSNES_ERR("XML shader attributes do not comply with specifications.\n"); RARCH_ERR("XML shader attributes do not comply with specifications.\n");
goto error; goto error;
} }
num++; num++;
@ -674,7 +674,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
{ {
if (!get_texture_image(path, cur)) if (!get_texture_image(path, cur))
{ {
SSNES_ERR("Texture image failed to load.\n"); RARCH_ERR("Texture image failed to load.\n");
goto error; goto error;
} }
} }
@ -682,7 +682,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
{ {
if (!get_import_value(cur)) if (!get_import_value(cur))
{ {
SSNES_ERR("Import value is invalid.\n"); RARCH_ERR("Import value is invalid.\n");
goto error; goto error;
} }
} }
@ -691,7 +691,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
{ {
if (!get_script(path, cur)) if (!get_script(path, cur))
{ {
SSNES_ERR("Script is invalid.\n"); RARCH_ERR("Script is invalid.\n");
goto error; goto error;
} }
} }
@ -700,7 +700,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
if (num == 0) if (num == 0)
{ {
SSNES_ERR("Couldn't find vertex shader nor fragment shader in XML file.\n"); RARCH_ERR("Couldn't find vertex shader nor fragment shader in XML file.\n");
goto error; goto error;
} }
@ -709,7 +709,7 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s
return num; return num;
error: error:
SSNES_ERR("Failed to load XML shader ...\n"); RARCH_ERR("Failed to load XML shader ...\n");
if (doc) if (doc)
xmlFreeDoc(doc); xmlFreeDoc(doc);
xmlFreeParserCtxt(ctx); xmlFreeParserCtxt(ctx);
@ -733,7 +733,7 @@ static void print_shader_log(GLuint obj)
pglGetShaderInfoLog(obj, max_len, &info_len, info_log); pglGetShaderInfoLog(obj, max_len, &info_len, info_log);
if (info_len > 0) if (info_len > 0)
SSNES_LOG("Shader log: %s\n", info_log); RARCH_LOG("Shader log: %s\n", info_log);
free(info_log); free(info_log);
} }
@ -755,7 +755,7 @@ static void print_linker_log(GLuint obj)
pglGetProgramInfoLog(obj, max_len, &info_len, info_log); pglGetProgramInfoLog(obj, max_len, &info_len, info_log);
if (info_len > 0) if (info_len > 0)
SSNES_LOG("Linker log: %s\n", info_log); RARCH_LOG("Linker log: %s\n", info_log);
free(info_log); free(info_log);
} }
@ -797,17 +797,17 @@ static bool compile_programs(GLuint *gl_prog, struct shader_program *progs, size
if (gl_prog[i] == 0) if (gl_prog[i] == 0)
{ {
SSNES_ERR("Failed to create GL program #%u.\n", i); RARCH_ERR("Failed to create GL program #%u.\n", i);
return false; return false;
} }
if (progs[i].vertex) if (progs[i].vertex)
{ {
SSNES_LOG("Found GLSL vertex shader.\n"); RARCH_LOG("Found GLSL vertex shader.\n");
GLuint shader = pglCreateShader(GL_VERTEX_SHADER); GLuint shader = pglCreateShader(GL_VERTEX_SHADER);
if (!compile_shader(shader, progs[i].vertex)) if (!compile_shader(shader, progs[i].vertex))
{ {
SSNES_ERR("Failed to compile vertex shader #%u\n", i); RARCH_ERR("Failed to compile vertex shader #%u\n", i);
return false; return false;
} }
@ -817,11 +817,11 @@ static bool compile_programs(GLuint *gl_prog, struct shader_program *progs, size
if (progs[i].fragment) if (progs[i].fragment)
{ {
SSNES_LOG("Found GLSL fragment shader.\n"); RARCH_LOG("Found GLSL fragment shader.\n");
GLuint shader = pglCreateShader(GL_FRAGMENT_SHADER); GLuint shader = pglCreateShader(GL_FRAGMENT_SHADER);
if (!compile_shader(shader, progs[i].fragment)) if (!compile_shader(shader, progs[i].fragment))
{ {
SSNES_ERR("Failed to compile fragment shader #%u\n", i); RARCH_ERR("Failed to compile fragment shader #%u\n", i);
return false; return false;
} }
@ -831,10 +831,10 @@ static bool compile_programs(GLuint *gl_prog, struct shader_program *progs, size
if (progs[i].vertex || progs[i].fragment) if (progs[i].vertex || progs[i].fragment)
{ {
SSNES_LOG("Linking GLSL program.\n"); RARCH_LOG("Linking GLSL program.\n");
if (!link_program(gl_prog[i])) if (!link_program(gl_prog[i]))
{ {
SSNES_ERR("Failed to link program #%u\n", i); RARCH_ERR("Failed to link program #%u\n", i);
return false; return false;
} }
@ -886,7 +886,7 @@ bool gl_glsl_init(const char *path)
LOAD_GL_SYM(VertexAttribPointer); LOAD_GL_SYM(VertexAttribPointer);
#endif #endif
SSNES_LOG("Checking GLSL shader support ...\n"); RARCH_LOG("Checking GLSL shader support ...\n");
#ifdef __APPLE__ #ifdef __APPLE__
const bool shader_support = true; const bool shader_support = true;
#else #else
@ -902,7 +902,7 @@ bool gl_glsl_init(const char *path)
if (!shader_support) if (!shader_support)
{ {
SSNES_ERR("GLSL shaders aren't supported by your OpenGL driver.\n"); RARCH_ERR("GLSL shaders aren't supported by your OpenGL driver.\n");
return false; return false;
} }
@ -918,7 +918,7 @@ bool gl_glsl_init(const char *path)
if (num_progs == 0) if (num_progs == 0)
{ {
SSNES_ERR("Couldn't find any valid shaders in XML file.\n"); RARCH_ERR("Couldn't find any valid shaders in XML file.\n");
return false; return false;
} }
@ -948,13 +948,13 @@ bool gl_glsl_init(const char *path)
} }
else else
{ {
SSNES_ERR("Did not find valid shader in secondary shader file.\n"); RARCH_ERR("Did not find valid shader in secondary shader file.\n");
return false; return false;
} }
} }
//if (!gl_check_error()) //if (!gl_check_error())
// SSNES_WARN("Detected GL error.\n"); // RARCH_WARN("Detected GL error.\n");
if (gl_tracker_info_cnt > 0) if (gl_tracker_info_cnt > 0)
{ {
@ -977,7 +977,7 @@ bool gl_glsl_init(const char *path)
gl_state_tracker = state_tracker_init(&info); gl_state_tracker = state_tracker_init(&info);
if (!gl_state_tracker) if (!gl_state_tracker)
SSNES_WARN("Failed to init state tracker.\n"); RARCH_WARN("Failed to init state tracker.\n");
} }
glsl_enable = true; glsl_enable = true;
@ -1250,14 +1250,14 @@ bool gl_glsl_filter_type(unsigned index, bool *smooth)
switch (gl_filter_type[index]) switch (gl_filter_type[index])
{ {
case SSNES_GL_NOFORCE: case RARCH_GL_NOFORCE:
return false; return false;
case SSNES_GL_NEAREST: case RARCH_GL_NEAREST:
*smooth = false; *smooth = false;
return true; return true;
case SSNES_GL_LINEAR: case RARCH_GL_LINEAR:
*smooth = true; *smooth = true;
return true; return true;

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_GLSL_H #ifndef __RARCH_GLSL_H
#define __SSNES_GLSL_H #define __RARCH_GLSL_H
#include "../boolean.h" #include "../boolean.h"
#include "gl_common.h" #include "gl_common.h"

View File

@ -40,7 +40,7 @@ struct hlsl_program
}; };
static IDirect3DDevice9 *d3d_device_ptr; static IDirect3DDevice9 *d3d_device_ptr;
static struct hlsl_program prg[SSNES_HLSL_MAX_SHADERS] = {0}; static struct hlsl_program prg[RARCH_HLSL_MAX_SHADERS] = {0};
static bool hlsl_active = false; static bool hlsl_active = false;
static unsigned active_index = 0; static unsigned active_index = 0;
@ -156,11 +156,11 @@ static bool load_program(unsigned index, const char *prog, bool path_is_file)
if (FAILED(ret_fp) || FAILED(ret_vp) || listing_v || listing_f) if (FAILED(ret_fp) || FAILED(ret_vp) || listing_v || listing_f)
{ {
SSNES_ERR("HLSL error:\n"); RARCH_ERR("HLSL error:\n");
if(listing_f) if(listing_f)
SSNES_ERR("Fragment:\n%s\n", (char*)listing_f->GetBufferPointer()); RARCH_ERR("Fragment:\n%s\n", (char*)listing_f->GetBufferPointer());
if(listing_v) if(listing_v)
SSNES_ERR("Vertex:\n%s\n", (char*)listing_v->GetBufferPointer()); RARCH_ERR("Vertex:\n%s\n", (char*)listing_v->GetBufferPointer());
ret = false; ret = false;
goto end; goto end;
@ -188,7 +188,7 @@ static bool load_stock(void)
{ {
if (!load_program(0, stock_hlsl_program, false)) if (!load_program(0, stock_hlsl_program, false))
{ {
SSNES_ERR("Failed to compile passthrough shader, is something wrong with your environment?\n"); RARCH_ERR("Failed to compile passthrough shader, is something wrong with your environment?\n");
return false; return false;
} }
@ -202,7 +202,7 @@ static bool load_plain(const char *path)
return false; return false;
#endif #endif
SSNES_LOG("Loading HLSL file: %s\n", path); RARCH_LOG("Loading HLSL file: %s\n", path);
if (!load_program(0, path, true)) if (!load_program(0, path, true))
return false; return false;
@ -212,7 +212,7 @@ static bool load_plain(const char *path)
static void hlsl_deinit_progs(void) static void hlsl_deinit_progs(void)
{ {
for(int i = 0; i < SSNES_HLSL_MAX_SHADERS; i++) for(int i = 0; i < RARCH_HLSL_MAX_SHADERS; i++)
{ {
if (prg[i].fprg) if (prg[i].fprg)
prg[i].fprg->Release(); prg[i].fprg->Release();

View File

@ -15,8 +15,8 @@
*/ */
#ifndef __SSNES_HLSL_H #ifndef __RARCH_HLSL_H
#define __SSNES_HLSL_H #define __RARCH_HLSL_H
#include "../boolean.h" #include "../boolean.h"
#include <stdint.h> #include <stdint.h>
@ -34,6 +34,6 @@ void hlsl_set_params(unsigned width, unsigned height,
void hlsl_use(unsigned index); void hlsl_use(unsigned index);
#define SSNES_HLSL_MAX_SHADERS 16 #define RARCH_HLSL_MAX_SHADERS 16
#endif #endif

View File

@ -73,7 +73,7 @@ state_tracker_t* state_tracker_init(const struct state_tracker_info *info)
if (!tracker->py) if (!tracker->py)
{ {
free(tracker); free(tracker);
SSNES_ERR("Failed to init Python script.\n"); RARCH_ERR("Failed to init Python script.\n");
return NULL; return NULL;
} }
} }
@ -91,7 +91,7 @@ state_tracker_t* state_tracker_init(const struct state_tracker_info *info)
tracker->info[i].equal = info->info[i].equal; tracker->info[i].equal = info->info[i].equal;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
if (info->info[i].type == SSNES_STATE_PYTHON) if (info->info[i].type == RARCH_STATE_PYTHON)
tracker->info[i].py = tracker->py; tracker->info[i].py = tracker->py;
#endif #endif
@ -100,14 +100,14 @@ state_tracker_t* state_tracker_init(const struct state_tracker_info *info)
switch (info->info[i].ram_type) switch (info->info[i].ram_type)
{ {
case SSNES_STATE_WRAM: case RARCH_STATE_WRAM:
tracker->info[i].ptr = info->wram ? info->wram : &empty; tracker->info[i].ptr = info->wram ? info->wram : &empty;
break; break;
case SSNES_STATE_INPUT_SLOT1: case RARCH_STATE_INPUT_SLOT1:
tracker->info[i].input_ptr = &tracker->input_state[0]; tracker->info[i].input_ptr = &tracker->input_state[0];
tracker->info[i].is_input = true; tracker->info[i].is_input = true;
break; break;
case SSNES_STATE_INPUT_SLOT2: case RARCH_STATE_INPUT_SLOT2:
tracker->info[i].input_ptr = &tracker->input_state[1]; tracker->info[i].input_ptr = &tracker->input_state[1];
tracker->info[i].is_input = true; tracker->info[i].is_input = true;
break; break;
@ -154,11 +154,11 @@ static void update_element(
switch (info->type) switch (info->type)
{ {
case SSNES_STATE_CAPTURE: case RARCH_STATE_CAPTURE:
uniform->value = fetch(info); uniform->value = fetch(info);
break; break;
case SSNES_STATE_CAPTURE_PREV: case RARCH_STATE_CAPTURE_PREV:
if (info->prev[0] != fetch(info)) if (info->prev[0] != fetch(info))
{ {
info->prev[1] = info->prev[0]; info->prev[1] = info->prev[0];
@ -167,7 +167,7 @@ static void update_element(
uniform->value = info->prev[1]; uniform->value = info->prev[1];
break; break;
case SSNES_STATE_TRANSITION: case RARCH_STATE_TRANSITION:
if (info->old_value != fetch(info)) if (info->old_value != fetch(info))
{ {
info->old_value = fetch(info); info->old_value = fetch(info);
@ -176,7 +176,7 @@ static void update_element(
uniform->value = info->frame_count; uniform->value = info->frame_count;
break; break;
case SSNES_STATE_TRANSITION_COUNT: case RARCH_STATE_TRANSITION_COUNT:
if (info->old_value != fetch(info)) if (info->old_value != fetch(info))
{ {
info->old_value = fetch(info); info->old_value = fetch(info);
@ -185,7 +185,7 @@ static void update_element(
uniform->value = info->transition_count; uniform->value = info->transition_count;
break; break;
case SSNES_STATE_TRANSITION_PREV: case RARCH_STATE_TRANSITION_PREV:
if (info->old_value != fetch(info)) if (info->old_value != fetch(info))
{ {
info->old_value = fetch(info); info->old_value = fetch(info);
@ -196,7 +196,7 @@ static void update_element(
break; break;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
case SSNES_STATE_PYTHON: case RARCH_STATE_PYTHON:
uniform->value = py_state_get(info->py, info->id, frame_count); uniform->value = py_state_get(info->py, info->id, frame_count);
break; break;
#endif #endif

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_SNES_TRACKER_H #ifndef __RARCH_SNES_TRACKER_H
#define __SSNES_SNES_TRACKER_H #define __RARCH_SNES_TRACKER_H
#include <stdint.h> #include <stdint.h>
#include "../boolean.h" #include "../boolean.h"
@ -26,21 +26,21 @@
enum state_tracker_type enum state_tracker_type
{ {
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
SSNES_STATE_PYTHON, RARCH_STATE_PYTHON,
#endif #endif
SSNES_STATE_CAPTURE, RARCH_STATE_CAPTURE,
SSNES_STATE_CAPTURE_PREV, RARCH_STATE_CAPTURE_PREV,
SSNES_STATE_TRANSITION, RARCH_STATE_TRANSITION,
SSNES_STATE_TRANSITION_COUNT, RARCH_STATE_TRANSITION_COUNT,
SSNES_STATE_TRANSITION_PREV RARCH_STATE_TRANSITION_PREV
}; };
enum state_ram_type enum state_ram_type
{ {
SSNES_STATE_NONE, RARCH_STATE_NONE,
SSNES_STATE_WRAM, RARCH_STATE_WRAM,
SSNES_STATE_INPUT_SLOT1, RARCH_STATE_INPUT_SLOT1,
SSNES_STATE_INPUT_SLOT2 RARCH_STATE_INPUT_SLOT2
}; };
struct state_tracker_uniform_info struct state_tracker_uniform_info

View File

@ -83,7 +83,7 @@ static void xv_set_nonblock_state(void *data, bool state)
if (atom != None && xv->port) if (atom != None && xv->port)
XvSetPortAttribute(xv->display, xv->port, atom, !state); XvSetPortAttribute(xv->display, xv->port, atom, !state);
else else
SSNES_WARN("Failed to set SYNC_TO_VBLANK attribute.\n"); RARCH_WARN("Failed to set SYNC_TO_VBLANK attribute.\n");
} }
static volatile sig_atomic_t g_quit = 0; static volatile sig_atomic_t g_quit = 0;
@ -155,7 +155,7 @@ static void set_fullscreen(xv_t *xv)
if (!XA_NET_WM_STATE || !XA_NET_WM_STATE_FULLSCREEN) if (!XA_NET_WM_STATE || !XA_NET_WM_STATE_FULLSCREEN)
{ {
SSNES_WARN("X11: Cannot set fullscreen.\n"); RARCH_WARN("X11: Cannot set fullscreen.\n");
return; return;
} }
@ -204,10 +204,10 @@ static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size)
r, g, b); r, g, b);
} }
else else
SSNES_WARN("Failed to init font.\n"); RARCH_WARN("Failed to init font.\n");
} }
else else
SSNES_LOG("Did not find default font.\n"); RARCH_LOG("Did not find default font.\n");
#endif #endif
} }
@ -416,7 +416,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
if (!XShmQueryExtension(xv->display)) if (!XShmQueryExtension(xv->display))
{ {
SSNES_ERR("XVideo: XShm extension not found.\n"); RARCH_ERR("XVideo: XShm extension not found.\n");
goto error; goto error;
} }
@ -438,14 +438,14 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
xv->depth = adaptor_info[i].formats->depth; xv->depth = adaptor_info[i].formats->depth;
xv->visualid = adaptor_info[i].formats->visual_id; xv->visualid = adaptor_info[i].formats->visual_id;
SSNES_LOG("XVideo: Found suitable XvPort #%u\n", (unsigned)xv->port); RARCH_LOG("XVideo: Found suitable XvPort #%u\n", (unsigned)xv->port);
break; break;
} }
XvFreeAdaptorInfo(adaptor_info); XvFreeAdaptorInfo(adaptor_info);
if (xv->port == 0) if (xv->port == 0)
{ {
SSNES_ERR("XVideo: Failed to find valid XvPort or format.\n"); RARCH_ERR("XVideo: Failed to find valid XvPort or format.\n");
goto error; goto error;
} }
@ -457,7 +457,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
if (visualmatches < 1 || !visualinfo->visual) if (visualmatches < 1 || !visualinfo->visual)
{ {
if (visualinfo) XFree(visualinfo); if (visualinfo) XFree(visualinfo);
SSNES_ERR("XVideo: Unable to find Xv-compatible visual.\n"); RARCH_ERR("XVideo: Unable to find Xv-compatible visual.\n");
goto error; goto error;
} }
@ -497,7 +497,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
xv->image = XvShmCreateImage(xv->display, xv->port, xv->fourcc, NULL, xv->width, xv->height, &xv->shminfo); xv->image = XvShmCreateImage(xv->display, xv->port, xv->fourcc, NULL, xv->width, xv->height, &xv->shminfo);
if (!xv->image) if (!xv->image)
{ {
SSNES_ERR("XVideo: XShmCreateImage failed.\n"); RARCH_ERR("XVideo: XShmCreateImage failed.\n");
goto error; goto error;
} }
xv->width = xv->image->width; xv->width = xv->image->width;
@ -508,7 +508,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
xv->shminfo.readOnly = false; xv->shminfo.readOnly = false;
if (!XShmAttach(xv->display, &xv->shminfo)) if (!XShmAttach(xv->display, &xv->shminfo))
{ {
SSNES_ERR("XVideo: XShmAttach failed.\n"); RARCH_ERR("XVideo: XShmAttach failed.\n");
goto error; goto error;
} }
XSync(xv->display, False); XSync(xv->display, False);
@ -563,7 +563,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
xv->image = XvShmCreateImage(xv->display, xv->port, xv->fourcc, NULL, xv->width, xv->height, &xv->shminfo); xv->image = XvShmCreateImage(xv->display, xv->port, xv->fourcc, NULL, xv->width, xv->height, &xv->shminfo);
if (xv->image == None) if (xv->image == None)
{ {
SSNES_ERR("Failed to create image.\n"); RARCH_ERR("Failed to create image.\n");
return false; return false;
} }
@ -573,7 +573,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777); xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
if (xv->shminfo.shmid < 0) if (xv->shminfo.shmid < 0)
{ {
SSNES_ERR("Failed to init SHM.\n"); RARCH_ERR("Failed to init SHM.\n");
return false; return false;
} }
@ -582,7 +582,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
if (!XShmAttach(xv->display, &xv->shminfo)) if (!XShmAttach(xv->display, &xv->shminfo))
{ {
SSNES_ERR("Failed to reattch XvShm image.\n"); RARCH_ERR("Failed to reattch XvShm image.\n");
return false; return false;
} }
XSync(xv->display, False); XSync(xv->display, False);

4
hash.h
View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_HASH_H #ifndef __RARCH_HASH_H
#define __SSNES_HASH_H #define __RARCH_HASH_H
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ssnes_dinput.h" #include "rarch_dinput.h"
#include "SDL.h" #include "SDL.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#include "../boolean.h" #include "../boolean.h"
@ -110,7 +110,7 @@ sdl_dinput_t* sdl_dinput_init(void)
if (!sdlwrap_get_wm_info(&info)) if (!sdlwrap_get_wm_info(&info))
{ {
SSNES_ERR("Failed to get SysWM info.\n"); RARCH_ERR("Failed to get SysWM info.\n");
goto error; goto error;
} }
@ -130,13 +130,13 @@ sdl_dinput_t* sdl_dinput_init(void)
(void**)&di->ctx, NULL))) (void**)&di->ctx, NULL)))
#endif #endif
{ {
SSNES_ERR("Failed to init DirectInput.\n"); RARCH_ERR("Failed to init DirectInput.\n");
goto error; goto error;
} }
SSNES_LOG("Enumerating DInput devices ...\n"); RARCH_LOG("Enumerating DInput devices ...\n");
IDirectInput8_EnumDevices(di->ctx, DI8DEVCLASS_GAMECTRL, enum_joypad_cb, di, DIEDFL_ATTACHEDONLY); IDirectInput8_EnumDevices(di->ctx, DI8DEVCLASS_GAMECTRL, enum_joypad_cb, di, DIEDFL_ATTACHEDONLY);
SSNES_LOG("Done enumerating DInput devices ...\n"); RARCH_LOG("Done enumerating DInput devices ...\n");
return di; return di;

View File

@ -13,13 +13,13 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_KEYSYM_H #ifndef __RARCH_KEYSYM_H
#define __SSNES_KEYSYM_H #define __RARCH_KEYSYM_H
// Global keysym table for SSNES. // Global keysym table for SSNES.
// As you may have noticed, it's the same as SDL 1.2 since I'm lazy. // As you may have noticed, it's the same as SDL 1.2 since I'm lazy.
enum ssnes_key enum rarch_key
{ {
SK_UNKNOWN = 0, SK_UNKNOWN = 0,
SK_FIRST = 0, SK_FIRST = 0,

View File

@ -13,14 +13,14 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_SDL_INPUT_H #ifndef __RARCH_SDL_INPUT_H
#define __SSNES_SDL_INPUT_H #define __RARCH_SDL_INPUT_H
#include "SDL.h" #include "SDL.h"
#include "../general.h" #include "../general.h"
#ifdef HAVE_DINPUT #ifdef HAVE_DINPUT
#include "ssnes_dinput.h" #include "rarch_dinput.h"
#endif #endif
typedef struct sdl_input typedef struct sdl_input

View File

@ -21,13 +21,13 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include "../libretro.h" #include "../libretro.h"
#include "ssnes_sdl_input.h" #include "rarch_sdl_input.h"
#include "keysym.h" #include "keysym.h"
struct key_bind struct key_bind
{ {
unsigned sdl; unsigned sdl;
enum ssnes_key sk; enum rarch_key sk;
}; };
static unsigned keysym_lut[SK_LAST]; static unsigned keysym_lut[SK_LAST];
@ -137,7 +137,7 @@ static void *sdl_input_init(void)
if (!sdl->di) if (!sdl->di)
{ {
free(sdl); free(sdl);
SSNES_ERR("Failed to init SDL/DInput.\n"); RARCH_ERR("Failed to init SDL/DInput.\n");
return NULL; return NULL;
} }
#else #else
@ -160,19 +160,19 @@ static void *sdl_input_init(void)
sdl->joysticks[i] = SDL_JoystickOpen(port); sdl->joysticks[i] = SDL_JoystickOpen(port);
if (!sdl->joysticks[i]) if (!sdl->joysticks[i])
{ {
SSNES_ERR("Couldn't open SDL joystick #%u on SNES port %u\n", port, i + 1); RARCH_ERR("Couldn't open SDL joystick #%u on SNES port %u\n", port, i + 1);
free(sdl); free(sdl);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK); SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return NULL; return NULL;
} }
SSNES_LOG("Opened Joystick: %s (#%u) on port %u\n", RARCH_LOG("Opened Joystick: %s (#%u) on port %u\n",
SDL_JoystickName(port), port, i + 1); SDL_JoystickName(port), port, i + 1);
sdl->num_axes[i] = SDL_JoystickNumAxes(sdl->joysticks[i]); sdl->num_axes[i] = SDL_JoystickNumAxes(sdl->joysticks[i]);
sdl->num_buttons[i] = SDL_JoystickNumButtons(sdl->joysticks[i]); sdl->num_buttons[i] = SDL_JoystickNumButtons(sdl->joysticks[i]);
sdl->num_hats[i] = SDL_JoystickNumHats(sdl->joysticks[i]); sdl->num_hats[i] = SDL_JoystickNumHats(sdl->joysticks[i]);
SSNES_LOG("Joypad has: %u axes, %u buttons, %u hats.\n", RARCH_LOG("Joypad has: %u axes, %u buttons, %u hats.\n",
sdl->num_axes[i], sdl->num_buttons[i], sdl->num_hats[i]); sdl->num_axes[i], sdl->num_buttons[i], sdl->num_hats[i]);
} }
#endif #endif
@ -269,7 +269,7 @@ static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct sne
static bool sdl_bind_button_pressed(void *data, int key) static bool sdl_bind_button_pressed(void *data, int key)
{ {
const struct snes_keybind *binds = g_settings.input.binds[0]; const struct snes_keybind *binds = g_settings.input.binds[0];
if (key >= 0 && key < SSNES_BIND_LIST_END) if (key >= 0 && key < RARCH_BIND_LIST_END)
{ {
const struct snes_keybind *bind = &binds[key]; const struct snes_keybind *bind = &binds[key];
return sdl_is_pressed((sdl_input_t*)data, 0, bind); return sdl_is_pressed((sdl_input_t*)data, 0, bind);
@ -282,7 +282,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct snes_keybi
unsigned port_num, unsigned id) unsigned port_num, unsigned id)
{ {
const struct snes_keybind *binds = binds_[port_num]; const struct snes_keybind *binds = binds_[port_num];
if (id < SSNES_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
const struct snes_keybind *bind = &binds[id]; const struct snes_keybind *bind = &binds[id];
return bind->valid ? (sdl_is_pressed(sdl, port_num, bind) ? 1 : 0) : 0; return bind->valid ? (sdl_is_pressed(sdl, port_num, bind) ? 1 : 0) : 0;

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_DINPUT_H #ifndef __RARCH_DINPUT_H
#define __SSNES_DINPUT_H #define __RARCH_DINPUT_H
#undef DIRECTINPUT_VERSION #undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800

View File

@ -20,7 +20,7 @@
#include "general.h" #include "general.h"
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include "ssnes_sdl_input.h" #include "rarch_sdl_input.h"
#include "keysym.h" #include "keysym.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -37,7 +37,7 @@ typedef struct x11_input
struct key_bind struct key_bind
{ {
unsigned x; unsigned x;
enum ssnes_key sk; enum rarch_key sk;
}; };
static unsigned keysym_lut[SK_LAST]; static unsigned keysym_lut[SK_LAST];
@ -171,7 +171,7 @@ static bool x_key_pressed(x11_input_t *x11, int key)
static bool x_is_pressed(x11_input_t *x11, const struct snes_keybind *binds, unsigned id) static bool x_is_pressed(x11_input_t *x11, const struct snes_keybind *binds, unsigned id)
{ {
if (id < SSNES_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
const struct snes_keybind *bind = &binds[id]; const struct snes_keybind *bind = &binds[id];
return bind->valid && x_key_pressed(x11, binds[id].key); return bind->valid && x_key_pressed(x11, binds[id].key);

View File

@ -14,42 +14,42 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_LOGGER_OVERRIDE_H #ifndef __RARCH_LOGGER_OVERRIDE_H
#define __SSNES_LOGGER_OVERRIDE_H #define __RARCH_LOGGER_OVERRIDE_H
#if defined(HAVE_LOGGER) #if defined(HAVE_LOGGER)
#include "console/logger/logger.h" #include "console/logger/logger.h"
#define SSNES_LOG(...) do { \ #define RARCH_LOG(...) do { \
if (g_extern.verbose) logger_send("SSNES: " __VA_ARGS__); \ if (g_extern.verbose) logger_send("SSNES: " __VA_ARGS__); \
} while(0) } while(0)
#define SSNES_ERR(...) do { \ #define RARCH_ERR(...) do { \
logger_send("RetroArch [ERROR] :: " __VA_ARGS__); \ logger_send("RetroArch [ERROR] :: " __VA_ARGS__); \
} while(0) } while(0)
#define SSNES_WARN(...) do { \ #define RARCH_WARN(...) do { \
logger_send("RetroArch [WARN] :: " __VA_ARGS__); \ logger_send("RetroArch [WARN] :: " __VA_ARGS__); \
} while(0) } while(0)
#elif defined(HAVE_FILE_LOGGER) #elif defined(HAVE_FILE_LOGGER)
extern FILE * log_fp; extern FILE * log_fp;
#ifndef SSNES_LOG #ifndef RARCH_LOG
#define SSNES_LOG(...) do { \ #define RARCH_LOG(...) do { \
if (g_extern.verbose) \ if (g_extern.verbose) \
fprintf(log_fp, "SSNES: " __VA_ARGS__); \ fprintf(log_fp, "SSNES: " __VA_ARGS__); \
fflush(log_fp); \ fflush(log_fp); \
} while (0) } while (0)
#endif #endif
#ifndef SSNES_ERR #ifndef RARCH_ERR
#define SSNES_ERR(...) do { \ #define RARCH_ERR(...) do { \
fprintf(log_fp, "RetroArch [ERROR] :: " __VA_ARGS__); \ fprintf(log_fp, "RetroArch [ERROR] :: " __VA_ARGS__); \
fflush(log_fp); \ fflush(log_fp); \
} while (0) } while (0)
#endif #endif
#ifndef SSNES_WARN #ifndef RARCH_WARN
#define SSNES_WARN(...) do { \ #define RARCH_WARN(...) do { \
fprintf(log_fp, "RetroArch [WARN] :: " __VA_ARGS__); \ fprintf(log_fp, "RetroArch [WARN] :: " __VA_ARGS__); \
fflush(log_fp); \ fflush(log_fp); \
} while (0) } while (0)

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_MSG_QUEUE_H #ifndef __RARCH_MSG_QUEUE_H
#define __SSNES_MSG_QUEUE_H #define __RARCH_MSG_QUEUE_H
#include <stddef.h> #include <stddef.h>

18
movie.c
View File

@ -44,26 +44,26 @@ static bool init_playback(bsv_movie_t *handle, const char *path)
handle->file = fopen(path, "rb"); handle->file = fopen(path, "rb");
if (!handle->file) if (!handle->file)
{ {
SSNES_ERR("Couldn't open BSV file \"%s\" for playback.\n", path); RARCH_ERR("Couldn't open BSV file \"%s\" for playback.\n", path);
return false; return false;
} }
uint32_t header[4] = {0}; uint32_t header[4] = {0};
if (fread(header, sizeof(uint32_t), 4, handle->file) != 4) if (fread(header, sizeof(uint32_t), 4, handle->file) != 4)
{ {
SSNES_ERR("Couldn't read movie header.\n"); RARCH_ERR("Couldn't read movie header.\n");
return false; return false;
} }
// Compatibility with old implementation that used incorrect documentation. // Compatibility with old implementation that used incorrect documentation.
if (swap_if_little32(header[MAGIC_INDEX]) != BSV_MAGIC && swap_if_big32(header[MAGIC_INDEX]) != BSV_MAGIC) if (swap_if_little32(header[MAGIC_INDEX]) != BSV_MAGIC && swap_if_big32(header[MAGIC_INDEX]) != BSV_MAGIC)
{ {
SSNES_ERR("Movie file is not a valid BSV1 file.\n"); RARCH_ERR("Movie file is not a valid BSV1 file.\n");
return false; return false;
} }
if (swap_if_big32(header[CRC_INDEX]) != g_extern.cart_crc) if (swap_if_big32(header[CRC_INDEX]) != g_extern.cart_crc)
SSNES_WARN("CRC32 checksum mismatch between ROM file and saved ROM checksum in replay file header; replay highly likely to desync on playback.\n"); RARCH_WARN("CRC32 checksum mismatch between ROM file and saved ROM checksum in replay file header; replay highly likely to desync on playback.\n");
uint32_t state_size = swap_if_big32(header[STATE_SIZE_INDEX]); uint32_t state_size = swap_if_big32(header[STATE_SIZE_INDEX]);
@ -76,14 +76,14 @@ static bool init_playback(bsv_movie_t *handle, const char *path)
if (fread(handle->state, 1, state_size, handle->file) != state_size) if (fread(handle->state, 1, state_size, handle->file) != state_size)
{ {
SSNES_ERR("Couldn't read state from movie.\n"); RARCH_ERR("Couldn't read state from movie.\n");
return false; return false;
} }
if (pretro_serialize_size() == state_size) if (pretro_serialize_size() == state_size)
pretro_unserialize(handle->state, state_size); pretro_unserialize(handle->state, state_size);
else else
SSNES_WARN("Movie format seems to have a different serializer version. Will most likely fail.\n"); RARCH_WARN("Movie format seems to have a different serializer version. Will most likely fail.\n");
} }
handle->min_file_pos = sizeof(header) + state_size; handle->min_file_pos = sizeof(header) + state_size;
@ -96,7 +96,7 @@ static bool init_record(bsv_movie_t *handle, const char *path)
handle->file = fopen(path, "wb"); handle->file = fopen(path, "wb");
if (!handle->file) if (!handle->file)
{ {
SSNES_ERR("Couldn't open BSV \"%s\" for recording.\n", path); RARCH_ERR("Couldn't open BSV \"%s\" for recording.\n", path);
return false; return false;
} }
@ -155,13 +155,13 @@ void bsv_movie_set_input(bsv_movie_t *handle, int16_t input)
fwrite(&input, sizeof(int16_t), 1, handle->file); fwrite(&input, sizeof(int16_t), 1, handle->file);
} }
bsv_movie_t *bsv_movie_init(const char *path, enum ssnes_movie_type type) bsv_movie_t *bsv_movie_init(const char *path, enum rarch_movie_type type)
{ {
bsv_movie_t *handle = (bsv_movie_t*)calloc(1, sizeof(*handle)); bsv_movie_t *handle = (bsv_movie_t*)calloc(1, sizeof(*handle));
if (!handle) if (!handle)
return NULL; return NULL;
if (type == SSNES_MOVIE_PLAYBACK) if (type == RARCH_MOVIE_PLAYBACK)
{ {
if (!init_playback(handle, path)) if (!init_playback(handle, path))
goto error; goto error;

12
movie.h
View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_MOVIE_H #ifndef __RARCH_MOVIE_H
#define __SSNES_MOVIE_H #define __RARCH_MOVIE_H
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
@ -29,13 +29,13 @@
typedef struct bsv_movie bsv_movie_t; typedef struct bsv_movie bsv_movie_t;
enum ssnes_movie_type enum rarch_movie_type
{ {
SSNES_MOVIE_PLAYBACK, RARCH_MOVIE_PLAYBACK,
SSNES_MOVIE_RECORD RARCH_MOVIE_RECORD
}; };
bsv_movie_t *bsv_movie_init(const char *path, enum ssnes_movie_type type); bsv_movie_t *bsv_movie_init(const char *path, enum rarch_movie_type type);
// Playback // Playback
bool bsv_movie_get_input(bsv_movie_t *handle, int16_t *input); bool bsv_movie_get_input(bsv_movie_t *handle, int16_t *input);

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_MSVC_COMPAT_H #ifndef __RARCH_MSVC_COMPAT_H
#define __SSNES_MSVC_COMPAT_H #define __RARCH_MSVC_COMPAT_H
#ifdef _MSC_VER #ifdef _MSC_VER

108
netplay.c
View File

@ -174,7 +174,7 @@ static bool recv_all(int fd, void *data_, size_t size)
static void warn_hangup(void) static void warn_hangup(void)
{ {
SSNES_WARN("Netplay has disconnected. Will continue without connection ...\n"); RARCH_WARN("Netplay has disconnected. Will continue without connection ...\n");
if (g_extern.msg_queue) if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, "Netplay has disconnected. Will continue without connection.", 0, 480); msg_queue_push(g_extern.msg_queue, "Netplay has disconnected. Will continue without connection.", 0, 480);
} }
@ -258,7 +258,7 @@ static void log_connection(const struct sockaddr_storage *their_addr,
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)", nick, str, slot); snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)", nick, str, slot);
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
} }
} }
#endif #endif
@ -287,7 +287,7 @@ static bool init_tcp_socket(netplay_t *handle, const char *server, uint16_t port
handle->fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); handle->fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (handle->fd < 0) if (handle->fd < 0)
{ {
SSNES_ERR("Failed to init socket...\n"); RARCH_ERR("Failed to init socket...\n");
if (res) if (res)
freeaddrinfo(res); freeaddrinfo(res);
@ -298,7 +298,7 @@ static bool init_tcp_socket(netplay_t *handle, const char *server, uint16_t port
{ {
if (connect(handle->fd, res->ai_addr, res->ai_addrlen) < 0) if (connect(handle->fd, res->ai_addr, res->ai_addrlen) < 0)
{ {
SSNES_ERR("Failed to connect to server.\n"); RARCH_ERR("Failed to connect to server.\n");
close(handle->fd); close(handle->fd);
handle->fd = -1; handle->fd = -1;
freeaddrinfo(res); freeaddrinfo(res);
@ -313,7 +313,7 @@ static bool init_tcp_socket(netplay_t *handle, const char *server, uint16_t port
if (bind(handle->fd, res->ai_addr, res->ai_addrlen) < 0 || if (bind(handle->fd, res->ai_addr, res->ai_addrlen) < 0 ||
listen(handle->fd, MAX_SPECTATORS) < 0) listen(handle->fd, MAX_SPECTATORS) < 0)
{ {
SSNES_ERR("Failed to bind socket.\n"); RARCH_ERR("Failed to bind socket.\n");
close(handle->fd); close(handle->fd);
handle->fd = -1; handle->fd = -1;
freeaddrinfo(res); freeaddrinfo(res);
@ -328,7 +328,7 @@ static bool init_tcp_socket(netplay_t *handle, const char *server, uint16_t port
if (bind(handle->fd, res->ai_addr, res->ai_addrlen) < 0 || if (bind(handle->fd, res->ai_addr, res->ai_addrlen) < 0 ||
listen(handle->fd, 1) < 0) listen(handle->fd, 1) < 0)
{ {
SSNES_ERR("Failed to bind socket.\n"); RARCH_ERR("Failed to bind socket.\n");
close(handle->fd); close(handle->fd);
handle->fd = -1; handle->fd = -1;
freeaddrinfo(res); freeaddrinfo(res);
@ -340,7 +340,7 @@ static bool init_tcp_socket(netplay_t *handle, const char *server, uint16_t port
(struct sockaddr*)&handle->other_addr, &addr_size); (struct sockaddr*)&handle->other_addr, &addr_size);
if (new_fd < 0) if (new_fd < 0)
{ {
SSNES_ERR("Failed to accept socket.\n"); RARCH_ERR("Failed to accept socket.\n");
close(handle->fd); close(handle->fd);
handle->fd = -1; handle->fd = -1;
freeaddrinfo(res); freeaddrinfo(res);
@ -379,7 +379,7 @@ static bool init_udp_socket(netplay_t *handle, const char *server, uint16_t port
handle->udp_fd = socket(handle->addr->ai_family, handle->addr->ai_socktype, handle->addr->ai_protocol); handle->udp_fd = socket(handle->addr->ai_family, handle->addr->ai_socktype, handle->addr->ai_protocol);
if (handle->udp_fd < 0) if (handle->udp_fd < 0)
{ {
SSNES_ERR("Failed to init socket...\n"); RARCH_ERR("Failed to init socket...\n");
return false; return false;
} }
@ -391,7 +391,7 @@ static bool init_udp_socket(netplay_t *handle, const char *server, uint16_t port
if (bind(handle->udp_fd, handle->addr->ai_addr, handle->addr->ai_addrlen) < 0) if (bind(handle->udp_fd, handle->addr->ai_addr, handle->addr->ai_addrlen) < 0)
{ {
SSNES_ERR("Failed to bind socket.\n"); RARCH_ERR("Failed to bind socket.\n");
close(handle->udp_fd); close(handle->udp_fd);
handle->udp_fd = -1; handle->udp_fd = -1;
} }
@ -480,13 +480,13 @@ static bool send_nickname(netplay_t *handle, int fd)
if (!send_all(fd, &nick_size, sizeof(nick_size))) if (!send_all(fd, &nick_size, sizeof(nick_size)))
{ {
SSNES_ERR("Failed to send nick size.\n"); RARCH_ERR("Failed to send nick size.\n");
return false; return false;
} }
if (!send_all(fd, handle->nick, nick_size)) if (!send_all(fd, handle->nick, nick_size))
{ {
SSNES_ERR("Failed to send nick.\n"); RARCH_ERR("Failed to send nick.\n");
return false; return false;
} }
@ -499,19 +499,19 @@ static bool get_nickname(netplay_t *handle, int fd)
if (!recv_all(fd, &nick_size, sizeof(nick_size))) if (!recv_all(fd, &nick_size, sizeof(nick_size)))
{ {
SSNES_ERR("Failed to receive nick size from host.\n"); RARCH_ERR("Failed to receive nick size from host.\n");
return false; return false;
} }
if (nick_size >= sizeof(handle->other_nick)) if (nick_size >= sizeof(handle->other_nick))
{ {
SSNES_ERR("Invalid nick size.\n"); RARCH_ERR("Invalid nick size.\n");
return false; return false;
} }
if (!recv_all(fd, handle->other_nick, nick_size)) if (!recv_all(fd, handle->other_nick, nick_size))
{ {
SSNES_ERR("Failed to receive nick.\n"); RARCH_ERR("Failed to receive nick.\n");
return false; return false;
} }
@ -531,7 +531,7 @@ static bool send_info(netplay_t *handle)
if (!send_nickname(handle, handle->fd)) if (!send_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to send nick to host.\n"); RARCH_ERR("Failed to send nick to host.\n");
return false; return false;
} }
@ -541,19 +541,19 @@ static bool send_info(netplay_t *handle)
if (!recv_all(handle->fd, sram, sram_size)) if (!recv_all(handle->fd, sram, sram_size))
{ {
SSNES_ERR("Failed to receive SRAM data from host.\n"); RARCH_ERR("Failed to receive SRAM data from host.\n");
return false; return false;
} }
if (!get_nickname(handle, handle->fd)) if (!get_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to receive nick from host.\n"); RARCH_ERR("Failed to receive nick from host.\n");
return false; return false;
} }
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "Connected to: \"%s\"", handle->other_nick); snprintf(msg, sizeof(msg), "Connected to: \"%s\"", handle->other_nick);
SSNES_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
return true; return true;
@ -565,31 +565,31 @@ static bool get_info(netplay_t *handle)
if (!recv_all(handle->fd, header, sizeof(header))) if (!recv_all(handle->fd, header, sizeof(header)))
{ {
SSNES_ERR("Failed to receive header from client.\n"); RARCH_ERR("Failed to receive header from client.\n");
return false; return false;
} }
if (g_extern.cart_crc != ntohl(header[0])) if (g_extern.cart_crc != ntohl(header[0]))
{ {
SSNES_ERR("Cart CRC32s differ. Cannot use different games.\n"); RARCH_ERR("Cart CRC32s differ. Cannot use different games.\n");
return false; return false;
} }
if (implementation_magic_value() != ntohl(header[1])) if (implementation_magic_value() != ntohl(header[1]))
{ {
SSNES_ERR("Implementations differ, make sure you're using exact same libsnes implementations and RetroArch version.\n"); RARCH_ERR("Implementations differ, make sure you're using exact same libsnes implementations and RetroArch version.\n");
return false; return false;
} }
if (pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM) != ntohl(header[2])) if (pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM) != ntohl(header[2]))
{ {
SSNES_ERR("Cartridge SRAM sizes do not correspond.\n"); RARCH_ERR("Cartridge SRAM sizes do not correspond.\n");
return false; return false;
} }
if (!get_nickname(handle, handle->fd)) if (!get_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to get nickname from client.\n"); RARCH_ERR("Failed to get nickname from client.\n");
return false; return false;
} }
@ -598,13 +598,13 @@ static bool get_info(netplay_t *handle)
unsigned sram_size = pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM); unsigned sram_size = pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
if (!send_all(handle->fd, sram, sram_size)) if (!send_all(handle->fd, sram, sram_size))
{ {
SSNES_ERR("Failed to send SRAM data to client.\n"); RARCH_ERR("Failed to send SRAM data to client.\n");
return false; return false;
} }
if (!send_nickname(handle, handle->fd)) if (!send_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to send nickname to client.\n"); RARCH_ERR("Failed to send nickname to client.\n");
return false; return false;
} }
@ -646,7 +646,7 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
uint32_t in_bsv = swap_if_little32(header[MAGIC_INDEX]); uint32_t in_bsv = swap_if_little32(header[MAGIC_INDEX]);
if (in_bsv != BSV_MAGIC) if (in_bsv != BSV_MAGIC)
{ {
SSNES_ERR("BSV magic mismatch, got 0x%x, expected 0x%x.\n", RARCH_ERR("BSV magic mismatch, got 0x%x, expected 0x%x.\n",
in_bsv, BSV_MAGIC); in_bsv, BSV_MAGIC);
return false; return false;
} }
@ -654,21 +654,21 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
uint32_t in_magic = swap_if_big32(header[SERIALIZER_INDEX]); uint32_t in_magic = swap_if_big32(header[SERIALIZER_INDEX]);
if (in_magic != magic) if (in_magic != magic)
{ {
SSNES_ERR("Magic mismatch, got 0x%x, expected 0x%x.\n", in_magic, magic); RARCH_ERR("Magic mismatch, got 0x%x, expected 0x%x.\n", in_magic, magic);
return false; return false;
} }
uint32_t in_crc = swap_if_big32(header[CRC_INDEX]); uint32_t in_crc = swap_if_big32(header[CRC_INDEX]);
if (in_crc != g_extern.cart_crc) if (in_crc != g_extern.cart_crc)
{ {
SSNES_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc, g_extern.cart_crc); RARCH_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc, g_extern.cart_crc);
return false; return false;
} }
uint32_t in_state_size = swap_if_big32(header[STATE_SIZE_INDEX]); uint32_t in_state_size = swap_if_big32(header[STATE_SIZE_INDEX]);
if (in_state_size != pretro_serialize_size()) if (in_state_size != pretro_serialize_size())
{ {
SSNES_ERR("Serialization size mismatch, got 0x%x, expected 0x%x.\n", RARCH_ERR("Serialization size mismatch, got 0x%x, expected 0x%x.\n",
(unsigned)in_state_size, (unsigned)pretro_serialize_size()); (unsigned)in_state_size, (unsigned)pretro_serialize_size());
return false; return false;
} }
@ -680,33 +680,33 @@ static bool get_info_spectate(netplay_t *handle)
{ {
if (!send_nickname(handle, handle->fd)) if (!send_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to send nickname to host.\n"); RARCH_ERR("Failed to send nickname to host.\n");
return false; return false;
} }
if (!get_nickname(handle, handle->fd)) if (!get_nickname(handle, handle->fd))
{ {
SSNES_ERR("Failed to receive nickname from host.\n"); RARCH_ERR("Failed to receive nickname from host.\n");
return false; return false;
} }
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "Connected to \"%s\"", handle->other_nick); snprintf(msg, sizeof(msg), "Connected to \"%s\"", handle->other_nick);
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
uint32_t header[4]; uint32_t header[4];
if (!recv_all(handle->fd, header, sizeof(header))) if (!recv_all(handle->fd, header, sizeof(header)))
{ {
SSNES_ERR("Cannot get header from host.\n"); RARCH_ERR("Cannot get header from host.\n");
return false; return false;
} }
size_t save_state_size = pretro_serialize_size(); size_t save_state_size = pretro_serialize_size();
if (!bsv_parse_header(header, implementation_magic_value())) if (!bsv_parse_header(header, implementation_magic_value()))
{ {
SSNES_ERR("Received invalid BSV header from host.\n"); RARCH_ERR("Received invalid BSV header from host.\n");
return false; return false;
} }
@ -718,7 +718,7 @@ static bool get_info_spectate(netplay_t *handle)
if (!recv_all(handle->fd, buf, size)) if (!recv_all(handle->fd, buf, size))
{ {
SSNES_ERR("Failed to receive save state from host.\n"); RARCH_ERR("Failed to receive save state from host.\n");
free(buf); free(buf);
return false; return false;
} }
@ -884,7 +884,7 @@ static int poll_input(netplay_t *handle, bool block)
if (block) if (block)
{ {
SSNES_LOG("Network is stalling, resending packet... Count %u of %d ...\n", RARCH_LOG("Network is stalling, resending packet... Count %u of %d ...\n",
handle->timeout_cnt, MAX_RETRIES); handle->timeout_cnt, MAX_RETRIES);
} }
} while ((handle->timeout_cnt < MAX_RETRIES) && block); } while ((handle->timeout_cnt < MAX_RETRIES) && block);
@ -903,7 +903,7 @@ static bool get_self_input_state(netplay_t *handle)
if (handle->frame_count > 0) // First frame we always give zero input since relying on input from first frame screws up when we use -F 0. if (handle->frame_count > 0) // First frame we always give zero input since relying on input from first frame screws up when we use -F 0.
{ {
retro_input_state_t cb = handle->cbs.state_cb; retro_input_state_t cb = handle->cbs.state_cb;
for (unsigned i = 0; i < SSNES_FIRST_META_KEY; i++) for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
{ {
int16_t tmp = cb(g_settings.input.netplay_client_swap_input ? 0 : !handle->port, int16_t tmp = cb(g_settings.input.netplay_client_swap_input ? 0 : !handle->port,
RETRO_DEVICE_JOYPAD, 0, i); RETRO_DEVICE_JOYPAD, 0, i);
@ -1088,35 +1088,35 @@ static bool netplay_get_cmd(netplay_t *handle)
{ {
if (cmd_size != sizeof(uint32_t)) if (cmd_size != sizeof(uint32_t))
{ {
SSNES_ERR("CMD_FLIP_PLAYERS has unexpected command size.\n"); RARCH_ERR("CMD_FLIP_PLAYERS has unexpected command size.\n");
return netplay_cmd_nak(handle); return netplay_cmd_nak(handle);
} }
uint32_t flip_frame; uint32_t flip_frame;
if (!recv_all(handle->fd, &flip_frame, sizeof(flip_frame))) if (!recv_all(handle->fd, &flip_frame, sizeof(flip_frame)))
{ {
SSNES_ERR("Failed to receive CMD_FLIP_PLAYERS argument.\n"); RARCH_ERR("Failed to receive CMD_FLIP_PLAYERS argument.\n");
return netplay_cmd_nak(handle); return netplay_cmd_nak(handle);
} }
flip_frame = ntohl(flip_frame); flip_frame = ntohl(flip_frame);
if (flip_frame < handle->flip_frame) if (flip_frame < handle->flip_frame)
{ {
SSNES_ERR("Host asked us to flip players in the past. Not possible ...\n"); RARCH_ERR("Host asked us to flip players in the past. Not possible ...\n");
return netplay_cmd_nak(handle); return netplay_cmd_nak(handle);
} }
handle->flip ^= true; handle->flip ^= true;
handle->flip_frame = flip_frame; handle->flip_frame = flip_frame;
SSNES_LOG("Netplay players are flipped.\n"); RARCH_LOG("Netplay players are flipped.\n");
msg_queue_push(g_extern.msg_queue, "Netplay players are flipped.", 1, 180); msg_queue_push(g_extern.msg_queue, "Netplay players are flipped.", 1, 180);
return netplay_cmd_ack(handle); return netplay_cmd_ack(handle);
} }
default: default:
SSNES_ERR("Unknown netplay command received.\n"); RARCH_ERR("Unknown netplay command received.\n");
return netplay_cmd_nak(handle); return netplay_cmd_nak(handle);
} }
} }
@ -1149,7 +1149,7 @@ void netplay_flip_players(netplay_t *handle)
if (netplay_send_cmd(handle, NETPLAY_CMD_FLIP_PLAYERS, &flip_frame_net, sizeof(flip_frame_net)) if (netplay_send_cmd(handle, NETPLAY_CMD_FLIP_PLAYERS, &flip_frame_net, sizeof(flip_frame_net))
&& netplay_get_response(handle)) && netplay_get_response(handle))
{ {
SSNES_LOG("Netplay players are flipped.\n"); RARCH_LOG("Netplay players are flipped.\n");
msg_queue_push(g_extern.msg_queue, "Netplay players are flipped.", 1, 180); msg_queue_push(g_extern.msg_queue, "Netplay players are flipped.", 1, 180);
// Queue up a flip well enough in the future. // Queue up a flip well enough in the future.
@ -1165,7 +1165,7 @@ void netplay_flip_players(netplay_t *handle)
return; return;
error: error:
SSNES_WARN("%s\n", msg); RARCH_WARN("%s\n", msg);
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
} }
@ -1267,7 +1267,7 @@ static int16_t netplay_get_spectate_input(netplay_t *handle, bool port, unsigned
return swap_if_big16(inp); return swap_if_big16(inp);
else else
{ {
SSNES_ERR("Connection with host was cut.\n"); RARCH_ERR("Connection with host was cut.\n");
msg_queue_clear(g_extern.msg_queue); msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, "Connection with host was cut.", 1, 180); msg_queue_push(g_extern.msg_queue, "Connection with host was cut.", 1, 180);
@ -1302,7 +1302,7 @@ static void netplay_pre_frame_spectate(netplay_t *handle)
int new_fd = accept(handle->fd, (struct sockaddr*)&their_addr, &addr_size); int new_fd = accept(handle->fd, (struct sockaddr*)&their_addr, &addr_size);
if (new_fd < 0) if (new_fd < 0)
{ {
SSNES_ERR("Failed to accept incoming spectator.\n"); RARCH_ERR("Failed to accept incoming spectator.\n");
return; return;
} }
@ -1325,14 +1325,14 @@ static void netplay_pre_frame_spectate(netplay_t *handle)
if (!get_nickname(handle, new_fd)) if (!get_nickname(handle, new_fd))
{ {
SSNES_ERR("Failed to get nickname from client.\n"); RARCH_ERR("Failed to get nickname from client.\n");
close(new_fd); close(new_fd);
return; return;
} }
if (!send_nickname(handle, new_fd)) if (!send_nickname(handle, new_fd))
{ {
SSNES_ERR("Failed to send nickname to client.\n"); RARCH_ERR("Failed to send nickname to client.\n");
close(new_fd); close(new_fd);
return; return;
} }
@ -1341,7 +1341,7 @@ static void netplay_pre_frame_spectate(netplay_t *handle)
uint32_t *header = bsv_header_generate(&header_size, implementation_magic_value()); uint32_t *header = bsv_header_generate(&header_size, implementation_magic_value());
if (!header) if (!header)
{ {
SSNES_ERR("Failed to generate BSV header.\n"); RARCH_ERR("Failed to generate BSV header.\n");
close(new_fd); close(new_fd);
return; return;
} }
@ -1351,7 +1351,7 @@ static void netplay_pre_frame_spectate(netplay_t *handle)
if (!send_all(new_fd, header, header_size)) if (!send_all(new_fd, header, header_size))
{ {
SSNES_ERR("Failed to send header to client.\n"); RARCH_ERR("Failed to send header to client.\n");
close(new_fd); close(new_fd);
free(header); free(header);
return; return;
@ -1434,7 +1434,7 @@ static void netplay_post_frame_spectate(netplay_t *handle)
if (!send_all(handle->spectate_fds[i], if (!send_all(handle->spectate_fds[i],
handle->spectate_input, handle->spectate_input_ptr * sizeof(int16_t))) handle->spectate_input, handle->spectate_input_ptr * sizeof(int16_t)))
{ {
SSNES_LOG("Client (#%u) disconnected ...\n", i); RARCH_LOG("Client (#%u) disconnected ...\n", i);
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "Client (#%u) disconnected.", i); snprintf(msg, sizeof(msg), "Client (#%u) disconnected.", i);
@ -1469,7 +1469,7 @@ void netplay_post_frame(netplay_t *handle)
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#define addrinfo addrinfo_ssnes__ #define addrinfo addrinfo_rarch__
// Yes, we love shitty implementations, don't we? :( // Yes, we love shitty implementations, don't we? :(
#ifdef _XBOX #ifdef _XBOX
@ -1514,7 +1514,7 @@ error:
} }
#endif #endif
int getaddrinfo_ssnes__(const char *node, const char *service, int getaddrinfo_rarch__(const char *node, const char *service,
const struct addrinfo *hints, const struct addrinfo *hints,
struct addrinfo **res) struct addrinfo **res)
{ {
@ -1563,7 +1563,7 @@ error:
return -1; return -1;
} }
void freeaddrinfo_ssnes__(struct addrinfo *res) void freeaddrinfo_rarch__(struct addrinfo *res)
{ {
free(res->ai_addr); free(res->ai_addr);
free(res); free(res);

View File

@ -14,8 +14,8 @@
*/ */
#ifndef __SSNES_NETPLAY_H #ifndef __RARCH_NETPLAY_H
#define __SSNES_NETPLAY_H #define __RARCH_NETPLAY_H
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>

View File

@ -51,9 +51,9 @@
#ifdef HAVE_SOCKET_LEGACY #ifdef HAVE_SOCKET_LEGACY
#define sockaddr_storage sockaddr_in #define sockaddr_storage sockaddr_in
#define addrinfo addrinfo_ssnes__ #define addrinfo addrinfo_rarch__
#define getaddrinfo(serv, port, hints, res) getaddrinfo_ssnes__(serv, port, hints, res) #define getaddrinfo(serv, port, hints, res) getaddrinfo_rarch__(serv, port, hints, res)
#define freeaddrinfo(res) freeaddrinfo_ssnes__(res) #define freeaddrinfo(res) freeaddrinfo_rarch__(res)
struct addrinfo struct addrinfo
{ {

View File

@ -140,7 +140,7 @@ static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_i
return true; return true;
error: error:
SSNES_ERR("ps3graphics_load_jpeg(): error.\n"); RARCH_ERR("ps3graphics_load_jpeg(): error.\n");
if (mHandle && sHandle) if (mHandle && sHandle)
cellJpgDecClose(mHandle, sHandle); cellJpgDecClose(mHandle, sHandle);
if (mHandle) if (mHandle)
@ -231,7 +231,7 @@ static bool ps3graphics_load_png(const char * path, struct texture_image *out_im
return true; return true;
error: error:
SSNES_ERR("ps3graphics_load_png(): error.\n"); RARCH_ERR("ps3graphics_load_png(): error.\n");
if (mHandle && sHandle) if (mHandle && sHandle)
cellPngDecClose(mHandle, sHandle); cellPngDecClose(mHandle, sHandle);

View File

@ -76,7 +76,7 @@ char SYS_CONFIG_FILE[MAX_PATH_LENGTH];
char EMULATOR_CORE_SELF[MAX_PATH_LENGTH]; char EMULATOR_CORE_SELF[MAX_PATH_LENGTH];
char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH]; char MULTIMAN_EXECUTABLE[MAX_PATH_LENGTH];
int ssnes_main(int argc, char *argv[]); int rarch_main(int argc, char *argv[]);
SYS_PROCESS_PARAM(1001, 0x100000) SYS_PROCESS_PARAM(1001, 0x100000)
@ -100,21 +100,21 @@ static void set_default_settings(void)
g_settings.video.msg_pos_y = 0.90f; g_settings.video.msg_pos_y = 0.90f;
g_settings.video.aspect_ratio = -1.0f; g_settings.video.aspect_ratio = -1.0f;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[PS3_DEVICE_ID_JOYPAD_CROSS].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_B] = platform_keys[PS3_DEVICE_ID_JOYPAD_CROSS].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[PS3_DEVICE_ID_JOYPAD_SQUARE].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_Y] = platform_keys[PS3_DEVICE_ID_JOYPAD_SQUARE].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[PS3_DEVICE_ID_JOYPAD_SELECT].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_SELECT] = platform_keys[PS3_DEVICE_ID_JOYPAD_SELECT].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[PS3_DEVICE_ID_JOYPAD_START].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_START] = platform_keys[PS3_DEVICE_ID_JOYPAD_START].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_UP] = platform_keys[PS3_DEVICE_ID_JOYPAD_UP].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_DOWN] = platform_keys[PS3_DEVICE_ID_JOYPAD_DOWN].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_LEFT] = platform_keys[PS3_DEVICE_ID_JOYPAD_LEFT].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_RIGHT] = platform_keys[PS3_DEVICE_ID_JOYPAD_RIGHT].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[PS3_DEVICE_ID_JOYPAD_CIRCLE].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_A] = platform_keys[PS3_DEVICE_ID_JOYPAD_CIRCLE].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey;
ssnes_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey;
for(uint32_t x = 0; x < MAX_PLAYERS; x++) for(uint32_t x = 0; x < MAX_PLAYERS; x++)
ssnes_input_set_default_keybinds(x); rarch_input_set_default_keybinds(x);
// g_console // g_console
g_console.block_config_read = true; g_console.block_config_read = true;
@ -122,7 +122,7 @@ static void set_default_settings(void)
g_console.emulator_initialized = 0; g_console.emulator_initialized = 0;
g_console.screenshots_enable = true; g_console.screenshots_enable = true;
g_console.throttle_enable = true; g_console.throttle_enable = true;
g_console.initialize_ssnes_enable = false; g_console.initialize_rarch_enable = false;
g_console.triple_buffering_enable = true; g_console.triple_buffering_enable = true;
g_console.default_savestate_dir_enable = false; g_console.default_savestate_dir_enable = false;
g_console.default_sram_dir_enable = false; g_console.default_sram_dir_enable = false;
@ -154,7 +154,7 @@ static void init_settings(bool load_libretro_path)
{ {
if(!path_file_exists(SYS_CONFIG_FILE)) if(!path_file_exists(SYS_CONFIG_FILE))
{ {
SSNES_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE); RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f; FILE * f;
f = fopen(SYS_CONFIG_FILE, "w"); f = fopen(SYS_CONFIG_FILE, "w");
fclose(f); fclose(f);
@ -177,7 +177,7 @@ static void init_settings(bool load_libretro_path)
if (!dir_list) if (!dir_list)
{ {
SSNES_ERR("Couldn't read %s directory.\n", EMULATOR_CORE_DIR); RARCH_ERR("Couldn't read %s directory.\n", EMULATOR_CORE_DIR);
return; return;
} }
@ -185,12 +185,12 @@ static void init_settings(bool load_libretro_path)
if(first_self) if(first_self)
{ {
SSNES_LOG("Set first entry in libretro %s dir: [%s] to libretro path.\n", EMULATOR_CORE_DIR, first_self); RARCH_LOG("Set first entry in libretro %s dir: [%s] to libretro path.\n", EMULATOR_CORE_DIR, first_self);
strlcpy(g_settings.libretro, first_self, sizeof(g_settings.libretro)); strlcpy(g_settings.libretro, first_self, sizeof(g_settings.libretro));
} }
else else
{ {
SSNES_ERR("Failed to set first entry in libretro %s dir to libretro path.\n", EMULATOR_CORE_DIR); RARCH_ERR("Failed to set first entry in libretro %s dir to libretro path.\n", EMULATOR_CORE_DIR);
} }
dir_list_free(dir_list); dir_list_free(dir_list);
@ -245,7 +245,7 @@ static void save_settings(void)
{ {
if(!path_file_exists(SYS_CONFIG_FILE)) if(!path_file_exists(SYS_CONFIG_FILE))
{ {
SSNES_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE); RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f; FILE * f;
f = fopen(SYS_CONFIG_FILE, "w"); f = fopen(SYS_CONFIG_FILE, "w");
fclose(f); fclose(f);
@ -301,7 +301,7 @@ static void save_settings(void)
config_set_int(conf, "audio_mute", g_extern.audio_data.mute); config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
if (!config_file_write(conf, SYS_CONFIG_FILE)) if (!config_file_write(conf, SYS_CONFIG_FILE))
SSNES_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE); RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", SYS_CONFIG_FILE);
free(conf); free(conf);
} }
@ -346,7 +346,7 @@ static void get_environment_settings(int argc, char *argv[])
ret = cellSysCacheMount(&param); ret = cellSysCacheMount(&param);
if(ret != CELL_SYSCACHE_RET_OK_CLEARED) if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
{ {
SSNES_ERR("System cache partition could not be mounted, it might be already mounted.\n"); RARCH_ERR("System cache partition could not be mounted, it might be already mounted.\n");
} }
if(argc > 1) if(argc > 1)
@ -364,12 +364,12 @@ static void get_environment_settings(int argc, char *argv[])
if(path_file_exists(MULTIMAN_EXECUTABLE) && argc > 1 && path_file_exists(argv[1])) if(path_file_exists(MULTIMAN_EXECUTABLE) && argc > 1 && path_file_exists(argv[1]))
{ {
g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN; g_console.external_launcher_support = EXTERN_LAUNCHER_MULTIMAN;
SSNES_LOG("Started from multiMAN, auto-game start enabled.\n"); RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
} }
else else
{ {
g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER; g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
SSNES_WARN("Not started from multiMAN, auto-game start disabled.\n"); RARCH_WARN("Not started from multiMAN, auto-game start disabled.\n");
} }
memset(&size, 0x00, sizeof(CellGameContentSize)); memset(&size, 0x00, sizeof(CellGameContentSize));
@ -377,26 +377,26 @@ static void get_environment_settings(int argc, char *argv[])
ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName); ret = cellGameBootCheck(&get_type, &get_attributes, &size, dirName);
if(ret < 0) if(ret < 0)
{ {
SSNES_ERR("cellGameBootCheck() Error: 0x%x.\n", ret); RARCH_ERR("cellGameBootCheck() Error: 0x%x.\n", ret);
} }
else else
{ {
SSNES_LOG("cellGameBootCheck() OK.\n"); RARCH_LOG("cellGameBootCheck() OK.\n");
SSNES_LOG("Directory name: [%s].\n", dirName); RARCH_LOG("Directory name: [%s].\n", dirName);
SSNES_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n", size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB); RARCH_LOG(" HDD Free Size (in KB) = [%d] Size (in KB) = [%d] System Size (in KB) = [%d].\n", size.hddFreeSizeKB, size.sizeKB, size.sysSizeKB);
switch(get_type) switch(get_type)
{ {
case CELL_GAME_GAMETYPE_DISC: case CELL_GAME_GAMETYPE_DISC:
SSNES_LOG("RetroArch was launched on Optical Disc Drive.\n"); RARCH_LOG("RetroArch was launched on Optical Disc Drive.\n");
break; break;
case CELL_GAME_GAMETYPE_HDD: case CELL_GAME_GAMETYPE_HDD:
SSNES_LOG("RetroArch was launched on HDD.\n"); RARCH_LOG("RetroArch was launched on HDD.\n");
break; break;
} }
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME) if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
SSNES_LOG("RetroArch was launched from host machine (APP_HOME).\n"); RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
ret = cellGameContentPermit(contentInfoPath, usrDirPath); ret = cellGameContentPermit(contentInfoPath, usrDirPath);
@ -408,13 +408,13 @@ static void get_environment_settings(int argc, char *argv[])
if(ret < 0) if(ret < 0)
{ {
SSNES_ERR("cellGameContentPermit() Error: 0x%x\n", ret); RARCH_ERR("cellGameContentPermit() Error: 0x%x\n", ret);
} }
else else
{ {
SSNES_LOG("cellGameContentPermit() OK.\n"); RARCH_LOG("cellGameContentPermit() OK.\n");
SSNES_LOG("contentInfoPath : [%s].\n", contentInfoPath); RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
SSNES_LOG("usrDirPath : [%s].\n", usrDirPath); RARCH_LOG("usrDirPath : [%s].\n", usrDirPath);
} }
/* now we fill in all the variables */ /* now we fill in all the variables */
@ -436,7 +436,7 @@ static void get_environment_settings(int argc, char *argv[])
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
SSNES_LOG("Registering system utility callback...\n"); RARCH_LOG("Registering system utility callback...\n");
cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
@ -456,7 +456,7 @@ int main(int argc, char *argv[])
sceNpInit(NP_POOL_SIZE, np_pool); sceNpInit(NP_POOL_SIZE, np_pool);
ssnes_main_clear_state(); rarch_main_clear_state();
get_environment_settings(argc, argv); get_environment_settings(argc, argv);
config_set_defaults(); config_set_defaults();
@ -464,7 +464,7 @@ int main(int argc, char *argv[])
char full_path[1024], tmp_path[1024]; char full_path[1024], tmp_path[1024];
snprintf(full_path, sizeof(full_path), "%s/%s/CORE.SELF", usrDirPath, EMULATOR_CORE_DIR); snprintf(full_path, sizeof(full_path), "%s/%s/CORE.SELF", usrDirPath, EMULATOR_CORE_DIR);
snprintf(tmp_path, sizeof(tmp_path), "%s/%s/", usrDirPath, EMULATOR_CORE_DIR); snprintf(tmp_path, sizeof(tmp_path), "%s/%s/", usrDirPath, EMULATOR_CORE_DIR);
bool load_libretro_path = ssnes_manage_libretro_core(full_path, tmp_path, ".SELF"); bool load_libretro_path = rarch_manage_libretro_core(full_path, tmp_path, ".SELF");
set_default_settings(); set_default_settings();
init_settings(load_libretro_path); init_settings(load_libretro_path);
@ -489,7 +489,7 @@ int main(int argc, char *argv[])
ps3_input_init(); ps3_input_init();
oskutil_init(&g_console.oskutil_handle, 0); oskutil_init(&g_console.oskutil_handle, 0);
ssnes_input_set_default_keybind_names_for_emulator(); rarch_input_set_default_keybind_names_for_emulator();
menu_init(); menu_init();
@ -499,11 +499,11 @@ int main(int argc, char *argv[])
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
break; break;
case EXTERN_LAUNCHER_MULTIMAN: case EXTERN_LAUNCHER_MULTIMAN:
SSNES_LOG("Started from multiMAN, will auto-start game.\n"); RARCH_LOG("Started from multiMAN, will auto-start game.\n");
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
g_console.initialize_ssnes_enable = 1; g_console.initialize_rarch_enable = 1;
g_console.mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
ssnes_startup(SYS_CONFIG_FILE); rarch_startup(SYS_CONFIG_FILE);
break; break;
} }
@ -515,13 +515,13 @@ begin_loop:
input_ps3.poll(NULL); input_ps3.poll(NULL);
do{ do{
repeat = ssnes_main_iterate(); repeat = rarch_main_iterate();
}while(repeat && !g_console.frame_advance_enable); }while(repeat && !g_console.frame_advance_enable);
} }
else if(g_console.mode_switch == MODE_MENU) else if(g_console.mode_switch == MODE_MENU)
{ {
menu_loop(); menu_loop();
ssnes_startup(SYS_CONFIG_FILE); rarch_startup(SYS_CONFIG_FILE);
} }
else else
goto begin_shutdown; goto begin_shutdown;
@ -532,7 +532,7 @@ begin_shutdown:
if(path_file_exists(SYS_CONFIG_FILE)) if(path_file_exists(SYS_CONFIG_FILE))
save_settings(); save_settings();
if(g_console.emulator_initialized) if(g_console.emulator_initialized)
ssnes_main_deinit(); rarch_main_deinit();
cell_pad_input_deinit(); cell_pad_input_deinit();
ps3_video_deinit(); ps3_video_deinit();
if(g_console.oskutil_handle.is_running) if(g_console.oskutil_handle.is_running)
@ -552,10 +552,10 @@ begin_shutdown:
if(ret != CELL_SYSCACHE_RET_OK_CLEARED) if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
{ {
SSNES_ERR("System cache partition could not be cleared on exit.\n"); RARCH_ERR("System cache partition could not be cleared on exit.\n");
} }
ssnes_exec(); rarch_exec();
return 1; return 1;
} }

View File

@ -344,7 +344,7 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] =
1 1
}, },
{ {
SETTING_SSNES_DEFAULT_EMU, SETTING_RARCH_DEFAULT_EMU,
"Default emulator core", "Default emulator core",
"", "",
0.0f, 0.0f,

View File

@ -589,7 +589,7 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting)
snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Rewind] feature is set to 'OFF'."); snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Rewind] feature is set to 'OFF'.");
} }
break; break;
case SETTING_SSNES_DEFAULT_EMU: case SETTING_RARCH_DEFAULT_EMU:
{ {
char fname[MAX_PATH_LENGTH]; char fname[MAX_PATH_LENGTH];
fill_pathname_base(fname, g_settings.libretro, sizeof(fname)); fill_pathname_base(fname, g_settings.libretro, sizeof(fname));
@ -730,12 +730,12 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting)
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L: case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L:
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R: case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R:
{ {
if(g_settings.input.binds[currently_selected_controller_menu][currentsetting-(FIRST_CONTROL_BIND)].joykey == ssnes_default_keybind_lut[currentsetting-FIRST_CONTROL_BIND]) if(g_settings.input.binds[currently_selected_controller_menu][currentsetting-(FIRST_CONTROL_BIND)].joykey == rarch_default_keybind_lut[currentsetting-FIRST_CONTROL_BIND])
menu_obj->items[currentsetting].text_color = GREEN; menu_obj->items[currentsetting].text_color = GREEN;
else else
menu_obj->items[currentsetting].text_color = ORANGE; menu_obj->items[currentsetting].text_color = ORANGE;
const char * value = ssnes_input_find_platform_key_label(g_settings.input.binds[currently_selected_controller_menu][currentsetting-(FIRST_CONTROL_BIND)].joykey); const char * value = rarch_input_find_platform_key_label(g_settings.input.binds[currently_selected_controller_menu][currentsetting-(FIRST_CONTROL_BIND)].joykey);
snprintf(menu_obj->items[currentsetting].text, sizeof(menu_obj->items[currentsetting].text), ssnes_default_libretro_keybind_name_lut[currentsetting-(FIRST_CONTROL_BIND)]); snprintf(menu_obj->items[currentsetting].text, sizeof(menu_obj->items[currentsetting].text), rarch_default_libretro_keybind_name_lut[currentsetting-(FIRST_CONTROL_BIND)]);
snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [%s] on the PS3 controller is mapped to action:\n[%s].", menu_obj->items[currentsetting].text, value); snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [%s] on the PS3 controller is mapped to action:\n[%s].", menu_obj->items[currentsetting].text, value);
snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), value); snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), value);
} }
@ -806,13 +806,13 @@ static void apply_scaling (unsigned init_mode)
gl_deinit_fbo(g_gl); gl_deinit_fbo(g_gl);
break; break;
case FBO_INIT: case FBO_INIT:
gl_init_fbo(g_gl, SSNES_SCALE_BASE * INPUT_SCALE, gl_init_fbo(g_gl, RARCH_SCALE_BASE * INPUT_SCALE,
SSNES_SCALE_BASE * INPUT_SCALE); RARCH_SCALE_BASE * INPUT_SCALE);
break; break;
case FBO_REINIT: case FBO_REINIT:
gl_deinit_fbo(g_gl); gl_deinit_fbo(g_gl);
gl_init_fbo(g_gl, SSNES_SCALE_BASE * INPUT_SCALE, gl_init_fbo(g_gl, RARCH_SCALE_BASE * INPUT_SCALE,
SSNES_SCALE_BASE * INPUT_SCALE); RARCH_SCALE_BASE * INPUT_SCALE);
break; break;
} }
} }
@ -1074,13 +1074,13 @@ static void set_keybind_digital(uint64_t state, uint64_t default_retro_joypad_id
if(CTRL_START(state)) if(CTRL_START(state))
keybind_action = KEYBIND_DEFAULT; keybind_action = KEYBIND_DEFAULT;
ssnes_input_set_keybind(currently_selected_controller_menu, keybind_action, default_retro_joypad_id); rarch_input_set_keybind(currently_selected_controller_menu, keybind_action, default_retro_joypad_id);
if(keybind_action != KEYBIND_NOACTION) if(keybind_action != KEYBIND_NOACTION)
set_delay = DELAY_MEDIUM; set_delay = DELAY_MEDIUM;
} }
static void ssnes_filename_input_and_save (unsigned filename_type) static void rarch_filename_input_and_save (unsigned filename_type)
{ {
bool filename_entered = false; bool filename_entered = false;
char filename_tmp[256], filepath[MAX_PATH_LENGTH]; char filename_tmp[256], filepath[MAX_PATH_LENGTH];
@ -1484,7 +1484,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
case SETTING_SAVE_SHADER_PRESET: case SETTING_SAVE_SHADER_PRESET:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) | CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) | CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{ {
ssnes_filename_input_and_save(SHADER_PRESET_FILE); rarch_filename_input_and_save(SHADER_PRESET_FILE);
} }
break; break;
case SETTING_APPLY_SHADER_PRESET_ON_STARTUP: case SETTING_APPLY_SHADER_PRESET_ON_STARTUP:
@ -1567,7 +1567,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
g_settings.rewind_enable = false; g_settings.rewind_enable = false;
} }
break; break;
case SETTING_SSNES_DEFAULT_EMU: case SETTING_RARCH_DEFAULT_EMU:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{ {
menuStackindex++; menuStackindex++;
@ -1779,13 +1779,13 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS: case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_START(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_START(state))
{ {
ssnes_filename_input_and_save(INPUT_PRESET_FILE); rarch_filename_input_and_save(INPUT_PRESET_FILE);
} }
break; break;
case SETTING_CONTROLS_DEFAULT_ALL: case SETTING_CONTROLS_DEFAULT_ALL:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_START(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_START(state))
{ {
ssnes_input_set_default_keybinds(currently_selected_controller_menu); rarch_input_set_default_keybinds(currently_selected_controller_menu);
menu_reinit_settings(); menu_reinit_settings();
} }
break; break;
@ -1916,7 +1916,7 @@ static void select_rom(void)
} }
if (CTRL_START(button_was_pressed)) if (CTRL_START(button_was_pressed))
filebrowser_reset_start_directory(&browser, "/", ssnes_console_get_rom_ext()); filebrowser_reset_start_directory(&browser, "/", rarch_console_get_rom_ext());
if (CTRL_CROSS(button_was_pressed)) if (CTRL_CROSS(button_was_pressed))
{ {
@ -1945,12 +1945,12 @@ static void select_rom(void)
snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser));
if((strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP")) && !block_zip_extract) if((strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP")) && !block_zip_extract)
ssnes_extract_zipfile(rom_path_temp); rarch_extract_zipfile(rom_path_temp);
else else
{ {
g_console.menu_enable = false; g_console.menu_enable = false;
snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser));
g_console.initialize_ssnes_enable = 1; g_console.initialize_rarch_enable = 1;
g_console.mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
} }
@ -2032,18 +2032,18 @@ static void ingame_menu(uint32_t menu_id)
case MENU_ITEM_LOAD_STATE: case MENU_ITEM_LOAD_STATE:
if(CTRL_CROSS(state)) if(CTRL_CROSS(state))
{ {
ssnes_load_state(); rarch_load_state();
return_to_game(); return_to_game();
} }
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
{ {
ssnes_state_slot_decrease(); rarch_state_slot_decrease();
set_delay = DELAY_LONG; set_delay = DELAY_LONG;
blocking = 0; blocking = 0;
} }
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state)) if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
{ {
ssnes_state_slot_increase(); rarch_state_slot_increase();
set_delay = DELAY_LONG; set_delay = DELAY_LONG;
blocking = 0; blocking = 0;
} }
@ -2053,18 +2053,18 @@ static void ingame_menu(uint32_t menu_id)
case MENU_ITEM_SAVE_STATE: case MENU_ITEM_SAVE_STATE:
if(CTRL_CROSS(state)) if(CTRL_CROSS(state))
{ {
ssnes_save_state(); rarch_save_state();
return_to_game(); return_to_game();
} }
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state)) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state))
{ {
ssnes_state_slot_decrease(); rarch_state_slot_decrease();
set_delay = DELAY_LONG; set_delay = DELAY_LONG;
blocking = 0; blocking = 0;
} }
if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state)) if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
{ {
ssnes_state_slot_increase(); rarch_state_slot_increase();
set_delay = DELAY_LONG; set_delay = DELAY_LONG;
blocking = 0; blocking = 0;
} }
@ -2216,7 +2216,7 @@ static void ingame_menu(uint32_t menu_id)
glEnable(GL_BLEND); glEnable(GL_BLEND);
} }
ssnes_render_cached_frame(); rarch_render_cached_frame();
if(CTRL_SQUARE(~state)) if(CTRL_SQUARE(~state))
{ {
@ -2343,7 +2343,7 @@ static void ingame_menu(uint32_t menu_id)
stuck_in_loop = 0; stuck_in_loop = 0;
} }
ssnes_render_cached_frame(); rarch_render_cached_frame();
video_gl.swap(NULL); video_gl.swap(NULL);
} }
@ -2361,7 +2361,7 @@ static void ingame_menu(uint32_t menu_id)
if(CTRL_CROSS(state)) if(CTRL_CROSS(state))
{ {
return_to_game(); return_to_game();
ssnes_game_reset(); rarch_game_reset();
} }
strcpy(comment, "Press 'CROSS' to reset the game."); strcpy(comment, "Press 'CROSS' to reset the game.");
break; break;
@ -2509,7 +2509,7 @@ static void ingame_menu(uint32_t menu_id)
void menu_init (void) void menu_init (void)
{ {
filebrowser_new(&browser, g_console.default_rom_startup_dir, ssnes_console_get_rom_ext()); filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());
} }
void menu_loop(void) void menu_loop(void)
@ -2538,7 +2538,7 @@ void menu_loop(void)
glEnable(GL_BLEND); glEnable(GL_BLEND);
if(g_console.emulator_initialized) if(g_console.emulator_initialized)
{ {
ssnes_render_cached_frame(); rarch_render_cached_frame();
} }
gl_frame_menu(); gl_frame_menu();

View File

@ -102,7 +102,7 @@ enum
SETTING_ENABLE_CUSTOM_BGM, SETTING_ENABLE_CUSTOM_BGM,
SETTING_DEFAULT_AUDIO_ALL, SETTING_DEFAULT_AUDIO_ALL,
SETTING_EMU_CURRENT_SAVE_STATE_SLOT, SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
SETTING_SSNES_DEFAULT_EMU, SETTING_RARCH_DEFAULT_EMU,
SETTING_EMU_DEFAULT_ALL, SETTING_EMU_DEFAULT_ALL,
SETTING_EMU_REWIND_ENABLED, SETTING_EMU_REWIND_ENABLED,
SETTING_EMU_VIDEO_DEFAULT_ALL, SETTING_EMU_VIDEO_DEFAULT_ALL,

View File

@ -293,17 +293,17 @@ static bool ps3_key_pressed(void *data, int key)
(void)data; (void)data;
switch (key) switch (key)
{ {
case SSNES_FAST_FORWARD_HOLD_KEY: case RARCH_FAST_FORWARD_HOLD_KEY:
return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]); return CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(~state[0]);
case SSNES_LOAD_STATE_KEY: case RARCH_LOAD_STATE_KEY:
return (CTRL_RSTICK_UP(state[0]) && CTRL_R2(state[0])); return (CTRL_RSTICK_UP(state[0]) && CTRL_R2(state[0]));
case SSNES_SAVE_STATE_KEY: case RARCH_SAVE_STATE_KEY:
return (CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(state[0])); return (CTRL_RSTICK_DOWN(state[0]) && CTRL_R2(state[0]));
case SSNES_STATE_SLOT_PLUS: case RARCH_STATE_SLOT_PLUS:
return (CTRL_RSTICK_RIGHT(state[0]) && CTRL_R2(state[0])); return (CTRL_RSTICK_RIGHT(state[0]) && CTRL_R2(state[0]));
case SSNES_STATE_SLOT_MINUS: case RARCH_STATE_SLOT_MINUS:
return (CTRL_RSTICK_LEFT(state[0]) && CTRL_R2(state[0])); return (CTRL_RSTICK_LEFT(state[0]) && CTRL_R2(state[0]));
case SSNES_FRAMEADVANCE: case RARCH_FRAMEADVANCE:
if(g_console.frame_advance_enable) if(g_console.frame_advance_enable)
{ {
g_console.menu_enable = true; g_console.menu_enable = true;
@ -311,9 +311,9 @@ static bool ps3_key_pressed(void *data, int key)
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
} }
return false; return false;
case SSNES_REWIND: case RARCH_REWIND:
return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]); return CTRL_RSTICK_UP(state[0]) && CTRL_R2(~state[0]);
case SSNES_QUIT_KEY: case RARCH_QUIT_KEY:
if(IS_TIMER_EXPIRED(g_console.timer_expiration_frame_count)) if(IS_TIMER_EXPIRED(g_console.timer_expiration_frame_count))
{ {
uint32_t r3_pressed = CTRL_R3(state[0]); uint32_t r3_pressed = CTRL_R3(state[0]);

View File

@ -112,11 +112,11 @@ static bool gl_shader_init(void)
{ {
switch (g_settings.video.shader_type) switch (g_settings.video.shader_type)
{ {
case SSNES_SHADER_AUTO: case RARCH_SHADER_AUTO:
if (strlen(g_settings.video.cg_shader_path) > 0 && strlen(g_settings.video.bsnes_shader_path) > 0) if (strlen(g_settings.video.cg_shader_path) > 0 && strlen(g_settings.video.bsnes_shader_path) > 0)
SSNES_WARN("Both Cg and bSNES XML shader are defined in config file. Cg shader will be selected by default.\n"); RARCH_WARN("Both Cg and bSNES XML shader are defined in config file. Cg shader will be selected by default.\n");
// fall-through // fall-through
case SSNES_SHADER_CG: case RARCH_SHADER_CG:
if (strlen(g_settings.video.cg_shader_path) > 0) if (strlen(g_settings.video.cg_shader_path) > 0)
return gl_cg_init(g_settings.video.cg_shader_path); return gl_cg_init(g_settings.video.cg_shader_path);
break; break;
@ -220,18 +220,18 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
{ {
scale.scale_x = g_settings.video.fbo_scale_x; scale.scale_x = g_settings.video.fbo_scale_x;
scale.scale_y = g_settings.video.fbo_scale_y; scale.scale_y = g_settings.video.fbo_scale_y;
scale.type_x = scale.type_y = SSNES_SCALE_INPUT; scale.type_x = scale.type_y = RARCH_SCALE_INPUT;
} }
switch (scale.type_x) switch (scale.type_x)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[0].width = width * next_pow2(ceil(scale.scale_x)); gl->fbo_rect[0].width = width * next_pow2(ceil(scale.scale_x));
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[0].width = next_pow2(scale.abs_x); gl->fbo_rect[0].width = next_pow2(scale.abs_x);
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[0].width = next_pow2(gl->win_width); gl->fbo_rect[0].width = next_pow2(gl->win_width);
break; break;
default: default:
@ -240,13 +240,13 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
switch (scale.type_y) switch (scale.type_y)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[0].height = height * next_pow2(ceil(scale.scale_y)); gl->fbo_rect[0].height = height * next_pow2(ceil(scale.scale_y));
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[0].height = next_pow2(scale.abs_y); gl->fbo_rect[0].height = next_pow2(scale.abs_y);
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[0].height = next_pow2(gl->win_height); gl->fbo_rect[0].height = next_pow2(gl->win_height);
break; break;
default: default:
@ -256,7 +256,7 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
unsigned last_width = gl->fbo_rect[0].width, last_height = gl->fbo_rect[0].height; unsigned last_width = gl->fbo_rect[0].width, last_height = gl->fbo_rect[0].height;
gl->fbo_scale[0] = scale; gl->fbo_scale[0] = scale;
SSNES_LOG("Creating FBO 0 @ %ux%u\n", gl->fbo_rect[0].width, gl->fbo_rect[0].height); RARCH_LOG("Creating FBO 0 @ %ux%u\n", gl->fbo_rect[0].width, gl->fbo_rect[0].height);
for (int i = 1; i < gl->fbo_pass; i++) for (int i = 1; i < gl->fbo_pass; i++)
{ {
@ -265,13 +265,13 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
{ {
switch (gl->fbo_scale[i].type_x) switch (gl->fbo_scale[i].type_x)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].width = last_width * next_pow2(ceil(gl->fbo_scale[i].scale_x)); gl->fbo_rect[i].width = last_width * next_pow2(ceil(gl->fbo_scale[i].scale_x));
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].width = next_pow2(gl->fbo_scale[i].abs_x); gl->fbo_rect[i].width = next_pow2(gl->fbo_scale[i].abs_x);
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].width = next_pow2(gl->win_width); gl->fbo_rect[i].width = next_pow2(gl->win_width);
break; break;
default: default:
@ -280,13 +280,13 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
switch (gl->fbo_scale[i].type_y) switch (gl->fbo_scale[i].type_y)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].height = last_height * next_pow2(ceil(gl->fbo_scale[i].scale_y)); gl->fbo_rect[i].height = last_height * next_pow2(ceil(gl->fbo_scale[i].scale_y));
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].height = next_pow2(gl->fbo_scale[i].abs_y); gl->fbo_rect[i].height = next_pow2(gl->fbo_scale[i].abs_y);
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].height = next_pow2(gl->win_height); gl->fbo_rect[i].height = next_pow2(gl->win_height);
break; break;
default: default:
@ -301,10 +301,10 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
// Use previous values, essentially a 1x scale compared to last shader in chain. // Use previous values, essentially a 1x scale compared to last shader in chain.
gl->fbo_rect[i] = gl->fbo_rect[i - 1]; gl->fbo_rect[i] = gl->fbo_rect[i - 1];
gl->fbo_scale[i].scale_x = gl->fbo_scale[i].scale_y = 1.0; gl->fbo_scale[i].scale_x = gl->fbo_scale[i].scale_y = 1.0;
gl->fbo_scale[i].type_x = gl->fbo_scale[i].type_y = SSNES_SCALE_INPUT; gl->fbo_scale[i].type_x = gl->fbo_scale[i].type_y = RARCH_SCALE_INPUT;
} }
SSNES_LOG("Creating FBO %d @ %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height); RARCH_LOG("Creating FBO %d @ %ux%u\n", i, gl->fbo_rect[i].width, gl->fbo_rect[i].height);
} }
gl_create_fbo_textures(gl); gl_create_fbo_textures(gl);
@ -327,7 +327,7 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
error: error:
glDeleteTextures(gl->fbo_pass, gl->fbo_texture); glDeleteTextures(gl->fbo_pass, gl->fbo_texture);
glDeleteFramebuffersOES(gl->fbo_pass, gl->fbo); glDeleteFramebuffersOES(gl->fbo_pass, gl->fbo);
SSNES_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n"); RARCH_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n");
} }
static inline void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height, static inline void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
@ -343,14 +343,14 @@ unsigned vp_width, unsigned vp_height)
{ {
switch (gl->fbo_scale[i].type_x) switch (gl->fbo_scale[i].type_x)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].img_width = last_width * gl->fbo_scale[i].scale_x; gl->fbo_rect[i].img_width = last_width * gl->fbo_scale[i].scale_x;
gl->fbo_rect[i].max_img_width = last_max_width * gl->fbo_scale[i].scale_x; gl->fbo_rect[i].max_img_width = last_max_width * gl->fbo_scale[i].scale_x;
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].abs_x; gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].abs_x;
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].scale_x * gl->vp_out_width; gl->fbo_rect[i].img_width = gl->fbo_rect[i].max_img_width = gl->fbo_scale[i].scale_x * gl->vp_out_width;
break; break;
default: default:
@ -359,14 +359,14 @@ unsigned vp_width, unsigned vp_height)
switch (gl->fbo_scale[i].type_y) switch (gl->fbo_scale[i].type_y)
{ {
case SSNES_SCALE_INPUT: case RARCH_SCALE_INPUT:
gl->fbo_rect[i].img_height = last_height * gl->fbo_scale[i].scale_y; gl->fbo_rect[i].img_height = last_height * gl->fbo_scale[i].scale_y;
gl->fbo_rect[i].max_img_height = last_max_height * gl->fbo_scale[i].scale_y; gl->fbo_rect[i].max_img_height = last_max_height * gl->fbo_scale[i].scale_y;
break; break;
case SSNES_SCALE_ABSOLUTE: case RARCH_SCALE_ABSOLUTE:
gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].abs_y; gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].abs_y;
break; break;
case SSNES_SCALE_VIEWPORT: case RARCH_SCALE_VIEWPORT:
gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].scale_y * gl->vp_out_height; gl->fbo_rect[i].img_height = gl->fbo_rect[i].max_img_height = gl->fbo_scale[i].scale_y * gl->vp_out_height;
break; break;
default: default:
@ -491,7 +491,7 @@ void gl_frame_menu (void)
if(!gl) if(!gl)
return; return;
gl_cg_use(SSNES_CG_MENU_SHADER_INDEX); gl_cg_use(RARCH_CG_MENU_SHADER_INDEX);
gl_cg_set_params(gl->win_width, gl->win_height, gl->win_width, gl_cg_set_params(gl->win_width, gl->win_height, gl->win_width,
gl->win_height, gl->win_width, gl->win_height, g_frame_count, gl->win_height, gl->win_width, gl->win_height, g_frame_count,
@ -749,7 +749,7 @@ static void gl_set_nonblock_state(void *data, bool state)
gl_t *gl = data; gl_t *gl = data;
if (gl->vsync) if (gl->vsync)
{ {
SSNES_LOG("GL VSync => %s\n", state ? "off" : "on"); RARCH_LOG("GL VSync => %s\n", state ? "off" : "on");
if(state) if(state)
glDisable(GL_VSYNC_SCE); glDisable(GL_VSYNC_SCE);
else else
@ -837,33 +837,33 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
return NULL; return NULL;
SSNES_LOG("Detecting resolution %ux%u.\n", gl->win_width, gl->win_height); RARCH_LOG("Detecting resolution %ux%u.\n", gl->win_width, gl->win_height);
video->vsync ? glEnable(GL_VSYNC_SCE) : glDisable(GL_VSYNC_SCE); video->vsync ? glEnable(GL_VSYNC_SCE) : glDisable(GL_VSYNC_SCE);
gl->vsync = video->vsync; gl->vsync = video->vsync;
SSNES_LOG("GL: Using resolution %ux%u.\n", gl->win_width, gl->win_height); RARCH_LOG("GL: Using resolution %ux%u.\n", gl->win_width, gl->win_height);
SSNES_LOG("GL: Initializing debug fonts...\n"); RARCH_LOG("GL: Initializing debug fonts...\n");
psgl_init_dbgfont(gl); psgl_init_dbgfont(gl);
SSNES_LOG("Initializing menu shader...\n"); RARCH_LOG("Initializing menu shader...\n");
gl_cg_set_menu_shader(DEFAULT_MENU_SHADER_FILE); gl_cg_set_menu_shader(DEFAULT_MENU_SHADER_FILE);
if (!gl_shader_init()) if (!gl_shader_init())
{ {
SSNES_ERR("Menu shader initialization failed.\n"); RARCH_ERR("Menu shader initialization failed.\n");
psgl_deinit(gl); psgl_deinit(gl);
free(gl); free(gl);
return NULL; return NULL;
} }
SSNES_LOG("GL: Loaded %u program(s).\n", gl_shader_num()); RARCH_LOG("GL: Loaded %u program(s).\n", gl_shader_num());
// Set up render to texture. // Set up render to texture.
gl_init_fbo(gl, SSNES_SCALE_BASE * video->input_scale, gl_init_fbo(gl, RARCH_SCALE_BASE * video->input_scale,
SSNES_SCALE_BASE * video->input_scale); RARCH_SCALE_BASE * video->input_scale);
gl->keep_aspect = video->force_aspect; gl->keep_aspect = video->force_aspect;
@ -890,8 +890,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
gl->tex_w = SSNES_SCALE_BASE * video->input_scale; gl->tex_w = RARCH_SCALE_BASE * video->input_scale;
gl->tex_h = SSNES_SCALE_BASE * video->input_scale; gl->tex_h = RARCH_SCALE_BASE * video->input_scale;
glGenBuffers(1, &gl->pbo); glGenBuffers(1, &gl->pbo);
glBindBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->pbo); glBindBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->pbo);
glBufferData(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->tex_w * gl->tex_h * gl_base_size * TEXTURES, NULL, GL_STREAM_DRAW); glBufferData(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->tex_w * gl->tex_h * gl_base_size * TEXTURES, NULL, GL_STREAM_DRAW);
@ -1137,10 +1137,10 @@ bool ps3_setup_texture(void)
glGenTextures(1, &gl->menu_texture_id); glGenTextures(1, &gl->menu_texture_id);
SSNES_LOG("Loading texture image for menu...\n"); RARCH_LOG("Loading texture image for menu...\n");
if(!texture_image_load(DEFAULT_MENU_BORDER_FILE, &gl->menu_texture)) if(!texture_image_load(DEFAULT_MENU_BORDER_FILE, &gl->menu_texture))
{ {
SSNES_ERR("Failed to load texture image for menu.\n"); RARCH_ERR("Failed to load texture image for menu.\n");
return false; return false;
} }

View File

@ -39,8 +39,8 @@
#define IS_TIMER_EXPIRED(getter) (!(IS_TIMER_NOT_EXPIRED(getter))) #define IS_TIMER_EXPIRED(getter) (!(IS_TIMER_NOT_EXPIRED(getter)))
#define SET_TIMER_EXPIRATION(setter, value) setter = g_frame_count + value; #define SET_TIMER_EXPIRATION(setter, value) setter = g_frame_count + value;
#define SSNES_CG_MAX_SHADERS 16 #define RARCH_CG_MAX_SHADERS 16
#define SSNES_CG_MENU_SHADER_INDEX (SSNES_CG_MAX_SHADERS - 1) #define RARCH_CG_MENU_SHADER_INDEX (RARCH_CG_MAX_SHADERS - 1)
typedef struct gl typedef struct gl
{ {

File diff suppressed because it is too large Load Diff

View File

@ -70,13 +70,13 @@ state_manager_t *state_manager_new(size_t state_size, size_t buffer_size, void *
return NULL; return NULL;
// We need 4-byte aligned state_size to avoid having to enforce this with unneeded memcpy's! // We need 4-byte aligned state_size to avoid having to enforce this with unneeded memcpy's!
ssnes_assert(state_size % 4 == 0); rarch_assert(state_size % 4 == 0);
state->top_ptr = 1; state->top_ptr = 1;
state->state_size = state_size / sizeof(uint32_t); // Works in multiple of 4. state->state_size = state_size / sizeof(uint32_t); // Works in multiple of 4.
state->buf_size = nearest_pow2_size(buffer_size) / sizeof(uint64_t); // Works in multiple of 8. state->buf_size = nearest_pow2_size(buffer_size) / sizeof(uint64_t); // Works in multiple of 8.
state->buf_size_mask = state->buf_size - 1; state->buf_size_mask = state->buf_size - 1;
SSNES_LOG("Readjusted rewind buffer size to %u MiB\n", (unsigned)(sizeof(uint64_t) * (state->buf_size >> 20))); RARCH_LOG("Readjusted rewind buffer size to %u MiB\n", (unsigned)(sizeof(uint64_t) * (state->buf_size >> 20)));
if (!(state->buffer = (uint64_t*)calloc(1, state->buf_size * sizeof(uint64_t)))) if (!(state->buffer = (uint64_t*)calloc(1, state->buf_size * sizeof(uint64_t))))
goto error; goto error;

View File

@ -13,8 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SSNES_REWIND_H #ifndef __RARCH_REWIND_H
#define __SSNES_REWIND_H #define __RARCH_REWIND_H
#include <stddef.h> #include <stddef.h>
#include "boolean.h" #include "boolean.h"

Some files were not shown because too many files have changed in this diff Show More