Commit d170d296 authored by Carlos Herrero's avatar Carlos Herrero
Browse files

Normalized line endings

parent d856a29a
......@@ -32,7 +32,7 @@ static uint16_t XPal0;
#define XBuf image_buffer
#define WBuf image_buffer
#include "CommonMux.h"
#include "Missing.h"
#include "Missing.h"
uint8_t XKeyState[20];
#define XKBD_SET(K) XKeyState[Keys[K][0]]&=~Keys[K][1]
......@@ -253,7 +253,7 @@ void retro_get_system_info(struct retro_system_info *info)
info->library_version = "4.9" GIT_VERSION;
info->need_fullpath = true;
info->block_extract = false;
info->valid_extensions = "rom|mx1|mx2|dsk|cas";
info->valid_extensions = "rom|mx1|mx2|dsk|cas";
}
void retro_get_system_av_info(struct retro_system_av_info *info)
......@@ -265,28 +265,28 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.aspect_ratio = 0;
info->timing.fps = 60.0;
info->timing.sample_rate = SND_RATE;
}
void retro_init(void)
{
int i;
}
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
else
log_cb = NULL;
}
void retro_deinit(void)
{
log_cb(RETRO_LOG_INFO, "maximum frame ticks : %llu\n", max_frame_ticks);
}
static void set_input_descriptors(void)
{
struct retro_input_descriptor descriptors_keyb_emu0[] = {
}
void retro_deinit(void)
{
log_cb(RETRO_LOG_INFO, "maximum frame ticks : %llu\n", max_frame_ticks);
}
static void set_input_descriptors(void)
{
struct retro_input_descriptor descriptors_keyb_emu0[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Stick Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Stick Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Stick Down" },
......@@ -362,53 +362,53 @@ static void set_input_descriptors(void)
}
in_ptr = descriptors_joystick1;
while(in_ptr->description)
*(out_ptr++) = *(in_ptr)++;
out_ptr->description = NULL;
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, descriptors);
}
void retro_set_environment(retro_environment_t cb)
{
bool no_content = true;
static const struct retro_controller_description port0[] = {
{ "Joystick + Emulated Keyboard", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0) },
{ "Emulated Keyboard", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1) },
{ "Keyboard", RETRO_DEVICE_KEYBOARD },
{ "Joystick", RETRO_DEVICE_JOYPAD },
};
static const struct retro_controller_description port1[] = {
{ "joystick", RETRO_DEVICE_JOYPAD}
};
static const struct retro_controller_info ports[] = {
{ port0, 4 },
{ port1, 1 },
{ 0 },
};
static const struct retro_variable vars[] = {
{ "fmsx_mode", "MSX Mode; MSX2+|MSX1|MSX2" },
{ "fmsx_video_mode", "MSX Video Mode; NTSC|PAL" },
{ "fmsx_mapper_type_mode", "MSX Mapper Type Mode; Guess Mapper Type A|Guess Mapper Type B" },
{ "fmsx_ram_pages", "MSX Main Memory; Auto|64KB|128KB|256KB|512KB" },
{ "fmsx_vram_pages", "MSX Video Memory; Auto|32KB|64KB|128KB|192KB" },
{ NULL, NULL },
};
environ_cb = cb;
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
}
void retro_set_controller_port_device(unsigned port, unsigned device)
{
if(port == 0)
{
while(in_ptr->description)
*(out_ptr++) = *(in_ptr)++;
out_ptr->description = NULL;
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, descriptors);
}
void retro_set_environment(retro_environment_t cb)
{
bool no_content = true;
static const struct retro_controller_description port0[] = {
{ "Joystick + Emulated Keyboard", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0) },
{ "Emulated Keyboard", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1) },
{ "Keyboard", RETRO_DEVICE_KEYBOARD },
{ "Joystick", RETRO_DEVICE_JOYPAD },
};
static const struct retro_controller_description port1[] = {
{ "joystick", RETRO_DEVICE_JOYPAD}
};
static const struct retro_controller_info ports[] = {
{ port0, 4 },
{ port1, 1 },
{ 0 },
};
static const struct retro_variable vars[] = {
{ "fmsx_mode", "MSX Mode; MSX2+|MSX1|MSX2" },
{ "fmsx_video_mode", "MSX Video Mode; NTSC|PAL" },
{ "fmsx_mapper_type_mode", "MSX Mapper Type Mode; Guess Mapper Type A|Guess Mapper Type B" },
{ "fmsx_ram_pages", "MSX Main Memory; Auto|64KB|128KB|256KB|512KB" },
{ "fmsx_vram_pages", "MSX Video Memory; Auto|32KB|64KB|128KB|192KB" },
{ NULL, NULL },
};
environ_cb = cb;
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
}
void retro_set_controller_port_device(unsigned port, unsigned device)
{
if(port == 0)
{
port0_device = device;
set_input_descriptors();
}
......@@ -457,55 +457,55 @@ void PutImage(void)
}
static void check_variables(void)
{
bool reset_sfx = false;
struct retro_variable var;
int ModeRAM = 0;
int ModeVRAM = 0;
var.key = "fmsx_mode";
var.value = NULL;
Mode = 0;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "MSX1") == 0)
{
Mode |= MSX_MSX1;
ModeRAM = 4;
ModeVRAM = 2;
}
else if (strcmp(var.value, "MSX2") == 0)
{
Mode |= MSX_MSX2;
ModeRAM = 8;
ModeVRAM = 8;
}
else if (strcmp(var.value, "MSX2+") == 0)
{
Mode |= MSX_MSX2P;
ModeRAM = 16;
ModeVRAM = 8;
}
}
else
{
Mode |= MSX_MSX2P;
ModeRAM = 16;
ModeVRAM = 8;
}
var.key = "fmsx_video_mode";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "NTSC") == 0)
Mode |= MSX_NTSC;
else if (strcmp(var.value, "PAL") == 0)
Mode |= MSX_PAL;
}
{
bool reset_sfx = false;
struct retro_variable var;
int ModeRAM = 0;
int ModeVRAM = 0;
var.key = "fmsx_mode";
var.value = NULL;
Mode = 0;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "MSX1") == 0)
{
Mode |= MSX_MSX1;
ModeRAM = 4;
ModeVRAM = 2;
}
else if (strcmp(var.value, "MSX2") == 0)
{
Mode |= MSX_MSX2;
ModeRAM = 8;
ModeVRAM = 8;
}
else if (strcmp(var.value, "MSX2+") == 0)
{
Mode |= MSX_MSX2P;
ModeRAM = 16;
ModeVRAM = 8;
}
}
else
{
Mode |= MSX_MSX2P;
ModeRAM = 16;
ModeVRAM = 8;
}
var.key = "fmsx_video_mode";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "NTSC") == 0)
Mode |= MSX_NTSC;
else if (strcmp(var.value, "PAL") == 0)
Mode |= MSX_PAL;
}
else
{
Mode |= MSX_NTSC;
......@@ -561,137 +561,137 @@ static void check_variables(void)
else if (strcmp(var.value, "128KB") == 0)
VRAMPages = 8;
else if (strcmp(var.value, "192KB") == 0)
VRAMPages = 12;
}
else
{
VRAMPages = ModeVRAM;
}
}
bool retro_load_game(const struct retro_game_info *info)
{
static Image fMSX_image;
int i;
static char ROMName_buffer[MAXCARTS][1024];
static char DSKName_buffer[MAXDRIVES][1024];
static char CasName_buffer[1024];
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
if (log_cb)
log_cb(RETRO_LOG_INFO, "RGB565 is not supported.\n");
return false;
}
image_buffer = (uint16_t*)malloc(640*480*sizeof(uint16_t));
image_buffer_width = 272;
image_buffer_height = 228;
environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &ProgDir);
check_variables();
set_input_descriptors();
Verbose=1;
UPeriod=100;
if (info)
{
char *dot = strrchr(info->path, '.');
if (dot && ( !strcmp(dot, ".rom") || !strcmp(dot, ".mx1") || !strcmp(dot, ".mx2") ))
{
strcpy(ROMName_buffer[0], info->path);
ROMName[0]=ROMName_buffer[0];
}
else if (dot && !strcmp(dot, ".dsk"))
{
strcpy(DSKName_buffer[0], info->path);
DSKName[0]=DSKName_buffer[0];
}
else if (dot && !strcmp(dot, ".cas"))
{
strcpy(CasName_buffer, info->path);
CasName=CasName_buffer;
}
}
else
{
ROMName[0]=NULL;
DSKName[0]=NULL;
CasName=NULL;
}
SETJOYTYPE(0,1);
fMSX_image.Cropped = 0;
fMSX_image.D = 16;
fMSX_image.Data = image_buffer;
fMSX_image.W = image_buffer_width;
fMSX_image.H = image_buffer_height;
fMSX_image.L = image_buffer_width;
GenericSetVideo(&fMSX_image,0,0,image_buffer_width,image_buffer_height);
for(i = 0; i < 80; i++)
SetColor(i, 0, 0, 0);
for(i = 0; i < 256; i++)
BPal[i]=PIXEL(((i>>2)&0x07)*255/7,((i>>5)&0x07)*255/7,(i&0x03)*255/3);
memset((void *)XKeyState,0xFF,sizeof(XKeyState));
InitSound(SND_RATE, 0);
SetChannels(255/MAXCHANNELS, (1<<MAXCHANNELS)-1);
ExitNow = 1;
StartMSX(Mode,RAMPages,VRAMPages);
printf ("Mode %i, RAMPages %i, VRAMPages %i", Mode, RAMPages, VRAMPages);
return true;
}
void SetColor(byte N,byte R,byte G,byte B)
{
if(N)
XPal[N]=PIXEL(R,G,B);
else
XPal0=PIXEL(R,G,B);
}
int PauseAudio(int Switch)
{
return 1;
}
unsigned int GetFreeAudio(void)
{
return 1024;
}
unsigned int WriteAudio(sample *Data,unsigned int Length)
{
static uint16_t audio_buf[1024 * 2];
int i;
if (Length > 1024)
Length = 1024;
for (i=0; i < Length; i++)
{
audio_buf[i << 1]=Data[i];
audio_buf[(i << 1) + 1]=Data[i];
}
return audio_batch_cb(audio_buf, Length);
}
unsigned int Joystick(void)
{
return joystate;
}
VRAMPages = 12;
}
else
{
VRAMPages = ModeVRAM;
}
}
bool retro_load_game(const struct retro_game_info *info)
{
static Image fMSX_image;
int i;
static char ROMName_buffer[MAXCARTS][1024];
static char DSKName_buffer[MAXDRIVES][1024];
static char CasName_buffer[1024];
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
if (log_cb)
log_cb(RETRO_LOG_INFO, "RGB565 is not supported.\n");
return false;
}
image_buffer = (uint16_t*)malloc(640*480*sizeof(uint16_t));
image_buffer_width = 272;
image_buffer_height = 228;
environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &ProgDir);
check_variables();
set_input_descriptors();
Verbose=1;
UPeriod=100;
if (info)
{
char *dot = strrchr(info->path, '.');
if (dot && ( !strcmp(dot, ".rom") || !strcmp(dot, ".mx1") || !strcmp(dot, ".mx2") ))
{
strcpy(ROMName_buffer[0], info->path);
ROMName[0]=ROMName_buffer[0];
}
else if (dot && !strcmp(dot, ".dsk"))
{
strcpy(DSKName_buffer[0], info->path);
DSKName[0]=DSKName_buffer[0];
}
else if (dot && !strcmp(dot, ".cas"))
{
strcpy(CasName_buffer, info->path);
CasName=CasName_buffer;
}
}
else
{
ROMName[0]=NULL;
DSKName[0]=NULL;
CasName=NULL;
}
SETJOYTYPE(0,1);
fMSX_image.Cropped = 0;
fMSX_image.D = 16;
fMSX_image.Data = image_buffer;
fMSX_image.W = image_buffer_width;
fMSX_image.H = image_buffer_height;
fMSX_image.L = image_buffer_width;
GenericSetVideo(&fMSX_image,0,0,image_buffer_width,image_buffer_height);
for(i = 0; i < 80; i++)
SetColor(i, 0, 0, 0);
for(i = 0; i < 256; i++)
BPal[i]=PIXEL(((i>>2)&0x07)*255/7,((i>>5)&0x07)*255/7,(i&0x03)*255/3);
memset((void *)XKeyState,0xFF,sizeof(XKeyState));
InitSound(SND_RATE, 0);
SetChannels(255/MAXCHANNELS, (1<<MAXCHANNELS)-1);
ExitNow = 1;
StartMSX(Mode,RAMPages,VRAMPages);
printf ("Mode %i, RAMPages %i, VRAMPages %i", Mode, RAMPages, VRAMPages);
return true;
}
void SetColor(byte N,byte R,byte G,byte B)
{
if(N)
XPal[N]=PIXEL(R,G,B);
else
XPal0=PIXEL(R,G,B);
}
int PauseAudio(int Switch)
{
return 1;
}
unsigned int GetFreeAudio(void)
{
return 1024;
}
unsigned int WriteAudio(sample *Data,unsigned int Length)
{
static uint16_t audio_buf[1024 * 2];
int i;
if (Length > 1024)
Length = 1024;
for (i=0; i < Length; i++)
{
audio_buf[i << 1]=Data[i];
audio_buf[(i << 1) + 1]=Data[i];
}
return audio_batch_cb(audio_buf, Length);
}
unsigned int Joystick(void)
{
return joystate;
}
void Keyboard(void)
{
}
......@@ -735,7 +735,7 @@ size_t retro_get_memory_size(unsigned id)
return 0;
}
#ifdef PSP
#include <pspgu.h>
#endif
......
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