mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
(Wii) Add RARCH_EXEC for Wii port - should load values from
config file now and save them (WIP)
This commit is contained in:
parent
07a2803515
commit
aecd2be860
@ -39,7 +39,7 @@ CFLAGS += -DHAVE_FILE_LOGGER
|
||||
CFLAGS += -Iconsole/logger
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.6\" -Dmain=rarch_main -Wno-char-subscripts
|
||||
CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_RARCH_EXEC -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.6\" -Dmain=rarch_main -Wno-char-subscripts
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
|
72
console/exec/dol.c
Normal file
72
console/exec/dol.c
Normal file
@ -0,0 +1,72 @@
|
||||
// this code was contributed by shagkur of the devkitpro team, thx!
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "../../retroarch_logger.h"
|
||||
|
||||
typedef struct _dolheader
|
||||
{
|
||||
uint32_t text_pos[7];
|
||||
uint32_t data_pos[11];
|
||||
uint32_t text_start[7];
|
||||
uint32_t data_start[11];
|
||||
uint32_t text_size[7];
|
||||
uint32_t data_size[11];
|
||||
uint32_t bss_start;
|
||||
uint32_t bss_size;
|
||||
uint32_t entry_point;
|
||||
} dolheader;
|
||||
|
||||
uint32_t load_dol_image (void *dolstart)
|
||||
{
|
||||
uint32_t i;
|
||||
dolheader *dolfile;
|
||||
|
||||
if(dolstart)
|
||||
{
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for(i = 0; i < 7; i++)
|
||||
{
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
||||
continue;
|
||||
|
||||
RARCH_LOG("loading text section %u @ 0x%08x (0x%08x bytes)\n",
|
||||
i, dolfile->text_start[i], dolfile->text_size[i]);
|
||||
|
||||
ICInvalidateRange ((void *) dolfile->text_start[i],
|
||||
dolfile->text_size[i]);
|
||||
|
||||
memmove ((void *) dolfile->text_start[i], dolstart+dolfile->text_pos[i],
|
||||
dolfile->text_size[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 11; i++)
|
||||
{
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
||||
continue;
|
||||
|
||||
RARCH_LOG("loading data section %u @ 0x%08x (0x%08x bytes)\n", i,
|
||||
dolfile->data_start[i], dolfile->data_size[i]);
|
||||
|
||||
memmove ((void*) dolfile->data_start[i], dolstart+dolfile->data_pos[i],
|
||||
dolfile->data_size[i]);
|
||||
|
||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i], dolfile->data_size[i]);
|
||||
}
|
||||
|
||||
RARCH_LOG("clearing bss\n");
|
||||
|
||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
33
console/exec/dol.h
Normal file
33
console/exec/dol.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2008 dhewg, #wiidev efnet
|
||||
*
|
||||
* this file is part of geckoloader
|
||||
* http://wiibrew.org/index.php?title=Geckoloader
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _DOL_H_
|
||||
#define _DOL_H_
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
u32 load_dol_image (void *dolstart);
|
||||
|
||||
extern void __exception_closeall(void);
|
||||
extern int32_t __IOS_ShutdownSubSystems(void);
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,10 @@ CONSOLE EXTENSIONS
|
||||
#include "../rarch_console_main_wrap.c"
|
||||
#endif
|
||||
|
||||
#if defined(GEKKO)
|
||||
#include "../exec/dol.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RARCH_EXEC
|
||||
#include "../rarch_console_exec.c"
|
||||
#endif
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include <np/drm.h>
|
||||
#elif defined(_XBOX)
|
||||
#include <xtl.h>
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/machine/processor.h>
|
||||
#include "exec/dol.h"
|
||||
#endif
|
||||
|
||||
#include "rarch_console_exec.h"
|
||||
@ -63,6 +66,29 @@ void rarch_console_exec(const char *path)
|
||||
sys_net_finalize_network();
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
|
||||
#elif defined(GEKKO)
|
||||
uint32_t level;
|
||||
FILE * fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
RARCH_ERR("Could not execute DOL file.\n");
|
||||
return;
|
||||
}
|
||||
fseek(fp, 0, SEEK_END);
|
||||
size_t size = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
u8 *mem = (u8 *)0x92000000; // should be safe for this small program to use
|
||||
fread(mem, 1, size, fp);
|
||||
fclose(fp);
|
||||
void (*ep)() = (void(*)())load_dol_image(mem);
|
||||
RARCH_LOG("jumping to 0x%08X\n", (unsigned int)ep);
|
||||
|
||||
__IOS_ShutdownSubsystems();
|
||||
_CPU_ISR_Disable (level);
|
||||
__exception_closeall ();
|
||||
RARCH_LOG("__exception_closeall() done. Jumping to ep now...\n");
|
||||
ep();
|
||||
_CPU_ISR_Restore (level);
|
||||
#else
|
||||
RARCH_WARN("External loading of executables is not supported for this platform.\n");
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "../../console/rgui/rgui.h"
|
||||
|
||||
#include "../../console/rarch_console_exec.h"
|
||||
#include "../../console/rarch_console_input.h"
|
||||
#include "../../console/rarch_console_main_wrap.h"
|
||||
|
||||
@ -235,6 +236,7 @@ int main(void)
|
||||
#endif
|
||||
|
||||
config_set_defaults();
|
||||
input_wii.init();
|
||||
|
||||
retro_get_system_info(&wii_core_info);
|
||||
RARCH_LOG("Core: %s\n", wii_core_info.library_name);
|
||||
@ -244,8 +246,12 @@ int main(void)
|
||||
g_console.block_config_read = true;
|
||||
|
||||
wii_video_init();
|
||||
input_wii.init();
|
||||
rarch_input_set_controls_default(&input_wii);
|
||||
|
||||
const char *extension = default_paths.executable_extension;
|
||||
|
||||
rarch_settings_set_default(&input_wii);
|
||||
rarch_config_load(default_paths.config_file, /* path_prefix */ NULL, extension, /* find_libretro_file */ false);
|
||||
init_libretro_sym();
|
||||
|
||||
input_wii.post_init();
|
||||
|
||||
@ -269,6 +275,9 @@ int main(void)
|
||||
audio_stop_func();
|
||||
}
|
||||
|
||||
if(path_file_exists(default_paths.config_file))
|
||||
rarch_config_save(default_paths.config_file);
|
||||
|
||||
if(g_console.emulator_initialized)
|
||||
rarch_main_deinit();
|
||||
|
||||
@ -283,6 +292,10 @@ int main(void)
|
||||
#endif
|
||||
|
||||
rgui_free(rgui);
|
||||
|
||||
if(g_console.return_to_launcher)
|
||||
rarch_console_exec(g_console.launch_app_on_exit);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user