Commit e63e6bf6 authored by Cayce's avatar Cayce
Browse files

migrate to fMSX6.0.

No changelog. Only content is an update of MakeFileName().

Added some whitespace 'fixes', and some documentation for future developers.
parent 92fddd52
fmsx
====
This is a port of Marat Fayzullin's fMSX 5.9 to the libretro API.
This is a port of Marat Fayzullin's fMSX 6.0 (21-Feb-2021) to the libretro API.
Source : http://fms.komkon.org/fMSX/
......@@ -27,6 +27,8 @@ A star (*) indicates this is the default setting.
## BIOS
BIOS ROMs are loading from RetroArch's `system_directory`.
These BIOS ROMs are required for execution:
* MSX1: MSX.ROM
* MSX2: MSX2.ROM, MSX2EXT.ROM
......@@ -45,7 +47,7 @@ Optional; loaded when found:
## Technical details
Video: 16bpp RGB565 272x228 (544x228 in 512px MSX2 screen modes). This includes an 8px (16px) border; MSX native screen resolutions are:
Video: 16bpp RGB565 (PSP: BGR565, PS2: BGR555) 272x228 (544x228 in 512px MSX2 screen modes). This includes an 8px (16px) border; MSX native screen resolutions are:
- horizontal: 256 or 512 (textmode: 40 or 80 columns)
- vertical: 192 or 212
......@@ -53,3 +55,85 @@ Audio: rendered in 48kHz 16b mono.
fMSX emulates PSG, SCC and FM-PAC.
Framerate: NTSC (US/JP) implies 60Hz - thus 60FPS, PAL (EU) implies 50Hz (=50FPS). Gameplay and audio actually becomes 17% slower when switching from NTSC to PAL - just like on a real MSX.
### MSX1 colour palette
This is how fMSX implements it by default:
* 0 : 000000
* 1 : 000000
* 2 : 20C020
* 3 : 60E060
* 4 : 2020E0
* 5 : 4060E0
* 6 : A02020
* 7 : 40C0E0
* 8 : E02020
* 9 : E06060
* A : C0C020
* B : C0C080
* C : 208020
* D : C040A0
* E : A0A0A0
* F : E0E0E0
Note: there is some discussion about the 'right' mapping of TMS9918 colours to RGB. This is how fMSX does it.
## Developers
Some information for developers wanting to upgrade to newer fMSX versions, or improve this port.
### Changes applied to the fMSX sources in this port
Some changes are applied to the fMSX core in order to make fmsx-libretro portable & efficient for its target audience.
* portability refactorings, e.g. `register` flags removed, PS Vita file support, etc.
* (verbose) logging removed, including startup info & some debugging statements
* some whitespace
* `EMULib.c` `WaitJoystick()` is empty; implemented another way in `libretro.c`
* RetroArch VFS (Virtual FileSystem) used (`rfopen` etc.); ZLIB code removed
* removed various pieces of code intended for older ports, like Borland C, Meego, etc.
* removed various pieces of code intended for other platforms (fMSX is part of a suite of emulators)
* removed `SndDriver`; implemented another way in `libretro.c`
* reimplemented state loading/saving
* switched MSB first/LSB first
* due to the fact that fmsx-libretro renders audio&video per scanline:
* delay invocation of `SyncSCC()`/`Sync2413()` to fix a sound interference bug
* drop invocation of `PlayAllSound()`
* `MSX.c` `LoopZ80()`: move `if(ExitNow) return(INT_QUIT)` downwards to support `autospace` option.
### non-ported fMSX features
Mostly because RetroArch supports this out of the box, or because it falls out of scope.
* built-in debugger
* in-emulator options menu
* MIDI sound export ('MIDI logging')
* IPS patching
* custom shader-like effects
* cheat 'hunter'
* net play
* record & playback
* support for touch devices
* mouse in both joystick & real mode
The following fMSX code is not present in this core:
* fMSX/Unix-related code
* EMULib: `Console(Mux).c/h, Hunt.c/h, Image.c, ImageMux.h, IPS.c/h, MIDIFreq.h, NetPlay.c/h, Record.c/h, Touch(Mux).c/h`
* fMSX: `fMSX.c, fMSX.html, Help.h, Menu.c, Patch.c`
### non-ported/supported fMSX cmdline options
* all of these options:
-verbose <level>
-skip <percent> - always 0
-help
-home <dirname>
-printer <filename>
-serial <filename>
-diskb <filename>
-font <filename>
-logsnd <filename> - MIDI logging removed
-state <filename>
-joy <type> - both joysticks always on. Both mouse modes unsupported.
-sound [<quality>] - always 48kHz
-nosound
* All effects-related options
* All options based on a platform-specific `#define` (incl. `-static`, `-nosync` & `-sync`)
......@@ -2251,15 +2251,25 @@ word StateID(void)
/** Make a copy of the file name, replacing the extension. **/
/** Returns allocated new name or 0 on failure. **/
/*************************************************************/
char *MakeFileName(const char *FileName,const char *Extension)
char *MakeFileName(const char *Name,const char *Ext)
{
char *Result,*P;
char *Result,*P1,*P2,*P3;
Result = malloc(strlen(FileName)+strlen(Extension)+1);
Result = malloc(strlen(Name)+strlen(Ext)+1);
if(!Result) return(0);
strcpy(Result,Name);
/* Locate where extension and filename actually start */
P1 = strrchr(Result,'.');
P2 = strrchr(Result,'/');
P3 = strrchr(Result,'\\');
P2 = P3 && (P3>P2)? P3:P2;
P3 = strrchr(Result,':');
P2 = P3 && (P3>P2)? P3:P2;
if(P1 && (!P2 || (P1>P2))) strcpy(P1,Ext);
else strcat(Result,Ext);
strcpy(Result,FileName);
if((P = strrchr(Result,'.'))) strcpy(P,Extension); else strcat(Result,Extension);
return(Result);
}
......
......@@ -263,7 +263,7 @@ void retro_get_system_info(struct retro_system_info *info)
#ifndef GIT_VERSION
#define GIT_VERSION ""
#endif
info->library_version = "4.9" GIT_VERSION;
info->library_version = "6.0" GIT_VERSION;
info->need_fullpath = true;
info->block_extract = false;
info->valid_extensions = "rom|mx1|mx2|dsk|cas";
......@@ -285,7 +285,6 @@ void retro_init(void)
int i;
struct retro_log_callback log;
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
log_cb = log.log;
else
......@@ -456,7 +455,8 @@ void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; }
void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; }
static void update_fps(void) {
static void update_fps(void)
{
fps = (Mode & MSX_PAL) ? 50 : 60;
}
......@@ -493,7 +493,6 @@ void retro_cheat_set(unsigned a, bool b, const char * c) {}
void PutImage(void)
{
ExitNow = 1;
}
static void check_variables(void)
......@@ -684,7 +683,7 @@ bool retro_load_game(const struct retro_game_info *info)
return false;
}
image_buffer = (uint16_t*)malloc(640*480*sizeof(uint16_t));
image_buffer = (uint16_t*)malloc(640*480*sizeof(uint16_t));
environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &ProgDir);
......@@ -809,7 +808,6 @@ void retro_unload_game(void)
image_buffer = NULL;
image_buffer_width = 0;
image_buffer_height = 0;
}
unsigned retro_get_region(void)
......
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