Commit b1017914 authored by Chips-fr's avatar Chips-fr
Browse files

Add disk switch using L & R button

parent 92d5ae58
......@@ -4,15 +4,15 @@ PLATFLAGS :=
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
platform = win
else ifneq ($(findstring arm,$(shell uname -a)),)
PLATFLAGS += -DARM -marm
PLATFLAGS += -DARM -marm
endif
endif
......@@ -22,10 +22,10 @@ CORE_DIR := .
ROOT_DIR := .
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
LDFLAGS := -lz -lpthread
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
else ifeq ($(platform), crosspi)
TARGET := $(TARGET_NAME)_libretro.so
fpic = -fPIC
......@@ -40,7 +40,7 @@ else ifeq ($(platform), crosspi)
CXXFLAGS += $(PLATFORM_DEFINES)
CC = arm-linux-gnueabihf-gcc
CXX = arm-linux-gnueabihf-g++
LDFLAGS += -lz -lpthread
LDFLAGS += -lz -lpthread
else ifeq ($(platform), crossand)
TARGET := $(TARGET_NAME)_libretro.so
fpic = -fPIC
......@@ -48,20 +48,20 @@ else ifeq ($(platform), crossand)
PLATFORM_DEFINES += -marm -march=armv7-a -mfloat-abi=softfp -mfpu=neon
CPU_FLAGS += -marm -march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__arm__ -DARM_ASM -D__NEON_OPT
#-march=armv7-a -mfloat-abi=hard -mhard-float
#-mfpu=neon
# -mfpu=neon-vfpv4 -mfloat-abi=hard
#-march=armv7-a -mfloat-abi=hard -mhard-float
#-mfpu=neon
# -mfpu=neon-vfpv4 -mfloat-abi=hard
PLATFORM_DEFINES += -DLSB_FIRST -DALIGN_DWORD -DWITH_LOGGING
HAVE_NEON = 1
USE_PICASSO96 = 1
CFLAGS += $(PLATFORM_DEFINES)
CXXFLAGS += $(PLATFORM_DEFINES)
CC = arm-linux-androideabi-gcc
CXX =arm-linux-androideabi-g++
AR = @arm-linux-androideabi-ar
LD = @arm-linux-androideabi-g++
LDFLAGS += -lz -llog
CC = arm-linux-androideabi-gcc
CXX =arm-linux-androideabi-g++
AR = @arm-linux-androideabi-ar
LD = @arm-linux-androideabi-g++
LDFLAGS += -lz -llog
else ifeq ($(platform), rpi2)
TARGET := $(TARGET_NAME)_libretro.so
fpic = -fPIC
......@@ -76,15 +76,17 @@ else ifeq ($(platform), rpi2)
CXXFLAGS += $(PLATFORM_DEFINES)
CC = gcc
CXX = g++
LDFLAGS += -lz -lpthread
# use for raspberry pi
LDFLAGS += -lz -lpthread
# use for raspberry pi
else ifeq ($(platform), rpi)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
LDFLAGS := -lz -lpthread
PLATFLAGS += -DARM -marm
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
# SOny Ps vita
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
LDFLAGS := -lz -lpthread
PLATFLAGS += -DARM -marm
SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
# Sony Ps vita
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_libretro_vita.a
CC = arm-vita-eabi-gcc
......@@ -99,65 +101,65 @@ else ifeq ($(platform), vita)
PLATFLAGS += -DLSB_FIRST -DALIGN_DWORD
HAVE_NEON = 1
USE_PICASSO96 = 1
PLATFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int -DLSB_FIRST
PLATFLAGS += -DHAVE_STRTOUL -DVITA -DWITH_LOGGING
PLATFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int -DLSB_FIRST
PLATFLAGS += -DHAVE_STRTOUL -DVITA -DWITH_LOGGING
CFLAGS += $(PLATFLAGS)
CXXFLAGS += $(PLATFLAGS)
STATIC_LINKING = 1
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC -mmacosx-version-min=10.6
SHARED := -dynamiclib
PLATFLAGS += -DRETRO -DLSB_FIRST -DALIGN_DWORD
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC -mmacosx-version-min=10.6
SHARED := -dynamiclib
PLATFLAGS += -DRETRO -DLSB_FIRST -DALIGN_DWORD
else ifeq ($(platform), android)
CC = arm-linux-androideabi-gcc
CXX =arm-linux-androideabi-g++
AR = @arm-linux-androideabi-ar
LD = @arm-linux-androideabi-g++
TARGET := $(TARGET_NAME)_libretro_android.so
fpic := -fPIC
CC = arm-linux-androideabi-gcc
CXX =arm-linux-androideabi-g++
AR = @arm-linux-androideabi-ar
LD = @arm-linux-androideabi-g++
TARGET := $(TARGET_NAME)_libretro_android.so
fpic := -fPIC
LDFLAGS := -lz -lm -llog
SHARED := -Wl,--fix-cortex-a8 -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
PLATFLAGS += -DWITH_LOGGING -DANDROID -DRETRO -DAND -DLSB_FIRST -DALIGN_DWORD -DANDPORT -DARM_OPT_TEST=1
SHARED := -Wl,--fix-cortex-a8 -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
PLATFLAGS += -DWITH_LOGGING -DANDROID -DRETRO -DAND -DLSB_FIRST -DALIGN_DWORD -DANDPORT -DARM_OPT_TEST=1
else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ZLIB_DIR = $(LIBUTILS)/zlib/
CFLAGS += -DSDL_BYTEORDER=SDL_BIG_ENDIAN -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN -DBYTE_ORDER=BIG_ENDIAN \
TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ZLIB_DIR = $(LIBUTILS)/zlib/
CFLAGS += -DSDL_BYTEORDER=SDL_BIG_ENDIAN -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN -DBYTE_ORDER=BIG_ENDIAN \
-DWIIPORT=1 -DHAVE_MEMALIGN -DHAVE_ASPRINTF -I$(ZLIB_DIR) -I$(DEVKITPRO)/libogc/include \
-D__powerpc__ -D__POWERPC__ -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -D__ppc__
LDFLAGS := -lm -lpthread -lc
PLATFLAGS += -DRETRO -DALIGN_DWORD -DWIIPORT
LDFLAGS := -lm -lpthread -lc
PLATFLAGS += -DRETRO -DALIGN_DWORD -DWIIPORT
else ifeq ($(platform), ps3)
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
ZLIB_DIR = $(LIBUTILS)/zlib/
LDFLAGS := -lm -lpthread -lc
CFLAGS += -DSDL_BYTEORDER=SDL_BIG_ENDIAN -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN -DBYTE_ORDER=BIG_ENDIAN \
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
ZLIB_DIR = $(LIBUTILS)/zlib/
LDFLAGS := -lm -lpthread -lc
CFLAGS += -DSDL_BYTEORDER=SDL_BIG_ENDIAN -DMSB_FIRST -DBYTE_ORDER=BIG_ENDIAN -DBYTE_ORDER=BIG_ENDIAN \
-D__CELLOS_LV2 -DPS3PORT=1 -DHAVE_MEMALIGN -DHAVE_ASPRINTF -I$(ZLIB_DIR)
PLATFLAGS += -DRETRO -DALIGN_DWORD
PLATFLAGS += -DRETRO -DALIGN_DWORD
else
ifeq ($(subplatform), 32)
CC = i586-mingw32msvc-gcc
CC = i586-mingw32msvc-gcc
else
CC = x86_64-w64-mingw32-gcc
CFLAGS += -fno-aggressive-loop-optimizations
CC = x86_64-w64-mingw32-gcc
CFLAGS += -fno-aggressive-loop-optimizations
endif
PLATFLAGS += -DRETRO -DLSB_FIRST -DALIGN_DWORD -DWIN32PORT -DWIN32
TARGET := $(TARGET_NAME)_libretro.dll
fpic := -fPIC
SHARED := -shared -static-libgcc -s -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
PLATFLAGS += -DRETRO -DLSB_FIRST -DALIGN_DWORD -DWIN32PORT -DWIN32
TARGET := $(TARGET_NAME)_libretro.dll
fpic := -fPIC
SHARED := -shared -static-libgcc -s -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
LDFLAGS := -lm -lz
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
CFLAGS += -O0 -g
else
CFLAGS += -O3 -fomit-frame-pointer -finline -fno-builtin
CFLAGS += -O3 -fomit-frame-pointer -finline -fno-builtin
endif
DEFINES +=
......
......@@ -10,6 +10,8 @@ Basic port. Based on rtype version.
|A|Fire button 2 / Blue|
|L2|Left mouse button|
|R2|Right mouse button|
|L|Switch to previous disk|
|R|Switch to next disk|
|Select|Toggle virtual keyboard|
|Start|Toggle mouse emulation|
......@@ -17,4 +19,6 @@ Right analog stick controls the mouse.
In mouse emulation dpad and fire buttons controls the mouse.
Two joysticks support. Switch automatically between mouse or second joystick when a mouse or joystick button is pressed.
\ No newline at end of file
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
......@@ -438,17 +438,17 @@ void Process_key()
In joy mode
L3 GUI LOAD
R3 GUI SNAP
L2 STATUS ON/OFF
R2 AUTOLOAD TAPE
L CAT
R RESET
L2 LEFT MOUSE BUTTON
R2 RIGHT MOUSE BUTTON
L PREVIOUS DISK
R NEXT DISK
SEL MOUSE/JOY IN GUI
STR ENTER/RETURN
STR
A FIRE1/VKBD KEY
B RUN
X FIRE2
Y VKBD ON/OFF
In Keayboard mode
B FIRE2
In Keyboard mode
F8 LOAD DSK/TAPE
F9 MEM SNAPSHOT LOAD/SAVE
F10 MAIN GUI
......@@ -456,6 +456,7 @@ F12 PLAY TAPE
*/
extern int lastmx, lastmy, newmousecounters;
extern int buttonstate[3];
extern void changedisk( bool );
int Retro_PollEvent()
{
......@@ -477,8 +478,8 @@ int Retro_PollEvent()
if(SHOWKEY==-1 && pauseg==0)Process_key();
if(pauseg==0)
{ // if emulation running
if(pauseg==0)
{ // if emulation running
// Joy mode for first/main joystick.
for(i=RETRO_DEVICE_ID_JOYPAD_B;i<=RETRO_DEVICE_ID_JOYPAD_A;i++)
......@@ -503,12 +504,11 @@ int Retro_PollEvent()
second_joystick_enable = 1;
}
}
}// if pauseg=0
else{
// if in gui
}
}// if pauseg=0
else
{
// if in gui
}
i=RETRO_DEVICE_ID_JOYPAD_SELECT; //show vkbd toggle
......@@ -536,14 +536,32 @@ else{
}
i=RETRO_DEVICE_ID_JOYPAD_L; //select previous disk
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) )
{
mbt[i]=0;
changedisk((bool) false);
}
i=RETRO_DEVICE_ID_JOYPAD_R; //select next disk
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) )
{
mbt[i]=0;
changedisk((bool) true);
}
if(MOUSE_EMULATED==1){
if(slowdown>0 && pauseg!=0 )return 1;
if(slowdown>0 && pauseg!=0 )return 1;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))rmouse_x += PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))rmouse_x -= PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))rmouse_y += PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))rmouse_y -= PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT ))rmouse_x -= PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN ))rmouse_y += PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP ))rmouse_y -= PAS;
mouse_l=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
mouse_r=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
......@@ -553,11 +571,11 @@ else{
mouse_wu = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELUP);
mouse_wd = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN);
//if(mouse_wu || mouse_wd)printf("-----------------MOUSE UP:%d DOWN:%d\n",mouse_wu, mouse_wd);
//if(mouse_wu || mouse_wd)printf("-----------------MOUSE UP:%d DOWN:%d\n",mouse_wu, mouse_wd);
rmouse_x = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
rmouse_y = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
mouse_l = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
mouse_r = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
mouse_l = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
mouse_r = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
}
......
......@@ -301,7 +301,7 @@ void retro_get_system_info(struct retro_system_info *info)
info->library_version = "0.2";
info->valid_extensions = "adf|dms|zip|ipf|hdf|lha|uae";
info->need_fullpath = true;
info->block_extract = false;
info->block_extract = true;
}
void retro_get_system_av_info(struct retro_system_av_info *info)
......
......@@ -223,6 +223,8 @@ void unlockscr (void)
#include "joystick.h"
extern int Retro_PollEvent();
#define getjoystate(NR,DIR,BUT) read_joystick(NR,DIR,BUT)
extern DISK_GUI_change (void);
void flush_screen ()
{
//SDL_UnlockSurface (prSDLScreen);
......@@ -232,6 +234,7 @@ void flush_screen ()
inputmode_redraw();
}
DISK_GUI_change();
if (savestate_state == STATE_DOSAVE)
{
......
......@@ -10,6 +10,10 @@
* High Density Drive Handling by Dr. Adil Temel (C) 2001 [atemel1@hotmail.com]
*
*/
#include <string>
#include <list>
#include <stdio.h>
#include <sstream>
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -32,8 +36,14 @@
#include "crc32.h"
#include "inputdevice.h"
#ifdef __LIBRETRO__
#include "graph.h"
#include "libretro-core.h"
#endif
static int longwritemode = 0;
/* support HD floppies */
#define FLOPPY_DRIVE_HD
/* writable track length with normal 2us bitcell/300RPM motor, 12667 PAL, 12797 NTSC */
......@@ -1854,6 +1864,39 @@ void disk_insert (int num, const char *name)
disk_insert_2 (num, name, 0);
}
void DISK_GUI_change (void)
{
#ifdef __LIBRETRO__
int idx = 0;
if (floppy[idx].dskchange_time)
{
int i = strlen (currprefs.df[idx]) - 1;
while (i > 0)
{
if (currprefs.df[idx][i] == '/' || currprefs.df[idx][i] == '\\')
{
i++;
break;
}
i--;
}
Draw_text((char*)Retro_Screen,20 , 20 ,RGB565(28, 28, 31), 0xFF808080 ,1, 1,10,"Switch to:");
if (currprefs.gfx_size.width > 320)
Draw_text((char*)Retro_Screen,20 , 30 ,RGB565(28, 28, 31), 0xFF808080 ,1, 1,100,(currprefs.df[idx]) + i);
else
{
Draw_text((char*)Retro_Screen,20 , 30 ,RGB565(28, 28, 31), 0xFF808080 ,1, 1,40,(currprefs.df[idx]) + i);
if (strlen (currprefs.df[idx]) > 40)
Draw_text((char*)Retro_Screen,20 , 40 ,RGB565(28, 28, 31), 0xFF808080 ,1, 1,40,(currprefs.df[idx]) + i + 40);
}
}
#endif
}
void DISK_check_change (void)
{
int i;
......@@ -2820,3 +2863,63 @@ uae_u8 *save_floppy(int *len, uae_u8 *dstptr)
}
#endif /* SAVESTATE */
void changedisk(bool plus)
{
std::string fname=changed_prefs.df[0];
int lfname =fname.length();
std::string constdisk="(Disk ";
std::string constdiskof=" of ";
std::size_t finiziodisk = fname.find(constdisk);
if (finiziodisk==std::string::npos)return;
std::size_t finiziodiskof = fname.find(constdiskof,finiziodisk);
if (finiziodiskof==std::string::npos)return;
std::size_t ffinedisk = fname.find_last_of(")")+1;
if (ffinedisk==std::string::npos)return;
std::string strndisk=fname.substr(finiziodisk+constdisk.length(),finiziodiskof-finiziodisk-constdisk.length());
std::string strntotdisk=fname.substr(finiziodiskof+constdiskof.length(),ffinedisk-finiziodiskof-constdiskof.length()-1);
std::string fnamenodsk=fname.substr(0,finiziodisk);
std::string strdisk = fname.substr(finiziodisk,ffinedisk-finiziodisk);
std::string ext = fname.substr(ffinedisk,fname.length()-ffinedisk);
int newdisk=0;
int totdisk= atoi(strntotdisk.c_str());
if (plus)
{
// Swap with disk index superior
newdisk= atoi(strndisk.c_str());
newdisk=newdisk+1;
if (newdisk>totdisk)
{
newdisk=1;
}
}
else
{
// Swap with disk index inferior
newdisk= atoi(strndisk.c_str());
newdisk=newdisk-1;
if (newdisk<1)
{
newdisk=totdisk;
}
}
std::string strnewdisk;
std::stringstream convert; // stream used for the conversion
convert << newdisk; // insert the textual representation of 'Number' in the characters in the stream
strnewdisk = convert.str();
std::string strtotdisk;
std::stringstream converttot;
converttot << totdisk; // insert the textual representation of 'Number' in the characters in the stream
strtotdisk = converttot.str();
std::string strnefile = fnamenodsk + constdisk + strnewdisk + constdiskof + strtotdisk + ")" + ext;
if ( access( strnefile.c_str(), F_OK ) != -1 )
{
disk_insert(0, strnefile.c_str());
LOGI("Insert disk: %s.\n",strnefile.c_str());
}
else
LOGI("Disk %s not found !.\n",strnefile.c_str());
}
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