Merge pull request #1 from r-type/master

update
This commit is contained in:
Twinaphex
2017-03-05 20:08:35 +01:00
committed by GitHub
8 changed files with 292 additions and 55 deletions
+10 -3
View File
@@ -232,7 +232,15 @@ else ifneq (,$(findstring armv,$(platform)))
# emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
# cross Windows
else ifeq ($(platform), wincross64)
TARGET := $(TARGET_NAME)_libretro.dll
AR = x86_64-w64-mingw32-ar
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=link.T
LIBS += -lshlwapi
PLATFORM_DEFINES += -DDIR_SEP_BACKSLASH=1
# Windows
else
TARGET := $(TARGET_NAME)_libretro.dll
@@ -241,8 +249,7 @@ else
CXX = g++
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=link.T
LIBS += -lshlwapi
HAVE_WIN32_MSX_MANAGER = 1
PLATFORM_DEFINES += -D__WIN32__ -DDIR_SEP_BACKSLASH=1
endif
CORE_DIR := .
+51 -3
View File
@@ -1370,7 +1370,10 @@ void CARTRIDGE_ColdStart(void) {
ResetCartState(&CARTRIDGE_piggyback);
MapActiveCart();
}
#ifdef __LIBRETRO__
#include "atari5200_hash.h"
extern int autorun5200;
#endif
/* Loads a cartridge from FILENAME. Copies FILENAME to CART_FILENAME.
Allocates a buffer with cartridge image data and puts it in *CART_IMAGE.
Sets *CART_TYPE to the cartridge type. */
@@ -1380,7 +1383,9 @@ static int InsertCartridge(const char *filename, CARTRIDGE_image_t *cart)
int len;
int type;
UBYTE header[16];
#ifdef __LIBRETRO__
ULONG crc;
#endif
/* open file */
fp = fopen(filename, "rb");
if (fp == NULL)
@@ -1388,7 +1393,12 @@ static int InsertCartridge(const char *filename, CARTRIDGE_image_t *cart)
/* check file length */
len = Util_flen(fp);
Util_rewind(fp);
#ifdef __LIBRETRO__
if(autorun5200){
CRC32_FromFile(fp, &crc);
Util_rewind(fp);
}
#endif
/* Guard against providing cart->filename as parameter. */
if (cart->filename != filename)
/* Save Filename for state save */
@@ -1406,6 +1416,41 @@ static int InsertCartridge(const char *filename, CARTRIDGE_image_t *cart)
cart->type = CARTRIDGE_NONE;
len >>= 10; /* number of kilobytes */
cart->size = len;
#ifdef __LIBRETRO__
if(autorun5200){
int match=0,i=0;
printf("Hack Libretro:crc A5200 ON sz:%d crc:%x\n",cart->size,crc);
while(a5200_game[i].type!=-1){
if(crc==a5200_game[i].crc){
match=1;
if(a5200_game[i].type==0)
switch(cart->size*1024){
case 4096:
cart->type =CARTRIDGE_5200_4;
break;
case 8192:
cart->type =CARTRIDGE_5200_8;
break;
case 16384:
cart->type =CARTRIDGE_5200_NS_16;
break;
case 32768:
cart->type =CARTRIDGE_5200_32;
break;
}
else if(a5200_game[i].type==1)cart->type =CARTRIDGE_5200_40;
else if(a5200_game[i].type==2)cart->type =CARTRIDGE_5200_EE_16;
printf("Hack Libretro:A5200 cart->type:%d %x\n",cart->type,crc);
break;
}
i++;
}
if(match==1)goto label_fin;
}
#endif
for (type = 1; type <= CARTRIDGE_LAST_SUPPORTED; type++)
if (CARTRIDGE_kb[type] == len) {
if (cart->type == CARTRIDGE_NONE) {
@@ -1416,6 +1461,9 @@ static int InsertCartridge(const char *filename, CARTRIDGE_image_t *cart)
return len;
}
}
#ifdef __LIBRETRO__
label_fin:
#endif
if (cart->type != CARTRIDGE_NONE) {
InitCartridge(cart);
return 0; /* ok */
+3
View File
@@ -435,6 +435,9 @@ static int Devices_MakeDirectory(const char *filename)
static int Devices_MakeDirectory(const char *filename)
{
#ifdef __WIN32__
#define MKDIR_TAKES_ONE_ARG 1
#endif
return mkdir(filename
#ifndef MKDIR_TAKES_ONE_ARG
, 0777
+122
View File
@@ -0,0 +1,122 @@
#define a5200 0
#define a5200_40 1
#define a5200_ee_16 2
typedef struct {
int type;
char name[50];
int size;
ULONG crc;
} a5200_rom;
a5200_rom a5200_game[]={
{ a5200,"5200menu.bin",8192,0x0de2db48},
{ a5200,"aep.bin",16384,0x35484751},
{ a5200,"decathln.bin",16384,0xf43e7cd0},
{ a5200,"asteroid.bin",8192,0x38480891},
{ a5200_ee_16,"astrchse.bin",16384,0x4019ecec},
{ a5200,"ballblze.bin",32768,0x94d97d14},
{ a5200_ee_16,"bzone.bin",16384,0xb3b8e314},
{ a5200,"beamrid.bin",16384,0x9bae58dc},
{ a5200,"berzerk.bin",16384,0xbe3cd348},
{ a5200,"blckbelt.bin",32768,0xed47b0d8},
{ a5200,"blaster.bin",16384,0xc8f9c094},
{ a5200,"blueprnt.bin",16384,0x0624e6e7},
{ a5200_40,"bbstrksb.bin",40960,0x7873c6dd},
{ a5200_ee_16,"buckrog.bin",16384,0x04807705},
{ a5200_ee_16,"centiped.bin",16384,0x536a70fe},
{ a5200,"choplift.bin",16384,0x9ad53bbc},
{ a5200_ee_16,"congo.bin",16384,0xf1f42bbd},
{ a5200_ee_16,"cntrmsre.bin",16384,0xfd541c80},
{ a5200,"pitfall2.bin",16384,0x4b910461},
{ a5200_ee_16,"defender.bin",16384,0xbd52623b},
{ a5200_ee_16,"digdug.bin",16384,0x6a687f9c},
{ a5200,"dredfctr.bin",8192,0x460def2d},
{ a5200,"finalleg.bin",16384,0xd3bd3221},
{ a5200_ee_16,"friskyt.bin",16384,0x04b299a4},
{ a5200,"frogger.bin",8192,0xae7e3444},
{ a5200_ee_16,"frogger2.bin",16384,0x0af19345},
{ a5200,"galaxian.bin",8192,0x3ef4a23f},
{ a5200,"gorf.bin",8192,0xe955db74},
{ a5200,"gremlins.bin",32768,0x063ec2c4},
{ a5200_ee_16,"gyruss.bin",16384,0xcfd4a7f9},
{ a5200,"hero.bin",16384,0x18a73af3},
{ a5200_ee_16,"jamesbnd.bin",16384,0xd9ae4518},
{ a5200_ee_16,"joust.bin",16384,0xbfd30c01},
{ a5200_ee_16,"jrpacman.bin",16384,0x59983c40},
{ a5200_ee_16,"jungleh.bin",16384,0x2c676662},
{ a5200,"krazysht.bin",8192,0xee702214},
{ a5200,"kaboom.bin",4096,0x420f5d0b},
{ a5200_ee_16,"kangaroo.bin",16384,0xecfa624f},
{ a5200,"keystone.bin",8192,0x8fe3bb2c},
{ a5200,"laststar.bin",16384,0x83517703},
{ a5200_ee_16,"loontoon.bin",16384,0x84df4925},
{ a5200,"mario.bin",32768,0x873742f1},
{ a5200,"meebzork.bin",32768,0x9fb13411},
{ a5200,"megamnia.bin",8192,0x240a1e1a},
{ a5200,"meteorit.bin",16384,0xab8e035b},
{ a5200_ee_16,"microgam.bin",16384,0x931a454a},
{ a5200,"milliped.bin",16384,0x969cfe1a},
{ a5200,"mine2049.bin",16384,0x7df1adfb},
{ a5200_ee_16,"minigolf.bin",16384,0xc597c087},
{ a5200,"missile.bin",8192,0x44d3ff6f},
{ a5200_ee_16,"montezum.bin",16384,0x2a640143},
{ a5200,"mpatrol.bin",16384,0xd0b2f285},
{ a5200,"mntnking.bin",8192,0x0f24243c},
{ a5200,"docastle.bin",8192,0xaa55f9be},
{ a5200_ee_16,"mspacman.bin",16384,0x752f5efd},
{ a5200_ee_16,"pacman.bin",16384,0x8873ef51},
{ a5200,"pengo.bin",32768,0xe4f8ba8c},
{ a5200,"pitfall.bin",8192,0xb2887833},
{ a5200_ee_16,"polepos.bin",16384,0xabc2d1e4},
{ a5200_ee_16,"popeye.bin",16384,0xa18a9a40},
{ a5200,"qbert.bin",8192,0x3fe4a401},
{ a5200_ee_16,"qix.bin",16384,0xaea6d2c2},
{ a5200,"questroo.bin",16384,0xb5f3402b},
{ a5200,"rsbsebll.bin",32768,0x44166592},
{ a5200,"rsbktbll.bin",32768,0xdd217276},
{ a5200,"rsbktbll1.bin",32768,0xc90196fa},
{ a5200_ee_16,"rsbktbll2.bin",16384,0x0f996184},
{ a5200_ee_16,"rsftball.bin",16384,0x4336c2cc},
{ a5200_ee_16,"rssoccer.bin",16384,0xecbd1853},
{ a5200_ee_16,"rstennis.bin",16384,0x10f33c90},
{ a5200,"fractal.bin",32768,0x762c591b},
{ a5200,"riveraid.bin",8192,0x09fc7648},
{ a5200_ee_16,"roadrun.bin",16384,0xa97606ab},
{ a5200,"robotron.bin",16384,0x4252abd9},
{ a5200_ee_16,"spcedngn.bin",16384,0xb68d61e8},
{ a5200,"spaceinv.bin",8192,0xde5c354a},
{ a5200,"spceshut.bin",16384,0x387365dc},
{ a5200,"spitfire.bin",32768,0x3c311303},
{ a5200_ee_16,"sprtgoof.bin",16384,0x73b5b6fb},
{ a5200_ee_16,"starraid.bin",16384,0x7d819a9f},
{ a5200_ee_16,"startrek.bin",16384,0x69f23548},
{ a5200,"starwars.bin",8192,0x0675f0a5},
{ a5200_ee_16,"swa.bin",16384,0x75f566df},
{ a5200_ee_16,"stargate.bin",16384,0x1d1cee27},
{ a5200,"sprbreak.bin",4096,0xa0642110},
{ a5200,"scobra.bin",8192,0x97debcd2},
{ a5200,"spacman.bin",16384,0x0a4ddb1e},
{ a5200,"tempest.bin",16384,0x1187342f},
{ a5200,"trackfld.bin",16384,0x0ba22ece},
{ a5200,"vanguard.bin",32768,0xcaaea0a4},
{ a5200,"wow.bin",16384,0xd6f7ddfd},
{ a5200_ee_16,"xariarna.bin",16384,0xb8faaec3},
{ a5200,"xevious.bin",32768,0x382634dc},
{ a5200,"yllowsub.bin",4096,0xf47bc091},
{ a5200,"zaxxon.bin",32768,0x741746d1},
{ a5200,"zenji.bin",8192,0xda228530},
{ a5200,"znerangr.bin",16384,0x2959d827},
{ a5200,"petetest.bin",8192,0x28278cd6},
{ a5200_ee_16,"pamdiag2.bin",16384,0xe8b130c4},
{ a5200_ee_16,"pamdg23.bin",16384,0xce07d9ad},
{ a5200,"finaltst.bin",8192,0x7ea86e87},
{ a5200,"boogie.bin",4096,0x3bd5fdd6},
{ a5200,"cblast.bin",32768,0x7c988054},
{ a5200,"ccrisis.bin",32768,0xd50e4061},
{ a5200,"koffiyk.bin",32768,0x917be656},
{ a5200,"tempest (atariage).bin",32768,0xa6400e17},
{ -1,"",0,0},
} ;
+4 -3
View File
@@ -221,13 +221,14 @@ void vkbd_key(int key,int pressed){
if(SHIFTON==1)
;//keyboard_matrix[0x25 >> 4] &= ~bit_values2[0x25 & 7]; // key needs to be SHIFTed
Key_Sate[key]=1;
//keyboard_matrix[(unsigned char)key >> 4] &= ~bit_values2[(unsigned char)key & 7]; // key is being held down
}
else {
if(SHIFTON==1)
;//keyboard_matrix[0x25 >> 4] |= bit_values2[0x25 & 7]; // make sure key is unSHIFTed
Key_Sate[key]=0;
//keyboard_matrix[(unsigned char)key >> 4] |= bit_values2[(unsigned char)key & 7];
}
@@ -600,7 +601,7 @@ F12 PLAY TAPE
int Retro_PollEvent()
{
// RETRO B Y SLT STA UP DWN LEFT RGT A X L R L2 R2 L3 R3
// RETRO B Y SLT STA UP DWN LEFT RGT A X L R L2 R2 L3 R3
// INDEX 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int SAVPAS=PAS;
@@ -644,7 +645,7 @@ if(atari_devices[0]==RETRO_DEVICE_ATARI_JOYSTICK){
SHOWKEY=-SHOWKEY;
}
i=3;//type ENTER
i=3;// START
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
+21 -3
View File
@@ -16,7 +16,7 @@ int retroh=300;
unsigned atari_devices[ 2 ];
int autorun=0;
int autorun5200=0;
int RETROJOY=0,RETROPT0=0,RETROSTATUS=0,RETRODRVTYPE=0;
int retrojoy_init=0,retro_ui_finalized=0;
@@ -78,7 +78,7 @@ void retro_set_environment(retro_environment_t cb)
{
"atari800_opt1",
"Option 1; disabled|enabled" ,
"Autodetect A5200 CartType; disabled|enabled" ,
},
{
"atari800_resolution",
@@ -102,7 +102,7 @@ static void update_variables(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "enabled") == 0)
autorun = 1;
autorun5200 = 1;
}
var.key = "atari800_resolution";
@@ -438,6 +438,21 @@ lastchar=character;
*/
}
int HandleExtension(char *path,char *ext)
{
int len = strlen(path);
if (len >= 4 &&
path[len-4] == '.' &&
path[len-3] == ext[0] &&
path[len-2] == ext[1] &&
path[len-1] == ext[2])
{
return 1;
}
return 0;
}
bool retro_load_game(const struct retro_game_info *info)
{
@@ -455,6 +470,9 @@ bool retro_load_game(const struct retro_game_info *info)
update_variables();
if( HandleExtension((char*)RPATH,"a52") || HandleExtension((char*)RPATH,"A52"))
autorun5200=1;
#ifdef RENDER16B
memset(Retro_Screen,0,400*300*2);
#else
+39 -1
View File
@@ -115,7 +115,45 @@ int PLATFORM_Exit(int run_monitor)
int PLATFORM_Keyboard(void)
{
int shiftctrl = 0;
if (INPUT_key_shift)
shiftctrl ^= AKEY_SHFT;
if (Atari800_machine_type == Atari800_MACHINE_5200 && !UI_is_active) {
if (MXjoy[0]&0x40) { /* 2nd action button */
INPUT_key_shift = 1;
}
else {
INPUT_key_shift = 0;
}
if (mbt[RETRO_DEVICE_ID_JOYPAD_START])
return AKEY_5200_START ^ shiftctrl;
if (Key_Sate[RETROK_F4])
return AKEY_5200_START ^ shiftctrl;
if(Key_Sate[RETROK_p])return AKEY_5200_PAUSE ^ shiftctrl;
if(Key_Sate[RETROK_r])return AKEY_5200_RESET ^ shiftctrl;
if(Key_Sate[RETROK_0])return AKEY_5200_0 ^ shiftctrl;
if(Key_Sate[RETROK_1])return AKEY_5200_1 ^ shiftctrl;
if(Key_Sate[RETROK_2])return AKEY_5200_2 ^ shiftctrl;
if(Key_Sate[RETROK_3])return AKEY_5200_3 ^ shiftctrl;
if(Key_Sate[RETROK_4])return AKEY_5200_4 ^ shiftctrl;
if(Key_Sate[RETROK_5])return AKEY_5200_5 ^ shiftctrl;
if(Key_Sate[RETROK_6])return AKEY_5200_6 ^ shiftctrl;
if(Key_Sate[RETROK_7])return AKEY_5200_7 ^ shiftctrl;
if(Key_Sate[RETROK_8])return AKEY_5200_8 ^ shiftctrl;
if(Key_Sate[RETROK_9])return AKEY_5200_9 ^ shiftctrl;
if(Key_Sate[RETROK_HASH])return AKEY_5200_HASH ^ shiftctrl;
if(Key_Sate[RETROK_EQUALS])return AKEY_5200_HASH ^ shiftctrl;
if(Key_Sate[RETROK_ASTERISK])return AKEY_5200_ASTERISK ^ shiftctrl;
return AKEY_NONE;
}
else if (Atari800_machine_type != Atari800_MACHINE_5200 && !UI_is_active){
/* OPTION / SELECT / START keys */
INPUT_key_consol = INPUT_CONSOL_NONE;
if (Key_Sate[RETROK_F2])
@@ -153,7 +191,7 @@ int PLATFORM_Keyboard(void)
return AKEY_ESCAPE;
if (mbt[RETRO_DEVICE_ID_JOYPAD_B])
return AKEY_RETURN;
}
if (UI_is_active){
// whitout kbd in GUI
if (MXjoy[0]&0x04)
+42 -42
View File
@@ -9,29 +9,29 @@ typedef struct {
Mvk MVk[NPLGN*NLIGN*2]={
{ "ESC" ,"ESC" ,0x82 },//0
{ " 1" ," !" , 0x80 },//0
{ " 2" ," \"" ,0x81 },
{ " 3" ," #" ,0x71 },
{ " 4" ," $" ,0x70 },
{ " 5" ," %" ,0x61 },
{ " 6" ," &" ,0x60 },
{ " 7" ," \'" ,0x51 },
{ " 8" ," (" ,0x50 },
{ " 9" ," )" ,0x41 },
{ " 0" ," _" ,0x40 },
{ "ESC" ,"ESC" ,RETROK_ESCAPE },//0
{ " 1" ," !" , RETROK_1 },//0
{ " 2" ," \"" ,RETROK_2 },
{ " 3" ," #" ,RETROK_3 },
{ " 4" ," $" ,RETROK_4 },
{ " 5" ," %" ,RETROK_5 },
{ " 6" ," &" ,RETROK_6 },
{ " 7" ," \'" ,RETROK_7 },
{ " 8" ," (" ,RETROK_8 },
{ " 9" ," )" ,RETROK_9 },
{ " 0" ," _" ,RETROK_0 },
{ " ^" ,"Pnd" ,0x30 },
{ " q" ," Q" ,0x83}, //10+2
{ " w" ," W" ,0x73},
{ " e" ," E" ,0x72},
{ " r" ," R" ,0x62},
{ " r" ," R" ,RETROK_r},
{ " t" ," T" ,0x63},
{ " y" ," Y" ,0x53},
{ " u" ," U" ,0x52},
{ " i" ," I" ,0x43},
{ " o" ," O" ,0x42},
{ " p" ," P" ,0x33},
{ " p" ," P" ,RETROK_p},
{ " @" ," |" ,0x32},
{ " [" ," [" ,0x21},
@@ -69,29 +69,29 @@ Mvk MVk[NPLGN*NLIGN*2]={
{ "CTRL" ,"CTRL" ,0x27},
{ "CLR" ,"CLR" , 0x20},
{ "Spc" ,"Spc",0x57},
{ "COPY" ,"COPY" ,0x11},
{ " ." ," .",0x07},
{ "F0" ,"F0" ,0x17},
{ "= " ,"= " ,RETROK_EQUALS},
{ " *" ," *", RETROK_ASTERISK},
{ "# " ,"# " ,RETROK_HASH},
{ "Ent" ,"Ent",0x06},
{ "ESC" ,"ESC" ,0x82 },//50+10
{ " 1" ," !" , 0x80 },
{ " 2" ," \"" ,0x81 },
{ " 3" ," #" ,0x71 },
{ " 4" ," $" ,0x70 },
{ " 5" ," %" ,0x61 },
{ " 6" ," &" ,0x60 },
{ " 7" ," \'" ,0x51 },
{ " 8" ," (" ,0x50 },
{ " 9" ," )" ,0x41 },
{ " 0" ," _" ,0x40 },
{ "ESC" ,"ESC" ,RETROK_ESCAPE },//50+1°
{ " 1" ," !" , RETROK_1 },//0
{ " 2" ," \"" ,RETROK_2 },
{ " 3" ," #" ,RETROK_3 },
{ " 4" ," $" ,RETROK_4 },
{ " 5" ," %" ,RETROK_5 },
{ " 6" ," &" ,RETROK_6 },
{ " 7" ," \'" ,RETROK_7 },
{ " 8" ," (" ,RETROK_8 },
{ " 9" ," )" ,RETROK_9 },
{ " 0" ," _" ,RETROK_0 },
{ " ^" ,"Pnd" ,0x30 },
{ " F7" ," F7" ,0x12}, //60+12
{ " F8" ," F8" ,0x13},
{ " F9" ," F9" ,0x03},
{ " F0" ," F0" ,0x17},
{ " F7" ," F7" ,RETROK_F7}, //60+12
{ " F8" ," F8" ,RETROK_F8},
{ " F9" ," F9" ,RETROK_F9},
{ " F0" ," F0" ,RETROK_F10},
{ " t" ," T" ,0x63},
{ " /\\" ," /\\" ,0x00},
{ " u" ," U" ,0x52},
@@ -101,22 +101,22 @@ Mvk MVk[NPLGN*NLIGN*2]={
{ " @" ," |" ,0x32},
{ " [" ," [" ,0x21},
{ " F4" ," F4" ,0x24}, //70+14
{ " F5" ," F5" ,0x14},
{ " F6" ," F6" ,0x04},
{ " F4" ," F4" ,RETROK_F4}, //70+14
{ " F5" ," F5" ,RETROK_F5},
{ " F6" ," F6" ,RETROK_F6},
{ " ." ," ." ,0x07},
{ " <-" ," <-" ,0x10},
{ "COPY" ,"COPY" ,0x11},
{ " ->" ," ->" ,0x01},
{ " k" ," K" ,0x45},
{ " l" ," L" ,0x44},
{ " :" ," *" ,0x35},
{ " ;" ," +" ,0x34},
{ " ]" ," ]" ,0x23},
{ " r" ," R" ,RETROK_r},
{ " p" ," P" ,RETROK_p},
{ "= " ,"= " ,RETROK_EQUALS},
{ " *" ," *", RETROK_ASTERISK},
{ "# " ,"# " ,RETROK_HASH},
{ " F1" ," F1" ,0x15},//80+16
{ " F2" ," F2" ,0x16},
{ " F3" ," F3" ,0x05},
{ " F1" ," F1" ,RETROK_F1},//80+16
{ " F2" ," F2" ,RETROK_F2},
{ " F3" ," F3" ,RETROK_F3},
{ "Ent" ,"Ent" ,0x06},
{ " b" ," B" ,0x66},
{ " \\/" ," \\/" ,0x02},