Commit 7a10cca7 authored by Chips-fr's avatar Chips-fr
Browse files

Add 3 amiga configurations in options menu of retroarch

parent 341372f1
# uae4arm-libretro
Basic port. Based on rtype version.
Basic port. Based on r-type version. Updated by Chips-fr.
## Controls
......@@ -21,4 +21,12 @@ In mouse emulation dpad and fire buttons controls the mouse.
Two joysticks support. Switch automatically between mouse or second joystick when a mouse or 2nd joystick button is pressed.
L & R button can change DF0: current disk for multiple disk roms. Each disk should be named with "(Disk x of y)"
\ No newline at end of file
L & R button can change DF0: current disk for multiple disk roms. Each disk should be named with "(Disk x of y)"
Kickstarts supported in options configuration:
|System|Version|Filename|Size|MD5|
|---|---|---|---|---|
|A500|KS v1.3 rev 34.005|**kick34005.A500**|262 144|82a21c1890cae844b3df741f2762d48d|
|A600|KS v3.1 rev 40.063|**kick40063.A600**|524 288|e40a5dfb3d017ba8779faba30cbd1c8e|
|A1200|KS v3.1 rev 40.068|**kick40068.A1200**|524 288|646773759326fbac3b2311fd8c8793ee|
......@@ -5,6 +5,7 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "custom.h"
cothread_t mainThread;
cothread_t emuThread;
......@@ -46,49 +47,71 @@ static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;
void retro_set_environment(retro_environment_t cb)
// Amiga default kickstarts
#define A500_ROM "kick34005.A500"
#define A600_ROM "kick40063.A600"
#define A1200_ROM "kick40068.A1200"
static char uae_machine[256];
static char uae_kickstart[16];
static char uae_config[1024];
#ifdef _WIN32
#define RETRO_PATH_SEPARATOR "\\"
// Windows also support the unix path separator
#define RETRO_PATH_SEPARATOR_ALT "/"
#else
#define RETRO_PATH_SEPARATOR "/"
#endif
void path_join(char* out, const char* basedir, const char* filename)
{
environ_cb = cb;
snprintf(out, MAX_PATH, "%s%s%s", basedir, RETRO_PATH_SEPARATOR, filename);
}
static const struct retro_controller_description p1_controllers[] = {
{ "AMIGA Joystick", RETRO_DEVICE_AMIGA_JOYSTICK },
{ "AMIGA Keyboard", RETRO_DEVICE_AMIGA_KEYBOARD },
};
static const struct retro_controller_description p2_controllers[] = {
{ "AMIGA Joystick", RETRO_DEVICE_AMIGA_JOYSTICK },
{ "AMIGA Keyboard", RETRO_DEVICE_AMIGA_KEYBOARD },
};
static const struct retro_controller_info ports[] = {
{ p1_controllers, 2 }, // port 1
{ p2_controllers, 2 }, // port 2
{ NULL, 0 }
};
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
cb( RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports );
static const struct retro_controller_description p1_controllers[] = {
{ "AMIGA Joystick", RETRO_DEVICE_AMIGA_JOYSTICK },
{ "AMIGA Keyboard", RETRO_DEVICE_AMIGA_KEYBOARD },
};
static const struct retro_controller_description p2_controllers[] = {
{ "AMIGA Joystick", RETRO_DEVICE_AMIGA_JOYSTICK },
{ "AMIGA Keyboard", RETRO_DEVICE_AMIGA_KEYBOARD },
};
struct retro_variable variables[] = {
static const struct retro_controller_info ports[] = {
{ p1_controllers, 2 }, // port 1
{ p2_controllers, 2 }, // port 2
{ NULL, 0 }
};
{
"uae4arm_resolution",
"Internal resolution; 320x240|320x256|320x262|640x240|640x256|640x262|640x270|768x270",
},
cb( RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports );
{
"uae4arm_leds_on_screen",
"Led:; on|off",
},
struct retro_variable variables[] = {
{ "uae4arm_model", "Model; A500|A600|A1200", },
{ "uae4arm_resolution", "Internal resolution; 640x270|320x240|320x256|320x262|640x240|640x256|640x262|640x270|768x270", },
{ "uae4arm_leds_on_screen", "Leds on screen; on|off", },
{ "uae4arm_floppy_speed", "Floppy speed; 100|200|400|800", },
{ NULL, NULL },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
}
static void update_variables(void)
{
uae_machine[0] = '\0';
uae_config[0] = '\0';
struct retro_variable var;
struct retro_variable var = {0};
var.key = "uae4arm_resolution";
var.value = NULL;
......@@ -108,7 +131,7 @@ static void update_variables(void)
changed_prefs.gfx_size.width = retrow;
changed_prefs.gfx_size.height = retroh;
changed_prefs.gfx_resolution = changed_prefs.gfx_size.width > 600 ? 1 : 0;
changed_prefs.gfx_resolution = changed_prefs.gfx_size.width > 600 ? 1 : 0;
LOGI("[libretro-uae4arm]: Got size: %u x %u.\n", retrow, retroh);
......@@ -127,6 +150,66 @@ static void update_variables(void)
if (strcmp(var.value, "on") == 0) changed_prefs.leds_on_screen = 1;
if (strcmp(var.value, "off") == 0) changed_prefs.leds_on_screen = 0;
}
var.key = "uae4arm_model";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "A500") == 0)
{
//strcat(uae_machine, A500);
//strcpy(uae_kickstart, A500_ROM);
//changed_prefs.cpu_type="68000";
changed_prefs.cpu_model = 68000;
changed_prefs.m68k_speed = M68K_SPEED_7MHZ_CYCLES;
changed_prefs.cpu_compatible = 0;
changed_prefs.chipmem_size = 2 * 0x80000;
changed_prefs.address_space_24 = 1;
changed_prefs.chipset_mask = CSMASK_ECS_AGNUS;
//strcpy(changed_prefs.romfile, A500_ROM);
path_join(changed_prefs.romfile, retro_system_directory, A500_ROM);
}
if (strcmp(var.value, "A600") == 0)
{
//strcat(uae_machine, A600);
//strcpy(uae_kickstart, A600_ROM);
changed_prefs.cpu_model = 68000;
changed_prefs.chipmem_size = 2 * 0x80000;
changed_prefs.m68k_speed = M68K_SPEED_7MHZ_CYCLES;
changed_prefs.cpu_compatible = 0;
changed_prefs.address_space_24 = 1;
changed_prefs.chipset_mask = CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS;
//strcpy(changed_prefs.romfile, A600_ROM);
path_join(changed_prefs.romfile, retro_system_directory, A600_ROM);
}
if (strcmp(var.value, "A1200") == 0)
{
//strcat(uae_machine, A1200);
//strcpy(uae_kickstart, A1200_ROM);
//changed_prefs.cpu_type="68ec020";
changed_prefs.cpu_model = 68020;
changed_prefs.chipmem_size = 4 * 0x80000;
changed_prefs.m68k_speed = M68K_SPEED_14MHZ_CYCLES;
changed_prefs.cpu_compatible = 0;
changed_prefs.address_space_24 = 1;
changed_prefs.chipset_mask = CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS;
//strcpy(changed_prefs.romfile, A1200_ROM);
path_join(changed_prefs.romfile, retro_system_directory, A1200_ROM);
}
}
var.key = "uae4arm_floppy_speed";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
changed_prefs.floppy_speed=atoi(var.value);
}
//fixup_prefs (&changed_prefs);
}
static void retro_wrap_emulator()
......@@ -160,6 +243,9 @@ void Emu_init(){
emuThread = co_create(8*65536*sizeof(void*), retro_wrap_emulator);
}
default_prefs (&changed_prefs, 0);
default_prefs (&currprefs, 0);
update_variables();
}
......@@ -181,22 +267,22 @@ void retro_reset(void){
}
void retro_init(void)
{
{
const char *system_dir = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &system_dir) && system_dir)
{
// if defined, use the system directory
retro_system_directory=system_dir;
}
// if defined, use the system directory
retro_system_directory=system_dir;
}
const char *content_dir = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY, &content_dir) && content_dir)
{
// if defined, use the system directory
retro_content_directory=content_dir;
}
// if defined, use the system directory
retro_content_directory=content_dir;
}
const char *save_dir = NULL;
......@@ -229,29 +315,29 @@ void retro_init(void)
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
fprintf(stderr, "PIXEL FORMAT is not supported.\n");
LOGI("PIXEL FORMAT is not supported.\n");
LOGI("PIXEL FORMAT is not supported.\n");
exit(0);
}
struct retro_input_descriptor inputDescriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "X" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Y" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" }
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
struct retro_input_descriptor inputDescriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "X" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Y" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" }
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
Emu_init();
......@@ -261,7 +347,7 @@ LOGI("PIXEL FORMAT is not supported.\n");
extern void main_exit();
void retro_deinit(void)
{
{
Emu_uninit();
co_switch(emuThread);
......@@ -270,7 +356,7 @@ void retro_deinit(void)
co_switch(mainThread);
LOGI("exit main\n");
if(emuThread)
{
{
co_delete(emuThread);
emuThread = 0;
}
......@@ -348,9 +434,7 @@ void retro_run(void)
if(pauseg==0)
{
if(SHOWKEY )retro_virtualkb();
if(SHOWKEY )retro_virtualkb();
}
video_cb(Retro_Screen,retrow,retroh,retrow<<PIXEL_BYTES);
......@@ -372,19 +456,19 @@ bool retro_load_game(const struct retro_game_info *info)
update_variables();
#ifdef RENDER16B
memset(Retro_Screen,0,1280*1024*2);
memset(Retro_Screen,0,1280*1024*2);
#else
memset(Retro_Screen,0,1280*1024*2*2);
memset(Retro_Screen,0,1280*1024*2*2);
#endif
memset(SNDBUF,0,1024*2*2);
memset(SNDBUF,0,1024*2*2);
co_switch(emuThread);
co_switch(emuThread);
return true;
}
void retro_unload_game(void){
void retro_unload_game(void)
{
pauseg=-1;
}
......
......@@ -27,7 +27,6 @@
#include "fsdb.h"
#include "disk.h"
#if defined(__LIBRETRO__)
extern int retroh,retrow; // Todo: need a proper include
#include "osdep/sound.h"
#else
#include "sd-pandora/sound.h"
......@@ -1646,13 +1645,8 @@ void default_prefs (struct uae_prefs *p, int type)
#ifdef RASPBERRY
#ifdef __LIBRETRO__
p->gfx_size.width = retrow;
p->gfx_size.height = retroh;
#else
p->gfx_size.width = 640;
p->gfx_size.height = 256;
#endif
#else
p->gfx_size.width = 320;
p->gfx_size.height = 240;
......
......@@ -52,7 +52,7 @@ extern int pauseg;
long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
struct uae_prefs currprefs, changed_prefs;
struct uae_prefs currprefs, changed_prefs, tmp_prefs;
int no_gui = 0;
int cloanto_rom = 0;
......@@ -440,6 +440,25 @@ void leave_program (void)
do_leave_program ();
}
void overwrite_with_retroarch_opt(void)
{
// Save options coming from libretro options...
currprefs.gfx_size.width = tmp_prefs.gfx_size.width;
currprefs.gfx_size.height = tmp_prefs.gfx_size.height ;
currprefs.gfx_resolution = tmp_prefs.gfx_resolution;
currprefs.leds_on_screen = tmp_prefs.leds_on_screen;
currprefs.cpu_model = tmp_prefs.cpu_model;
currprefs.address_space_24 = tmp_prefs.address_space_24;
currprefs.chipset_mask = tmp_prefs.chipset_mask;
currprefs.chipmem_size = tmp_prefs.chipmem_size;
strcpy (currprefs.romfile, tmp_prefs.romfile);
currprefs.m68k_speed = tmp_prefs.m68k_speed;
currprefs.cpu_compatible = tmp_prefs.cpu_compatible;
currprefs.floppy_speed = tmp_prefs.floppy_speed;
}
static void real_main2 (int argc, char **argv)
{
#ifdef RASPBERRY
......@@ -452,6 +471,7 @@ static void real_main2 (int argc, char **argv)
SDL_Init (SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);
#endif
#endif
tmp_prefs=changed_prefs;
if (restart_config[0]) {
default_prefs (&currprefs, 0);
......@@ -463,7 +483,10 @@ static void real_main2 (int argc, char **argv)
}
if (restart_config[0])
{
overwrite_with_retroarch_opt();
parse_cmdline_and_init_file (argc, argv);
}
else
currprefs = changed_prefs;
......@@ -558,7 +581,9 @@ void real_main (int argc, char **argv)
strcat (restart_config, OPTIONSFILENAME);
strcat (restart_config, ".uae");
while (restart_program) {
#ifndef __LIBRETRO__
changed_prefs = currprefs;
#endif
real_main2 (argc, argv);
leave_program ();
quit_program = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment