Merge pull request #7 from dinkc64/barbudreadmon/libretro-updates

libretro backport & cleanup
This commit is contained in:
dinkc64 2019-05-05 08:26:47 -04:00 committed by GitHub
commit bef63c4e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 47 additions and 3435 deletions

View File

@ -1,391 +0,0 @@
DEBUG = 0
LIBRETRO_OPTIMIZATIONS = 1
FRONTEND_SUPPORTS_RGB565 = 1
HAVE_GRIFFIN = 0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
endif
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
system_platform = win
EXE_EXT=.exe
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
MAIN_FBA_DIR := src
FBA_BURN_DIR := $(MAIN_FBA_DIR)/burn
FBA_BURN_DRIVERS_DIR := $(MAIN_FBA_DIR)/burn/drv
FBA_BURNER_DIR := $(MAIN_FBA_DIR)/burner
LIBRETRO_DIR := $(FBA_BURNER_DIR)/libretro
FBA_CPU_DIR := $(MAIN_FBA_DIR)/cpu
FBA_LIB_DIR := $(MAIN_FBA_DIR)/dep/libs
FBA_INTERFACE_DIR := $(MAIN_FBA_DIR)/intf
FBA_GENERATED_DIR = $(MAIN_FBA_DIR)/dep/generated
FBA_SCRIPTS_DIR = $(MAIN_FBA_DIR)/dep/scripts
GRIFFIN_DIR = griffin-libretro
EXTERNAL_ZLIB = 0
ifeq ($(platform), unix)
TARGET := libretro.so
fpic := -fPIC
SHARED := -shared -Wl,-no-undefined -Wl,--version-script=$(LIBRETRO_DIR)/link.T
ENDIANNESS_DEFINES := -DLSB_FIRST
else ifeq ($(platform), osx)
TARGET := libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
ENDIANNESS_DEFINES := -DLSB_FIRST
else ifeq ($(platform), ps3)
TARGET := libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES += -D__CELLOS_LV2__
EXTERNAL_ZLIB = 1
else ifeq ($(platform), sncps3)
TARGET := libretro_ps3.a
CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES += -D__CELLOS_LV2__ -DSN_TARGET_PS3
EXTERNAL_ZLIB = 1
else ifeq ($(platform), psl1ght)
TARGET := libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES += -D__CELLOS_LV2__
EXTERNAL_ZLIB = 1
else ifeq ($(platform), xenon)
TARGET := libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
CXX = xenon-g++$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES := -D__LIBXENON__ -m32 -D__ppc__
else ifeq ($(platform), ngc)
TARGET := libretro_ngc.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
EXTERNAL_ZLIB = 1
else ifeq ($(platform), wii)
TARGET := libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES = -DWORDS_BIGENDIAN
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
EXTERNAL_ZLIB = 1
else
TARGET := retro.dll
CC = gcc
CXX = g++
SHARED := -shared -Wl,-no-undefined -Wl,--version-script=$(LIBRETRO_DIR)/link.T
LDFLAGS += -static-libgcc -static-libstdc++
ENDIANNESS_DEFINES := -DLSB_FIRST
endif
CC_SYSTEM = gcc
CXX_SYSTEM = g++
.PHONY: clean generate-files generate-files-clean clean-objs
all: $(TARGET)
BURN_BLACKLIST := $(FBA_BURNER_DIR)/un7z.cpp \
$(FBA_CPU_DIR)/arm7/arm7exec.c \
$(FBA_CPU_DIR)/arm7/arm7core.c \
$(FBA_CPU_DIR)/hd6309/6309tbl.c \
$(FBA_CPU_DIR)/hd6309/6309ops.c \
$(FBA_CPU_DIR)/konami/konamtbl.c \
$(FBA_CPU_DIR)/konami/konamops.c \
$(FBA_CPU_DIR)/m68k/m68k_in.c \
$(FBA_CPU_DIR)/m6800/6800ops.c \
$(FBA_CPU_DIR)/m6800/6800tbl.c \
$(FBA_CPU_DIR)/m6805/6805ops.c \
$(FBA_CPU_DIR)/m6809/6809ops.c \
$(FBA_CPU_DIR)/m6809/6809tbl.c \
$(FBA_CPU_DIR)/sh2/mksh2.cpp \
$(FBA_CPU_DIR)/sh2/mksh2-x86.cpp \
$(FBA_CPU_DIR)/m68k/m68kmake.c \
$(FBA_BURNER_DIR)/wave_writer.cpp \
$(FBA_CPU_DIR)/m68k/m68kdasm.c \
$(FBA_LIBRETRO_DIR)/menu.cpp \
$(FBA_CPU_DIR)/sh2/mksh2.cpp \
$(FBA_BURNER_DIR)/sshot.cpp \
$(FBA_BURNER_DIR)/conc.cpp \
$(FBA_BURNER_DIR)/dat.cpp \
$(FBA_BURNER_DIR)/cong.cpp \
$(FBA_BURNER_DIR)/image.cpp \
$(FBA_BURNER_DIR)/misc.cpp \
$(FBA_CPU_DIR)/h6280/tblh6280.c \
$(FBA_CPU_DIR)/m6502/t65sc02.c \
$(FBA_CPU_DIR)/m6502/t65c02.c \
$(FBA_CPU_DIR)/m6502/tdeco16.c \
$(FBA_CPU_DIR)/m6502/tn2a03.c \
$(FBA_CPU_DIR)/m6502/t6502.c \
$(FBA_CPU_DIR)/nec/v25sfr.c \
$(FBA_CPU_DIR)/nec/v25instr.c \
$(FBA_CPU_DIR)/nec/necinstr.c \
$(FBA_BURN_DIR)/drv/capcom/ctv_make.cpp
#ifeq ($(LIBRETRO_OPTIMIZATIONS), 1)
#BURN_BLACKLIST += $(FBA_BURN_DIR)/drv/capcom/ctv.cpp
#endif
ifeq ($(EXTERNAL_ZLIB), 1)
BURN_BLACKLIST += $(FBA_BURNER_DIR)/unzip.c \
$(FBA_BURNER_DIR)/ioapi.c
endif
ifeq ($(HAVE_GRIFFIN), 1)
GRIFFIN_CXXSRCFILES := $(GRIFFIN_DIR)/cps12.cpp $(GRIFFIN_DIR)/cps3.cpp $(GRIFFIN_DIR)/neogeo.cpp $(GRIFFIN_DIR)/pgm.cpp $(GRIFFIN_DIR)/snes.cpp $(GRIFFIN_DIR)/galaxian.cpp $(GRIFFIN_DIR)/cpu-m68k.cpp
BURN_BLACKLIST += $(FBA_CPU_DIR)/m68000_intf.cpp
else
CPS2_DIR := $(FBA_BURN_DRIVERS_DIR)/capcom
CPS3_DIR := $(FBA_BURN_DRIVERS_DIR)/cps3
GALAXIAN_DIR := $(FBA_BURN_DRIVERS_DIR)/galaxian
NEOGEO_DIR := $(FBA_BURN_DRIVERS_DIR)/neogeo
PGM_DIR := $(FBA_BURN_DRIVERS_DIR)/pgm
SNES_DIR := $(FBA_BURN_DRIVERS_DIR)/snes
M68K_DIR := $(FBA_CPU_DIR)/m68k
endif
FBA_BURN_DIRS := $(FBA_BURN_DIR) \
$(FBA_BURN_DIR)/devices \
$(FBA_BURN_DIR)/snd \
$(CPS2_DIR) \
$(FBA_BURN_DRIVERS_DIR)/cave \
$(CPS3_DIR) \
$(FBA_BURN_DRIVERS_DIR)/dataeast \
$(GALAXIAN_DIR) \
$(FBA_BURN_DRIVERS_DIR)/irem \
$(FBA_BURN_DRIVERS_DIR)/konami \
$(FBA_BURN_DRIVERS_DIR)/megadrive \
$(NEOGEO_DIR) \
$(FBA_BURN_DRIVERS_DIR)/pce \
$(PGM_DIR) \
$(FBA_BURN_DRIVERS_DIR)/pre90s \
$(FBA_BURN_DRIVERS_DIR)/psikyo \
$(FBA_BURN_DRIVERS_DIR)/pst90s \
$(FBA_BURN_DRIVERS_DIR)/sega \
$(SNES_DIR) \
$(FBA_BURN_DRIVERS_DIR)/taito \
$(FBA_BURN_DRIVERS_DIR)/toaplan
FBA_CPU_DIRS := $(FBA_CPU_DIR) \
$(FBA_CPU_DIR)/arm \
$(FBA_CPU_DIR)/arm7 \
$(FBA_CPU_DIR)/h6280 \
$(FBA_CPU_DIR)/hd6309 \
$(FBA_CPU_DIR)/i8039 \
$(FBA_CPU_DIR)/konami \
$(M68K_DIR) \
$(FBA_CPU_DIR)/m6502 \
$(FBA_CPU_DIR)/m6800 \
$(FBA_CPU_DIR)/m6805 \
$(FBA_CPU_DIR)/m6809 \
$(FBA_CPU_DIR)/nec \
$(FBA_CPU_DIR)/s2650 \
$(FBA_CPU_DIR)/sh2 \
$(FBA_CPU_DIR)/z80
FBA_LIB_DIRS := $(FBA_LIB_DIR)/zlib
FBA_SRC_DIRS := $(FBA_BURNER_DIR) $(FBA_BURN_DIRS) $(FBA_CPU_DIRS) $(FBA_BURNER_DIRS)
ifeq ($(EXTERNAL_ZLIB), 1)
FBA_DEFINES += -DEXTERNAL_ZLIB
else
FBA_SRC_DIRS += $(FBA_LIB_DIRS)
endif
FBA_CXXSRCS := $(GRIFFIN_CXXSRCFILES) $(filter-out $(BURN_BLACKLIST),$(foreach dir,$(FBA_SRC_DIRS),$(wildcard $(dir)/*.cpp)))
FBA_CXXSRCS += $(LIBRETRO_DIR)/libretro.cpp $(LIBRETRO_DIR)/neocdlist.cpp
FBA_CXXOBJ := $(FBA_CXXSRCS:.cpp=.o)
FBA_CSRCS := $(filter-out $(BURN_BLACKLIST),$(foreach dir,$(FBA_SRC_DIRS),$(wildcard $(dir)/*.c)))
FBA_COBJ := $(FBA_CSRCS:.c=.o)
OBJS := $(FBA_COBJ) $(FBA_CXXOBJ)
FBA_DEFINES := -DUSE_SPEEDHACKS -D__LIBRETRO__ \
-D__LIBRETRO_OPTIMIZATIONS__ \
$(ENDIANNESS_DEFINES) \
$(PLATFORM_DEFINES) \
-DINLINE="static inline" \
-DSH2_INLINE="static inline"
INCDIRS := -I$(FBA_BURNER_DIR)/win32 \
-I$(LIBRETRO_DIR) \
-I$(LIBRETRO_DIR)/tchar \
-I$(FBA_BURN_DIR) \
-I$(MAIN_FBA_DIR)/cpu \
-I$(FBA_BURN_DIR)/snd \
-I$(FBA_BURN_DIR)/devices \
-I$(FBA_INTERFACE_DIR) \
-I$(FBA_INTERFACE_DIR)/input \
-I$(FBA_INTERFACE_DIR)/cd \
-I$(FBA_BURNER_DIR) \
-I$(FBA_CPU_DIR) \
-I$(FBA_CPU_DIR)/i8039 \
-I$(FBA_LIB_DIR)/zlib \
-I$(FBA_BURN_DIR)/drv/capcom \
-I$(FBA_BURN_DIR)/drv/dataeast \
-I$(FBA_BURN_DIR)/drv/cave \
-I$(FBA_BURN_DIR)/drv/neogeo \
-I$(FBA_BURN_DIR)/drv/psikyo \
-I$(FBA_BURN_DIR)/drv/sega \
-I$(FBA_BURN_DIR)/drv/toaplan \
-I$(FBA_BURN_DIR)/drv/taito \
-I$(FBA_GENERATED_DIR) \
-I$(FBA_LIB_DIR)
ifeq ($(LIBRETRO_OPTIMIZATIONS), 1)
FBA_DEFINES += -D__LIBRETRO_OPTIMIZATIONS__
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
else
CFLAGS += -O3 -DNDEBUG
CXXFLAGS += -O3 -DNDEBUG
endif
ifeq ($(platform), sncps3)
WARNINGS_DEFINES =
else
WARNINGS_DEFINES = -Wno-write-strings
C_STD_DEFINES = -std=gnu99
endif
CFLAGS += $(C_STD_DEFINES) $(fpic) $(WARNINGS_DEFINES) $(FBA_DEFINES)
CXXFLAGS += $(fpic) $(WARNINGS_DEFINES) $(FBA_DEFINES)
LDFLAGS += $(fpic)
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
CFLAGS += -DFRONTEND_SUPPORTS_RGB565
CXXFLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
ifeq ($(ZLIB_INTERNAL), 0)
INCDIRS += -I$(FBA_LIB_DIR)
endif
ifeq ($(LIBRETRO_OPTIMIZATIONS), 1)
GENERATE_OPTS := -D__LIBRETRO_OPTIMIZATIONS__
else
GENERATE_OPTS :=
endif
PERL = perl$(EXE_EXT)
M68KMAKE_EXE = m68kmake$(EXE_EXT)
CTVMAKE_EXE = ctvmake$(EXE_EXT)
PGM_SPRITE_CREATE_EXE = pgmspritecreate$(EXE_EXT)
EXE_PREFIX = ./
generate-files-clean:
rm -rf $(FBA_GENERATED_DIR)/
rm -rf $(FBA_CPU_DIR)/m68k/m68kopac.c
rm -rf $(FBA_CPU_DIR)/m68k/m68kopdm.c
rm -rf $(FBA_CPU_DIR)/m68k/m68kopnz.c
rm -rf $(FBA_CPU_DIR)/m68k/m68kops.c
rm -rf $(FBA_CPU_DIR)/m68k/m68kops.h
generate-files:
@mkdir -p $(FBA_GENERATED_DIR) 2>/dev/null || /bin/true
@echo "Generating $(FBA_GENERATED_DIR)/driverlist.h..."
@echo ""
$(PERL) $(FBA_SCRIPTS_DIR)/gamelist.pl -o $(FBA_GENERATED_DIR)/driverlist.h -l gamelist.txt $(FBA_BURN_DRIVERS_DIR)/capcom $(FBA_BURN_DRIVERS_DIR)/cave $(FBA_BURN_DRIVERS_DIR)/cps3 $(FBA_BURN_DRIVERS_DIR)/dataeast $(FBA_BURN_DRIVERS_DIR)/galaxian $(FBA_BURN_DRIVERS_DIR)/irem $(FBA_BURN_DRIVERS_DIR)/konami $(FBA_BURN_DRIVERS_DIR)/megadrive $(FBA_BURN_DRIVERS_DIR)/neogeo $(FBA_BURN_DRIVERS_DIR)/pce $(FBA_BURN_DRIVERS_DIR)/pgm $(FBA_BURN_DRIVERS_DIR)/pre90s $(FBA_BURN_DRIVERS_DIR)/psikyo $(FBA_BURN_DRIVERS_DIR)/pst90s $(FBA_BURN_DRIVERS_DIR)/sega $(FBA_BURN_DRIVERS_DIR)/snes $(FBA_BURN_DRIVERS_DIR)/taito $(FBA_BURN_DRIVERS_DIR)/toaplan
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/neo_sprite_func.h..."
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/neo_sprite_func_table.h..."
@echo ""
$(PERL) $(FBA_SCRIPTS_DIR)/neo_sprite_func.pl -o $(FBA_GENERATED_DIR)/neo_sprite_func.h $(LIBRETRO_OPTIMIZATIONS)
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/psikyo_tile_func.h..."
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/psikyo_tile_func_table.h..."
@echo ""
$(PERL) $(FBA_SCRIPTS_DIR)/psikyo_tile_func.pl -o $(FBA_GENERATED_DIR)/psikyo_tile_func.h
@echo "Generating $(FBA_GENERATED_DIR)/cave_sprite_func.h..."
@echo ""
@echo "Generating[ $(FBA_GENERATED_DIR)/cave_tile_func_table.h"
@echo ""
$(PERL) $(FBA_SCRIPTS_DIR)/cave_sprite_func.pl -o $(FBA_GENERATED_DIR)/cave_sprite_func.h
$(PERL) $(FBA_SCRIPTS_DIR)/cave_tile_func.pl -o $(FBA_GENERATED_DIR)/cave_tile_func.h
@echo ""
@echo "Generate $(FBA_GENERATED_DIR)/toa_gp9001_func_table.h"
@echo ""
$(PERL) $(FBA_SCRIPTS_DIR)/toa_gp9001_func.pl -o $(FBA_GENERATED_DIR)/toa_gp9001_func.h
$(CXX_SYSTEM) $(GENERATE_OPTS) -o $(PGM_SPRITE_CREATE_EXE) $(FBA_BURN_DRIVERS_DIR)/pgm/pgm_sprite_create.cpp
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/pgm_sprite.h..."
@echo ""
$(EXE_PREFIX)$(PGM_SPRITE_CREATE_EXE) > $(FBA_GENERATED_DIR)/pgm_sprite.h
$(CC_SYSTEM) $(GENERATE_OPTS) -o $(M68KMAKE_EXE) $(FBA_CPU_DIR)/m68k/m68kmake.c
$(EXE_PREFIX)$(M68KMAKE_EXE) $(FBA_CPU_DIR)/m68k/ $(FBA_CPU_DIR)/m68k/m68k_in.c
$(CXX_SYSTEM) $(GENERATE_OPTS) -o $(CTVMAKE_EXE) $(FBA_BURN_DRIVERS_DIR)/capcom/ctv_make.cpp
@echo ""
@echo "Generating $(FBA_GENERATED_DIR)/ctv.h..."
@echo ""
$(EXE_PREFIX)$(CTVMAKE_EXE) > $(FBA_GENERATED_DIR)/ctv.h
$(TARGET): $(OBJS)
@echo "LD $@"
ifeq ($(platform), ps3)
@$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), sncps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), psl1ght)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), xenon)
@$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), ngc)
@$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), wii)
@$(AR) rcs $@ $(OBJS)
else
@$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS)
endif
%.o: %.cpp
@echo "CXX $<"
@$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
%.o: %.c
@echo "CC $<"
@$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
clean-objs:
rm -f $(OBJS)
clean:
rm -f $(TARGET)
rm -f $(OBJS)
rm -f $(M68KMAKE_EXE)
rm -f $(PGM_SPRITE_CREATE_EXE)
rm -f $(CTVMAKE_EXE)

View File

@ -10,15 +10,7 @@
#include <string.h>
#include <assert.h>
#if defined(__LIBRETRO__) && defined(_MSC_VER)
#include <tchar.h>
#else
#include "tchar.h"
#endif
#ifdef __LIBRETRO__
#include "burn_libretro_opts.h"
#endif
#include "burn.h"
#include "burn_sound.h"

View File

@ -6,7 +6,6 @@
#include "mips3_intf.h"
#include "ide.h"
#include "dcs2k.h"
#include <stdio.h>
#define IDE_IRQ 1
#define VBLANK_IRQ 0

View File

@ -339,12 +339,11 @@ unsigned ide_disk::read_alternate(unsigned offset)
return 0;
}
bool ide_disk::load_disk_image(const string &filename)
bool ide_disk::load_disk_image(const char *filename)
{
char szFilePath[MAX_PATH];
const char *szFileName = filename.c_str();
sprintf(szFilePath, "%s%s", _TtoA(szAppHDDPath), szFileName);
sprintf(szFilePath, "%s%s", _TtoA(szAppHDDPath), filename);
m_disk_image = fopen(szFilePath, "r+b");
if (!m_disk_image) {

View File

@ -1,7 +1,6 @@
#ifndef IDE
#define IDE
#include <string>
#include "burnint.h"
namespace ide
@ -17,7 +16,7 @@ public:
void write_alternate(unsigned offset, unsigned value);
unsigned read(unsigned offset);
unsigned read_alternate(unsigned offset);
bool load_disk_image(const string &filename);
bool load_disk_image(const char *filename);
void close_disk_image();
int load_hdd_image(int idx);
ide_disk();

View File

@ -549,9 +549,9 @@ static INT32 DrvFrame()
BurnGunMakeInputs(1, DrvGun2, DrvGun3);
DrvAnalog[0] = scale_gun(BurnGunReturnX(0) * 404 / 255, -0.146) + 0x29;
DrvAnalog[1] = scale_gun(BurnGunReturnY(0), -0.062) + 4 + (log(0x100 - BurnGunReturnY(0)) + 0.7);
DrvAnalog[1] = scale_gun(BurnGunReturnY(0), -0.062) + 4 + (log((double)(0x100 - BurnGunReturnY(0))) + 0.7);
DrvAnalog[2] = scale_gun(BurnGunReturnX(1) * 404 / 255, -0.146) + 0x29;
DrvAnalog[3] = scale_gun(BurnGunReturnY(1), -0.062) + 4 + (log(0x100 - BurnGunReturnY(1)) + 0.7);
DrvAnalog[3] = scale_gun(BurnGunReturnY(1), -0.062) + 4 + (log((double)(0x100 - BurnGunReturnY(1))) + 0.7);
}
INT32 nInterleave = 256;

View File

@ -1,60 +0,0 @@
#ifndef _FBA_ENDIAN_H
#define _FBA_ENDIAN_H
#ifndef _XBOX
#define NO_64BIT_BYTESWAP
#endif
typedef union {
struct { UINT8 h3,h2,h,l; } b;
struct { UINT16 h,l; } w;
UINT32 d;
} PAIR;
/* Only Xbox 360 so far seems to have byteswap 64-bit intrinsic */
#ifdef NO_64BIT_BYTESWAP
typedef union {
UINT64 ll;
struct { UINT32 l, h; } l;
} BYTESWAP_INT64;
#endif
/* Libogc doesn't have intrinsics or ASM macros defined for this */
#if defined(HW_RVL) || defined(GEKKO)
#define __sthbrx(base,index,value) \
__asm__ volatile ("sthbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
#define __stwbrx(base,index,value) \
__asm__ volatile ("stwbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
#endif
/* Xbox 360 */
#if defined(_XBOX)
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) (_byteswap_ushort(x))
#define BURN_ENDIAN_SWAP_INT32(x) (_byteswap_ulong(x))
#define BURN_ENDIAN_SWAP_INT64(x) (_byteswap_uint64(x))
/* PlayStation3 */
#elif defined(__CELLOS_LV2__)
#include <ppu_intrinsics.h>
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) ({uint16_t t; __sthbrx(&t, x); t;})
#define BURN_ENDIAN_SWAP_INT32(x) ({uint32_t t; __stwbrx(&t, x); t;})
/* Wii */
#elif defined(HW_RVL)
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) ({uint16_t t; __sthbrx(&t, 0, x); t;})
#define BURN_ENDIAN_SWAP_INT32(x) ({uint32_t t; __stwbrx(&t, 0, x); t;})
#endif
#ifdef NO_64BIT_BYTESWAP
static inline UINT64 BURN_ENDIAN_SWAP_INT64(UINT64 x)
{
BYTESWAP_INT64 r = {0};
r.l.l = BURN_ENDIAN_SWAP_INT32(x);
r.l.h = BURN_ENDIAN_SWAP_INT32(x >> 32);
return r.ll;
}
#endif
#endif

View File

@ -1,17 +0,0 @@
#ifndef _LIBRETRO_OPTIMIZATIONS_H_
#define _LIBRETRO_OPTIMIZATIONS_H_
#define BurnHighCol LIBRETRO_COLOR_CONVERT
#define BurnHighColSwitch LIBRETRO_COLOR_CONVERT_SWITCH
#ifdef FRONTEND_SUPPORTS_RGB565
#define LIBRETRO_COLOR_15BPP_XBGR(color, unused) (((color & 0x001f) << 11) | ((color & 0x03e0) << 1) | ((color & 0x7c00) >> 10))
#define LIBRETRO_COLOR_CONVERT(r, g, b, a) (((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((b >> 3) & 0x001f))
#define LIBRETRO_COLOR_CONVERT_SWITCH(r, g, b, a) (nBurnBpp == 2) ? (((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((b >> 3) & 0x001f)) : (((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | ((b) & 0x0000ff))
#else
#define LIBRETRO_COLOR_15BPP_XBGR(color, unused) ((((color & 0x1f) << 10) | (((color & 0x3e0) >> 5) << 5) | (((color & 0x7c00) >> 10))) & 0x7fff)
#define LIBRETRO_COLOR_CONVERT(r, g, b, a) (((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) & 0x001f))
#define LIBRETRO_COLOR_CONVERT_SWITCH(r, g, b, a) (nBurnBpp == 2) ? (((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) & 0x001f)) : (((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | ((b) & 0x0000ff))
#endif
#endif

View File

@ -1,18 +0,0 @@
#ifndef _BURNER_LIBRETRO_H
#define _BURNER_LIBRETRO_H
#include "gameinp.h"
#include "input/inp_keys.h"
extern int bDrvOkay;
extern int bRunPause;
extern bool bAlwaysProcessKeyboardInput;
#ifdef _MSC_VER
#define snprintf _snprintf
#define ANSIToTCHAR(str, foo, bar) (str)
#endif
extern void InpDIPSWResetDIPs (void);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,577 +0,0 @@
#ifndef LIBRETRO_H__
#define LIBRETRO_H__
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
// Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant.
#ifdef __cplusplus
extern "C" {
#else
#if defined(_MSC_VER) && !defined(SN_TARGET_PS3) && !defined(__cplusplus)
#define bool unsigned char
#define true 1
#define false 0
#else
#include <stdbool.h>
#endif
#endif
// Used for checking API/ABI mismatches that can break libretro implementations.
// It is not incremented for compatible changes.
#define RETRO_API_VERSION 1
// Libretro's fundamental device abstractions.
#define RETRO_DEVICE_MASK 0xff
#define RETRO_DEVICE_NONE 0
// The JOYPAD is called RetroPad. It is essentially a Super Nintendo controller,
// but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock.
#define RETRO_DEVICE_JOYPAD 1
// The mouse is a simple mouse, similar to Super Nintendo's mouse.
// X and Y coordinates are reported relatively to last poll (poll callback).
// It is up to the libretro implementation to keep track of where the mouse pointer is supposed to be on the screen.
// The frontend must make sure not to interfere with its own hardware mouse pointer.
#define RETRO_DEVICE_MOUSE 2
// KEYBOARD device lets one poll for raw key pressed.
// It is poll based, so input callback will return with the current pressed state.
#define RETRO_DEVICE_KEYBOARD 3
// Lightgun X/Y coordinates are reported relatively to last poll, similar to mouse.
#define RETRO_DEVICE_LIGHTGUN 4
// The ANALOG device is an extension to JOYPAD (RetroPad).
// Similar to DualShock it adds two analog sticks.
// This is treated as a separate device type as it returns values in the full analog range
// of [-0x8000, 0x7fff]. Positive X axis is right. Positive Y axis is down.
// Only use ANALOG type when polling for analog values of the axes.
#define RETRO_DEVICE_ANALOG 5
// These device types are specializations of the base types above.
// They should only be used in retro_set_controller_type() to inform libretro implementations
// about use of a very specific device type.
//
// In input state callback, however, only the base type should be used in the 'device' field.
#define RETRO_DEVICE_JOYPAD_MULTITAP ((1 << 8) | RETRO_DEVICE_JOYPAD)
#define RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE ((1 << 8) | RETRO_DEVICE_LIGHTGUN)
#define RETRO_DEVICE_LIGHTGUN_JUSTIFIER ((2 << 8) | RETRO_DEVICE_LIGHTGUN)
#define RETRO_DEVICE_LIGHTGUN_JUSTIFIERS ((3 << 8) | RETRO_DEVICE_LIGHTGUN)
// Buttons for the RetroPad (JOYPAD).
// The placement of these is equivalent to placements on the Super Nintendo controller.
// L2/R2/L3/R3 buttons correspond to the PS1 DualShock.
#define RETRO_DEVICE_ID_JOYPAD_B 0
#define RETRO_DEVICE_ID_JOYPAD_Y 1
#define RETRO_DEVICE_ID_JOYPAD_SELECT 2
#define RETRO_DEVICE_ID_JOYPAD_START 3
#define RETRO_DEVICE_ID_JOYPAD_UP 4
#define RETRO_DEVICE_ID_JOYPAD_DOWN 5
#define RETRO_DEVICE_ID_JOYPAD_LEFT 6
#define RETRO_DEVICE_ID_JOYPAD_RIGHT 7
#define RETRO_DEVICE_ID_JOYPAD_A 8
#define RETRO_DEVICE_ID_JOYPAD_X 9
#define RETRO_DEVICE_ID_JOYPAD_L 10
#define RETRO_DEVICE_ID_JOYPAD_R 11
#define RETRO_DEVICE_ID_JOYPAD_L2 12
#define RETRO_DEVICE_ID_JOYPAD_R2 13
#define RETRO_DEVICE_ID_JOYPAD_L3 14
#define RETRO_DEVICE_ID_JOYPAD_R3 15
// Index / Id values for ANALOG device.
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
#define RETRO_DEVICE_ID_ANALOG_X 0
#define RETRO_DEVICE_ID_ANALOG_Y 1
// Id values for MOUSE.
#define RETRO_DEVICE_ID_MOUSE_X 0
#define RETRO_DEVICE_ID_MOUSE_Y 1
#define RETRO_DEVICE_ID_MOUSE_LEFT 2
#define RETRO_DEVICE_ID_MOUSE_RIGHT 3
// Id values for LIGHTGUN types.
#define RETRO_DEVICE_ID_LIGHTGUN_X 0
#define RETRO_DEVICE_ID_LIGHTGUN_Y 1
#define RETRO_DEVICE_ID_LIGHTGUN_TRIGGER 2
#define RETRO_DEVICE_ID_LIGHTGUN_CURSOR 3
#define RETRO_DEVICE_ID_LIGHTGUN_TURBO 4
#define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5
#define RETRO_DEVICE_ID_LIGHTGUN_START 6
// Returned from retro_get_region().
#define RETRO_REGION_NTSC 0
#define RETRO_REGION_PAL 1
// Passed to retro_get_memory_data/size().
// If the memory type doesn't apply to the implementation NULL/0 can be returned.
#define RETRO_MEMORY_MASK 0xff
// Regular save ram. This ram is usually found on a game cartridge, backed up by a battery.
// If save game data is too complex for a single memory buffer,
// the SYSTEM_DIRECTORY environment callback can be used.
#define RETRO_MEMORY_SAVE_RAM 0
// Some games have a built-in clock to keep track of time.
// This memory is usually just a couple of bytes to keep track of time.
#define RETRO_MEMORY_RTC 1
// System ram lets a frontend peek into a game systems main RAM.
#define RETRO_MEMORY_SYSTEM_RAM 2
// Video ram lets a frontend peek into a game systems video RAM (VRAM).
#define RETRO_MEMORY_VIDEO_RAM 3
// Special memory types.
#define RETRO_MEMORY_SNES_BSX_RAM ((1 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_BSX_PRAM ((2 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_SUFAMI_TURBO_A_RAM ((3 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_SUFAMI_TURBO_B_RAM ((4 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_GAME_BOY_RAM ((5 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_GAME_BOY_RTC ((6 << 8) | RETRO_MEMORY_RTC)
// Special game types passed into retro_load_game_special().
// Only used when multiple ROMs are required.
#define RETRO_GAME_TYPE_BSX 0x101
#define RETRO_GAME_TYPE_BSX_SLOTTED 0x102
#define RETRO_GAME_TYPE_SUFAMI_TURBO 0x103
#define RETRO_GAME_TYPE_SUPER_GAME_BOY 0x104
// Keysyms used for ID in input state callback when polling RETRO_KEYBOARD.
enum retro_key
{
RETROK_UNKNOWN = 0,
RETROK_FIRST = 0,
RETROK_BACKSPACE = 8,
RETROK_TAB = 9,
RETROK_CLEAR = 12,
RETROK_RETURN = 13,
RETROK_PAUSE = 19,
RETROK_ESCAPE = 27,
RETROK_SPACE = 32,
RETROK_EXCLAIM = 33,
RETROK_QUOTEDBL = 34,
RETROK_HASH = 35,
RETROK_DOLLAR = 36,
RETROK_AMPERSAND = 38,
RETROK_QUOTE = 39,
RETROK_LEFTPAREN = 40,
RETROK_RIGHTPAREN = 41,
RETROK_ASTERISK = 42,
RETROK_PLUS = 43,
RETROK_COMMA = 44,
RETROK_MINUS = 45,
RETROK_PERIOD = 46,
RETROK_SLASH = 47,
RETROK_0 = 48,
RETROK_1 = 49,
RETROK_2 = 50,
RETROK_3 = 51,
RETROK_4 = 52,
RETROK_5 = 53,
RETROK_6 = 54,
RETROK_7 = 55,
RETROK_8 = 56,
RETROK_9 = 57,
RETROK_COLON = 58,
RETROK_SEMICOLON = 59,
RETROK_LESS = 60,
RETROK_EQUALS = 61,
RETROK_GREATER = 62,
RETROK_QUESTION = 63,
RETROK_AT = 64,
RETROK_LEFTBRACKET = 91,
RETROK_BACKSLASH = 92,
RETROK_RIGHTBRACKET = 93,
RETROK_CARET = 94,
RETROK_UNDERSCORE = 95,
RETROK_BACKQUOTE = 96,
RETROK_a = 97,
RETROK_b = 98,
RETROK_c = 99,
RETROK_d = 100,
RETROK_e = 101,
RETROK_f = 102,
RETROK_g = 103,
RETROK_h = 104,
RETROK_i = 105,
RETROK_j = 106,
RETROK_k = 107,
RETROK_l = 108,
RETROK_m = 109,
RETROK_n = 110,
RETROK_o = 111,
RETROK_p = 112,
RETROK_q = 113,
RETROK_r = 114,
RETROK_s = 115,
RETROK_t = 116,
RETROK_u = 117,
RETROK_v = 118,
RETROK_w = 119,
RETROK_x = 120,
RETROK_y = 121,
RETROK_z = 122,
RETROK_DELETE = 127,
RETROK_KP0 = 256,
RETROK_KP1 = 257,
RETROK_KP2 = 258,
RETROK_KP3 = 259,
RETROK_KP4 = 260,
RETROK_KP5 = 261,
RETROK_KP6 = 262,
RETROK_KP7 = 263,
RETROK_KP8 = 264,
RETROK_KP9 = 265,
RETROK_KP_PERIOD = 266,
RETROK_KP_DIVIDE = 267,
RETROK_KP_MULTIPLY = 268,
RETROK_KP_MINUS = 269,
RETROK_KP_PLUS = 270,
RETROK_KP_ENTER = 271,
RETROK_KP_EQUALS = 272,
RETROK_UP = 273,
RETROK_DOWN = 274,
RETROK_RIGHT = 275,
RETROK_LEFT = 276,
RETROK_INSERT = 277,
RETROK_HOME = 278,
RETROK_END = 279,
RETROK_PAGEUP = 280,
RETROK_PAGEDOWN = 281,
RETROK_F1 = 282,
RETROK_F2 = 283,
RETROK_F3 = 284,
RETROK_F4 = 285,
RETROK_F5 = 286,
RETROK_F6 = 287,
RETROK_F7 = 288,
RETROK_F8 = 289,
RETROK_F9 = 290,
RETROK_F10 = 291,
RETROK_F11 = 292,
RETROK_F12 = 293,
RETROK_F13 = 294,
RETROK_F14 = 295,
RETROK_F15 = 296,
RETROK_NUMLOCK = 300,
RETROK_CAPSLOCK = 301,
RETROK_SCROLLOCK = 302,
RETROK_RSHIFT = 303,
RETROK_LSHIFT = 304,
RETROK_RCTRL = 305,
RETROK_LCTRL = 306,
RETROK_RALT = 307,
RETROK_LALT = 308,
RETROK_RMETA = 309,
RETROK_LMETA = 310,
RETROK_LSUPER = 311,
RETROK_RSUPER = 312,
RETROK_MODE = 313,
RETROK_COMPOSE = 314,
RETROK_HELP = 315,
RETROK_PRINT = 316,
RETROK_SYSREQ = 317,
RETROK_BREAK = 318,
RETROK_MENU = 319,
RETROK_POWER = 320,
RETROK_EURO = 321,
RETROK_UNDO = 322,
RETROK_LAST
};
// Environment commands.
#define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * --
// Sets screen rotation of graphics.
// Is only implemented if rotation can be accelerated by hardware.
// Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180, 270 degrees
// counter-clockwise respectively.
//
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 // bool * --
// Boolean value whether or not the implementation should use overscan, or crop away overscan.
//
#define RETRO_ENVIRONMENT_GET_CAN_DUPE 3 // bool * --
// Boolean value whether or not frontend supports frame duping,
// passing NULL to video frame callback.
//
#define RETRO_ENVIRONMENT_GET_VARIABLE 4 // struct retro_variable * --
// Interface to aquire user-defined information from environment
// that cannot feasibly be supported in a multi-system way.
// Mostly used for obscure,
// specific features that the user can tap into when neseccary.
//
#define RETRO_ENVIRONMENT_SET_VARIABLES 5 // const struct retro_variable * --
// Allows an implementation to signal the environment
// which variables it might want to check for later using GET_VARIABLE.
// 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element.
// retro_variable::value should contain a human readable description of the key.
//
#define RETRO_ENVIRONMENT_SET_MESSAGE 6 // const struct retro_message * --
// Sets a message to be displayed in implementation-specific manner for a certain amount of 'frames'.
// Should not be used for trivial messages, which should simply be logged to stderr.
#define RETRO_ENVIRONMENT_SHUTDOWN 7 // N/A (NULL) --
// Requests the frontend to shutdown.
// Should only be used if game has a specific
// way to shutdown the game from a menu item or similar.
//
#define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8
// const unsigned * --
// Gives a hint to the frontend how demanding this implementation
// is on a system. E.g. reporting a level of 2 means
// this implementation should run decently on all frontends
// of level 2 and up.
//
// It can be used by the frontend to potentially warn
// about too demanding implementations.
//
// The levels are "floating", but roughly defined as:
// 0: Low-powered embedded devices such as Raspberry Pi
// 1: 6th generation consoles, such as Wii/Xbox 1, and phones, tablets, etc.
// 2: 7th generation consoles, such as PS3/360, with sub-par CPUs.
// 3: Modern desktop/laptops with reasonably powerful CPUs.
// 4: High-end desktops with very powerful CPUs.
//
// This function can be called on a per-game basis,
// as certain games an implementation can play might be
// particularily demanding.
// If called, it should be called in retro_load_game().
//
#define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9
// const char ** --
// Returns the "system" directory of the frontend.
// This directory can be used to store system specific ROMs such as BIOSes, configuration data, etc.
// The returned value can be NULL.
// If so, no such directory is defined,
// and it's up to the implementation to find a suitable directory.
//
#define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10
// const enum retro_pixel_format * --
// Sets the internal pixel format used by the implementation.
// The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555.
// This pixel format however, is deprecated (see enum retro_pixel_format).
// If the call returns false, the frontend does not support this pixel format.
// This function should be called inside retro_load_game() or retro_get_system_av_info().
//
#define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11
// const struct retro_input_descriptor * --
// Sets an array of retro_input_descriptors.
// It is up to the frontend to present this in a usable way.
// The array is terminated by retro_input_descriptor::description being set to NULL.
// This function can be called at any time, but it is recommended to call it as early as possible.
enum retro_pixel_format
{
// 0RGB1555, native endian. 0 bit must be set to 0.
// This pixel format is default for compatibility concerns only.
// If a 15/16-bit pixel format is desired, consider using RGB565.
RETRO_PIXEL_FORMAT_0RGB1555 = 0,
// XRGB8888, native endian. X bits are ignored.
RETRO_PIXEL_FORMAT_XRGB8888 = 1,
// RGB565, native endian. This pixel format is the recommended format to use if a 15/16-bit format is desired
// as it is the pixel format that is typically available on a wide range of low-power devices.
// It is also natively supported in APIs like OpenGL ES.
RETRO_PIXEL_FORMAT_RGB565 = 2,
// Ensure sizeof() == sizeof(int).
RETRO_PIXEL_FORMAT_UNKNOWN = INT_MAX
};
struct retro_message
{
const char *msg; // Message to be displayed.
unsigned frames; // Duration in frames of message.
};
// Describes how the libretro implementation maps a libretro input bind
// to its internal input system through a human readable string.
// This string can be used to better let a user configure input.
struct retro_input_descriptor
{
// Associates given parameters with a description.
unsigned port;
unsigned device;
unsigned index;
unsigned id;
const char *description; // Human readable description for parameters.
// The pointer must remain valid until retro_unload_game() is called.
};
struct retro_system_info
{
// All pointers are owned by libretro implementation, and pointers must remain valid until retro_deinit() is called.
const char *library_name; // Descriptive name of library. Should not contain any version numbers, etc.
const char *library_version; // Descriptive version of core.
const char *valid_extensions; // A string listing probably rom extensions the core will be able to load, separated with pipe.
// I.e. "bin|rom|iso".
// Typically used for a GUI to filter out extensions.
bool need_fullpath; // If true, retro_load_game() is guaranteed to provide a valid pathname in retro_game_info::path.
// ::data and ::size are both invalid.
// If false, ::data and ::size are guaranteed to be valid, but ::path might not be valid.
// This is typically set to true for libretro implementations that must load from file.
// Implementations should strive for setting this to false, as it allows the frontend to perform patching, etc.
bool block_extract; // If true, the frontend is not allowed to extract any archives before loading the real ROM.
// Necessary for certain libretro implementations that load games from zipped archives.
};
struct retro_game_geometry
{
unsigned base_width; // Nominal video width of game.
unsigned base_height; // Nominal video height of game.
unsigned max_width; // Maximum possible width of game.
unsigned max_height; // Maximum possible height of game.
float aspect_ratio; // Nominal aspect ratio of game. If aspect_ratio is <= 0.0,
// an aspect ratio of base_width / base_height is assumed.
// A frontend could override this setting if desired.
};
struct retro_system_timing
{
double fps; // FPS of video content.
double sample_rate; // Sampling rate of audio.
};
struct retro_system_av_info
{
struct retro_game_geometry geometry;
struct retro_system_timing timing;
};
struct retro_variable
{
const char *key; // Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE.
// If NULL, obtains the complete environment string if more complex parsing is necessary.
// The environment string is formatted as key-value pairs delimited by semicolons as so:
// "key1=value1;key2=value2;..."
const char *value; // Value to be obtained. If key does not exist, it is set to NULL.
};
struct retro_game_info
{
const char *path; // Path to game, UTF-8 encoded. Usually used as a reference.
// May be NULL if rom was loaded from stdin or similar.
// retro_system_info::need_fullpath guaranteed that this path is valid.
const void *data; // Memory buffer of loaded game. Will be NULL if need_fullpath was set.
size_t size; // Size of memory buffer.
const char *meta; // String of implementation specific meta-data.
};
// Callbacks
//
// Environment callback. Gives implementations a way of performing uncommon tasks. Extensible.
typedef bool (*retro_environment_t)(unsigned cmd, void *data);
// Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).
// Width and height specify dimensions of buffer.
// Pitch specifices length in bytes between two lines in buffer.
// For performance reasons, it is highly recommended to have a frame that is packed in memory, i.e. pitch == width * byte_per_pixel.
// Certain graphic APIs, such as OpenGL ES, do not like textures that are not packed in memory.
typedef void (*retro_video_refresh_t)(const void *data, unsigned width, unsigned height, size_t pitch);
// Renders a single audio frame. Should only be used if implementation generates a single sample at a time.
// Format is signed 16-bit native endian.
typedef void (*retro_audio_sample_t)(int16_t left, int16_t right);
// Renders multiple audio frames in one go. One frame is defined as a sample of left and right channels, interleaved.
// I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames.
// Only one of the audio callbacks must ever be used.
typedef size_t (*retro_audio_sample_batch_t)(const int16_t *data, size_t frames);
// Polls input.
typedef void (*retro_input_poll_t)(void);
// Queries for input for player 'port'. device will be masked with RETRO_DEVICE_MASK.
// Specialization of devices such as RETRO_DEVICE_JOYPAD_MULTITAP that have been set with retro_set_controller_port_device()
// will still use the higher level RETRO_DEVICE_JOYPAD to request input.
typedef int16_t (*retro_input_state_t)(unsigned port, unsigned device, unsigned index, unsigned id);
// Sets callbacks. retro_set_environment() is guaranteed to be called before retro_init().
// The rest of the set_* functions are guaranteed to have been called before the first call to retro_run() is made.
void retro_set_environment(retro_environment_t);
void retro_set_video_refresh(retro_video_refresh_t);
void retro_set_audio_sample(retro_audio_sample_t);
void retro_set_audio_sample_batch(retro_audio_sample_batch_t);
void retro_set_input_poll(retro_input_poll_t);
void retro_set_input_state(retro_input_state_t);
// Library global initialization/deinitialization.
void retro_init(void);
void retro_deinit(void);
// Must return RETRO_API_VERSION. Used to validate ABI compatibility when the API is revised.
unsigned retro_api_version(void);
// Gets statically known system info. Pointers provided in *info must be statically allocated.
// Can be called at any time, even before retro_init().
void retro_get_system_info(struct retro_system_info *info);
// Gets information about system audio/video timings and geometry.
// Can be called only after retro_load_game() has successfully completed.
// NOTE: The implementation of this function might not initialize every variable if needed.
// E.g. geom.aspect_ratio might not be initialized if core doesn't desire a particular aspect ratio.
void retro_get_system_av_info(struct retro_system_av_info *info);
// Sets device to be used for player 'port'.
void retro_set_controller_port_device(unsigned port, unsigned device);
// Resets the current game.
void retro_reset(void);
// Runs the game for one video frame.
// During retro_run(), input_poll callback must be called at least once.
//
// If a frame is not rendered for reasons where a game "dropped" a frame,
// this still counts as a frame, and retro_run() should explicitly dupe a frame if GET_CAN_DUPE returns true.
// In this case, the video callback can take a NULL argument for data.
void retro_run(void);
// Returns the amount of data the implementation requires to serialize internal state (save states).
// Beetween calls to retro_load_game() and retro_unload_game(), the returned size is never allowed to be larger than a previous returned value, to
// ensure that the frontend can allocate a save state buffer once.
size_t retro_serialize_size(void);
// Serializes internal state. If failed, or size is lower than retro_serialize_size(), it should return false, true otherwise.
bool retro_serialize(void *data, size_t size);
bool retro_unserialize(const void *data, size_t size);
void retro_cheat_reset(void);
void retro_cheat_set(unsigned index, bool enabled, const char *code);
// Loads a game.
bool retro_load_game(const struct retro_game_info *game);
// Loads a "special" kind of game. Should not be used except in extreme cases.
bool retro_load_game_special(
unsigned game_type,
const struct retro_game_info *info, size_t num_info
);
// Unloads a currently loaded game.
void retro_unload_game(void);
// Gets region of game.
unsigned retro_get_region(void);
// Gets region of memory.
void *retro_get_memory_data(unsigned id);
size_t retro_get_memory_size(unsigned id);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +0,0 @@
{
global: retro_*;
local: *;
};

View File

@ -1,500 +0,0 @@
// ---------------------------------------------------------------------------------------
// NeoGeo CD Game Info Module (by CaptainCPS-X)
// ---------------------------------------------------------------------------------------
#include "burner.h"
#include "../neocdlist.h"
struct NGCDGAME games[] =
{
// ---------------------------------------------------------------------------------------------------------------------------------------------//
// * Name * Title * Year * Company * Game ID //
// ---------------------------------------------------------------------------------------------------------------------------------------------//
{ _T("nam1975") , _T("NAM-1975") , _T("1990") , _T("SNK") , 0x0001 }, //
{ _T("bstars") , _T("Baseball Stars Professional") , _T("1991") , _T("SNK") , 0x0002 }, //
{ _T("tpgolf") , _T("Top Player's Golf") , _T("1990") , _T("SNK") , 0x0003 }, //
{ _T("mahretsu") , _T("Mahjong Kyo Retsuden - Nishi Nihon Hen") , _T("1990") , _T("SNK") , 0x0004 }, //
{ _T("maglord") , _T("Magician Lord") , _T("1990") , _T("ADK") , 0x0005 }, //
{ _T("ridhero") , _T("Riding Hero") , _T("1991") , _T("SNK") , 0x0006 }, //
{ _T("alpham2") , _T("Alpha Mission II / ASO II - Last Guardian") , _T("1994") , _T("SNK") , 0x0007 }, //
{ _T("ncombat") , _T("Ninja Combat") , _T("1990") , _T("SNK/ADK") , 0x0009 }, //
{ _T("cyberlip") , _T("Cyber-Lip") , _T("1991") , _T("SNK") , 0x0010 }, //
{ _T("superspy") , _T("The Super Spy") , _T("1990") , _T("SNK") , 0x0011 }, //
{ _T("mutnat") , _T("Mutation Nation") , _T("1995") , _T("SNK") , 0x0014 }, //
{ _T("sengoku") , _T("Sengoku / Sengoku Denshou") , _T("1994") , _T("SNK") , 0x0017 }, //
{ _T("burningf") , _T("Burning Fight") , _T("1994") , _T("SNK") , 0x0018 }, //
{ _T("lbowling") , _T("League Bowling") , _T("1994") , _T("SNK") , 0x0019 }, //
{ _T("gpilots") , _T("Ghost Pilots") , _T("1991") , _T("SNK") , 0x0020 }, //
{ _T("joyjoy") , _T("Puzzled / Joy Joy Kid") , _T("1990") , _T("SNK") , 0x0021 }, //
{ _T("bjourney") , _T("Blue's Journey / Raguy") , _T("1990") , _T("SNK/ADK") , 0x0022 }, //
{ _T("lresort") , _T("Last Resort") , _T("1994") , _T("SNK") , 0x0024 }, //
{ _T("2020bb") , _T("2020 Super Baseball") , _T("1994") , _T("SNK") , 0x0030 }, //
{ _T("socbrawl") , _T("Soccer Brawl") , _T("1991") , _T("SNK") , 0x0031 }, //
{ _T("roboarmy") , _T("Robo Army") , _T("1991") , _T("SNK") , 0x0032 }, //
{ _T("fatfury") , _T("Fatal Fury - The Battle of Fury") , _T("1994") , _T("SNK") , 0x0033 }, //
{ _T("fbfrenzy") , _T("Football Frenzy") , _T("1994") , _T("SNK") , 0x0034 }, //
{ _T("crswords") , _T("Crossed Swords") , _T("1994") , _T("SNK/ADK") , 0x0037 }, //
{ _T("rallych") , _T("Rally Chase") , _T("1991") , _T("SNK/ADK") , 0x0038 }, //
{ _T("kotm2") , _T("King of the Monsters 2") , _T("1992") , _T("SNK") , 0x0039 }, //
{ _T("sengoku2") , _T("Sengoku 2 / Sengoku Denshou 2") , _T("1994") , _T("SNK") , 0x0040 }, //
{ _T("bstars2") , _T("Baseball Stars 2") , _T("1992") , _T("SNK") , 0x0041 }, //
{ _T("3countb") , _T("3 Count Bout / Fire Suplex") , _T("1995") , _T("SNK") , 0x0043 }, //
{ _T("aof") , _T("Art of Fighting / Ryuuko no Ken") , _T("1994") , _T("SNK") , 0x0044 }, //
{ _T("samsho") , _T("Samurai Shodown / Samurai Spirits") , _T("1993") , _T("SNK") , 0x0045 }, //
{ _T("tophuntr") , _T("Top Hunter - Roddy & Cathy") , _T("1994") , _T("SNK") , 0x0046 }, //
{ _T("fatfury2") , _T("Fatal Fury 2 / Garou Densetsu 2 - Aratanaru Tatakai") , _T("1994") , _T("SNK") , 0x0047 }, //
{ _T("janshin") , _T("Janshin Densetsu - Quest of the Jongmaster") , _T("1995") , _T("Yubis") , 0x0048 }, //
{ _T("ncommand") , _T("Ninja Commando") , _T("1992") , _T("SNK") , 0x0050 }, //
{ _T("viewpoin") , _T("Viewpoint") , _T("1992") , _T("Sammy/Aicom") , 0x0051 }, //
{ _T("ssideki") , _T("Super Sidekicks / Tokuten Oh") , _T("1993") , _T("SNK") , 0x0052 }, //
{ _T("wh1") , _T("World Heroes") , _T("1992") , _T("ADK") , 0x0053 }, //
{ _T("crsword2") , _T("Crossed Swords II") , _T("1995") , _T("SNK/ADK") , 0x0054 }, //
{ _T("kof94") , _T("The King of Fighters '94 (JP)") , _T("1994") , _T("SNK") , 0x0055 }, //
{ _T("kof94ju") , _T("The King of Fighters '94 (JP-US)") , _T("1994") , _T("SNK") , 0x1055 }, // custom id
{ _T("aof2") , _T("Art of Fighting 2 / Ryuuko no Ken 2") , _T("1994") , _T("SNK") , 0x0056 }, //
{ _T("wh2") , _T("World Heroes 2") , _T("1995") , _T("SNK/ADK") , 0x0057 }, //
{ _T("fatfursp") , _T("Fatal Fury Special / Garou Densetsu Special") , _T("1994") , _T("SNK") , 0x0058 }, //
{ _T("savagere") , _T("Savage Reign / Fu'un Mokujiroku - Kakutou Sousei") , _T("1995") , _T("SNK") , 0x0059 }, //
{ _T("ssideki2") , _T("Super Sidekicks 2 / Tokuten Oh 2") , _T("1994") , _T("SNK") , 0x0061 }, //
{ _T("samsho2") , _T("Samurai Shodown 2 / Shin Samurai Spirits") , _T("1994") , _T("SNK") , 0x0063 }, //
{ _T("wh2j") , _T("World Heroes 2 Jet") , _T("1995") , _T("SNK/ADK") , 0x0064 }, //
{ _T("wjammers") , _T("Windjammers / Flying Power Disc") , _T("1994") , _T("Data East") , 0x0065 }, //
{ _T("karnovr") , _T("Karnov's Revenge / Fighters History Dynamite") , _T("1994") , _T("Data East") , 0x0066 }, //
{ _T("pspikes2") , _T("Power Spikes II") , _T("1994") , _T("Video System") , 0x0068 }, //
{ _T("aodk") , _T("Aggressors of Dark Kombat / Tsuukai GanGan Koushinkyoku") , _T("1994"), _T("SNK/ADK") , 0x0074 }, //
{ _T("sonicwi2") , _T("Aero Fighters 2 / Sonic Wings 2") , _T("1994") , _T("Video System") , 0x0075 }, //
{ _T("galaxyfg") , _T("Galaxy Fight - Universal Warriors") , _T("1995") , _T("Sunsoft") , 0x0078 }, //
{ _T("strhoop") , _T("Street Hoop / Dunk Dream") , _T("1994") , _T("Data East") , 0x0079 }, //
{ _T("quizkof") , _T("Quiz King of Fighters") , _T("1993") , _T("SNK/Saurus") , 0x0080 }, //
{ _T("ssideki3") , _T("Super Sidekicks 3 - The Next Glory / Tokuten Oh 3 - Eikoue No Chousen"), _T("1995") , _T("SNK") , 0x0081 }, //
{ _T("doubledr") , _T("Double Dragon") , _T("1995") , _T("Technos") , 0x0082 }, //
{ _T("pbobblen") , _T("Puzzle Bobble / Bust-A-Move") , _T("1994") , _T("SNK") , 0x0083 }, //
{ _T("kof95") , _T("The King of Fighters '95 (JP-US)") , _T("1995") , _T("SNK") , 0x0084 }, //
{ _T("kof95r1") , _T("The King of Fighters '95 (JP-US)(Rev 1)") , _T("1995") , _T("SNK") , 0x1084 }, //
{ _T("ssrpg") , _T("Shinsetsu Samurai Spirits - Bushidohretsuden") , _T("1997") , _T("SNK") , 0x0085 }, //
{ _T("samsho3") , _T("Samurai Shodown 3 / Samurai Spirits 3") , _T("1995") , _T("SNK") , 0x0087 }, //
{ _T("stakwin") , _T("Stakes Winner - GI Kanzen Seiha Heno Machi") , _T("1995") , _T("Saurus") , 0x0088 }, //
{ _T("pulstar") , _T("Pulstar") , _T("1995") , _T("Aicom") , 0x0089 }, //
{ _T("whp") , _T("World Heroes Perfect") , _T("1995") , _T("ADK") , 0x0090 }, //
{ _T("kabukikl") , _T("Kabuki Klash / Tengai Makyou Shinden - Far East of Eden") , _T("1995"), _T("Hudson") , 0x0092 }, //
{ _T("gowcaizr") , _T("Voltage Fighter Gowcaizer / Choujin Gakuen Gowcaizer"), _T("1995") , _T("Technos") , 0x0094 }, //
{ _T("rbff1") , _T("Real Bout Fatal Fury") , _T("1995") , _T("SNK") , 0x0095 }, //
{ _T("aof3") , _T("Art of Fighting 3: Path of the Warrior") , _T("1996") , _T("SNK") , 0x0096 }, //
{ _T("sonicwi3") , _T("Aero Fighters 3 / Sonic Wings 3") , _T("1995") , _T("SNK") , 0x0097 }, //
{ _T("fromanc2") , _T("Idol Mahjong Final Romance 2") , _T("1995") , _T("Video Systems") , 0x0098 }, //
{ _T("turfmast") , _T("Neo Turf Masters / Big Tournament Golf") , _T("1996") , _T("Nazca") , 0x0200 }, //
{ _T("mslug") , _T("Metal Slug - Super Vehicle-001") , _T("1996") , _T("Nazca") , 0x0201 }, //
{ _T("mosyougi") , _T("Shougi no Tatsujin - Master of Syougi") , _T("1995") , _T("ADK") , 0x0203 }, //
{ _T("adkworld") , _T("ADK World / ADK Special") , _T("1995") , _T("ADK") , 0x0204 }, //
{ _T("ngcdsp") , _T("Neo Geo CD Special") , _T("1995") , _T("SNK") , 0x0205 }, //
{ _T("zintrick") , _T("Zintrick / Oshidashi Zintrick") , _T("1996") , _T("ADK") , 0x0211 }, //
{ _T("overtop") , _T("OverTop") , _T("1996") , _T("ADK") , 0x0212 }, //
{ _T("neodrift") , _T("Neo DriftOut") , _T("1996") , _T("Visco") , 0x0213 }, //
{ _T("kof96") , _T("The King of Fighters '96") , _T("1996") , _T("SNK") , 0x0214 }, //
{ _T("ninjamas") , _T("Ninja Master's - Haou Ninpou-Chou") , _T("1996") , _T("ADK/SNK") , 0x0217 }, //
{ _T("ragnagrd") , _T("Ragnagard / Shinouken") , _T("1996") , _T("Saurus") , 0x0218 }, //
{ _T("pgoal") , _T("Pleasuregoal - 5 on 5 Mini Soccer / Futsal") , _T("1996") , _T("Saurus") , 0x0219 }, //
{ _T("ironclad") , _T("Ironclad / Choutetsu Brikin'ger") , _T("1996") , _T("Saurus") , 0x0220 }, //
{ _T("magdrop2") , _T("Magical Drop 2") , _T("1996") , _T("Data East") , 0x0221 }, //
{ _T("samsho4") , _T("Samurai Shodown IV - Amakusa's Revenge") , _T("1996") , _T("SNK") , 0x0222 }, //
{ _T("rbffspec") , _T("Real Bout Fatal Fury Special") , _T("1996") , _T("SNK") , 0x0223 }, //
{ _T("twinspri") , _T("Twinkle Star Sprites") , _T("1996") , _T("ADK") , 0x0224 }, //
{ _T("kof96ngc") , _T("The King of Fighters '96 NEOGEO Collection") , _T("1996") , _T("SNK") , 0x0229 }, //
{ _T("breakers") , _T("Breakers") , _T("1996") , _T("Visco") , 0x0230 }, //
{ _T("kof97") , _T("The King of Fighters '97") , _T("1997") , _T("SNK") , 0x0232 }, //
{ _T("lastblad") , _T("The Last Blade / Bakumatsu Roman - Gekka no Kenshi") , _T("1997") , _T("SNK") , 0x0234 }, //
{ _T("rbff2") , _T("Real Bout Fatal Fury 2 / Garou Densetsu 2 - Aratanaru Tatakai"), _T("1998"), _T("SNK") , 0x0240 }, //
{ _T("mslug2") , _T("Metal Slug 2 - Super Vehicle-001/II") , _T("1998") , _T("SNK") , 0x0241 }, //
{ _T("kof98") , _T("The King of Fighters '98 - The Slugfest") , _T("1998") , _T("SNK") , 0x0242 }, //
{ _T("lastbld2") , _T("The Last Blade 2") , _T("1998") , _T("SNK") , 0x0243 }, //
{ _T("kof99") , _T("The King of Fighters '99 - Millennium Battle") , _T("1999") , _T("SNK") , 0x0251 }, //
{ _T("fatfury3") , _T("Fatal Fury 3 - Road to the Final Victory / Garou Densetsu 3 - Harukanaru Tatakai"), _T("1995"), _T("SNK"), 0x069c }, //
};
NGCDGAME* GetNeoGeoCDInfo(unsigned int nID)
{
for(unsigned int nGame = 0; nGame < (sizeof(games) / sizeof(NGCDGAME)); nGame++) {
if(nID == games[nGame].id ) {
return &games[nGame];
}
}
return NULL;
}
NGCDGAME* game;
// Get the title
int GetNeoCDTitle(unsigned int nGameID)
{
game = (NGCDGAME*)malloc(sizeof(NGCDGAME));
memset(game, 0, sizeof(NGCDGAME));
if(GetNeoGeoCDInfo(nGameID))
{
memcpy(game, GetNeoGeoCDInfo(nGameID), sizeof(NGCDGAME));
return 1;
}
game = NULL;
return 0;
}
void iso9660_ReadOffset(unsigned char *Dest, FILE* fp, unsigned int lOffset, unsigned int lSize, unsigned int lLength)
{
if(fp == NULL) return;
if (Dest == NULL) return;
fseek(fp, lOffset, SEEK_SET);
fread(Dest, lLength, lSize, fp);
}
static void NeoCDList_iso9660_CheckDirRecord(FILE* fp, int nSector)
{
int nSectorLength = 2048;
//int nFile = 0;
unsigned int lBytesRead = 0;
//int nLen = 0;
unsigned int lOffset = 0;
bool bNewSector = false;
bool bRevisionQueve = false;
int nRevisionQueveID = 0;
lOffset = (nSector * nSectorLength);
unsigned char* nLenDR = (unsigned char*)malloc(1 * sizeof(unsigned char));
unsigned char* Flags = (unsigned char*)malloc(1 * sizeof(unsigned char));
unsigned char* ExtentLoc = (unsigned char*)malloc(8 * sizeof(unsigned char));
unsigned char* Data = (unsigned char*)malloc(0x10b * sizeof(unsigned char));
unsigned char* LEN_FI = (unsigned char*)malloc(1 * sizeof(unsigned char));
char *File = (char*)malloc(32 * sizeof(char));
while(1)
{
iso9660_ReadOffset(nLenDR, fp, lOffset, 1, sizeof(unsigned char));
if(nLenDR[0] == 0x22) {
lOffset += nLenDR[0];
lBytesRead += nLenDR[0];
continue;
}
if(nLenDR[0] < 0x22)
{
if(bNewSector)
{
if(bRevisionQueve) {
bRevisionQueve = false;
GetNeoCDTitle(nRevisionQueveID);
}
return;
}
nLenDR[0] = 0;
iso9660_ReadOffset(nLenDR, fp, lOffset + 1, 1, sizeof(unsigned char));
if(nLenDR[0] < 0x22) {
lOffset += (2048 - lBytesRead);
lBytesRead = 0;
bNewSector = true;
continue;
}
}
bNewSector = false;
iso9660_ReadOffset(Flags, fp, lOffset + 25, 1, sizeof(unsigned char));
if(!(Flags[0] & (1 << 1)))
{
iso9660_ReadOffset(ExtentLoc, fp, lOffset + 2, 8, sizeof(unsigned char));
char szValue[9];
sprintf(szValue, "%02x%02x%02x%02x", ExtentLoc[4], ExtentLoc[5], ExtentLoc[6], ExtentLoc[7]);
unsigned int nValue = 0;
sscanf(szValue, "%x", &nValue);
iso9660_ReadOffset(Data, fp, nValue * 2048, 0x10a, sizeof(unsigned char));
char szData[8];
sprintf(szData, "%c%c%c%c%c%c%c", Data[0x100], Data[0x101], Data[0x102], Data[0x103], Data[0x104], Data[0x105], Data[0x106]);
if(!strncmp(szData, "NEO-GEO", 7))
{
char id[] = "0000";
sprintf(id, "%02X%02X", Data[0x108], Data[0x109]);
unsigned int nID = 0;
sscanf(id, "%x", &nID);
iso9660_ReadOffset(LEN_FI, fp, lOffset + 32, 1, sizeof(unsigned char));
iso9660_ReadOffset((unsigned char*)File, fp, lOffset + 33, LEN_FI[0], sizeof(char));
strncpy(File, File, LEN_FI[0]);
File[LEN_FI[0]] = 0;
// King of Fighters '94, The (1994)(SNK)(JP)
// 10-6-1994 (P1.PRG)
if(nID == 0x0055 && Data[0x67] == 0xDE) {
// ...continue
}
// King of Fighters '94, The (1994)(SNK)(JP-US)
// 11-21-1994 (P1.PRG)
if(nID == 0x0055 && Data[0x67] == 0xE6) {
// Change to custom revision id
nID = 0x1055;
}
// King of Fighters '95, The (1995)(SNK)(JP-US)[!][NGCD-084 MT B01, B03-B06, NGCD-084E MT B01]
// 9-11-1995 (P1.PRG)
if(nID == 0x0084 && Data[0x6C] == 0xC0) {
// ... continue
}
// King of Fighters '95, The (1995)(SNK)(JP-US)[!][NGCD-084 MT B10, NGCD-084E MT B03]
// 10-5-1995 (P1.PRG)
if(nID == 0x0084 && Data[0x6C] == 0xFF) {
// Change to custom revision id
nID = 0x1084;
}
// King of Fighters '96 NEOGEO Collection, The
if(nID == 0x0229) {
bRevisionQueve = false;
GetNeoCDTitle(nID);
break;
}
// King of Fighters '96, The
if(nID == 0x0214) {
bRevisionQueve = true;
nRevisionQueveID = nID;
lOffset += nLenDR[0];
lBytesRead += nLenDR[0];
continue;
}
GetNeoCDTitle(nID);
break;
}
}
lOffset += nLenDR[0];
lBytesRead += nLenDR[0];
}
if (nLenDR) {
free(nLenDR);
nLenDR = NULL;
}
if (Flags) {
free(Flags);
Flags = NULL;
}
if (ExtentLoc) {
free(ExtentLoc);
ExtentLoc = NULL;
}
if (Data) {
free(Data);
Data = NULL;
}
if (LEN_FI) {
free(LEN_FI);
LEN_FI = NULL;
}
if (File) {
free(File);
File = NULL;
}
}
// Check the specified ISO, and proceed accordingly
static int NeoCDList_CheckISO(TCHAR* pszFile)
{
if(!pszFile) {
// error
return 0;
}
// Make sure we have a valid ISO file extension...
if(_tcsstr(pszFile, _T(".iso")) || _tcsstr(pszFile, _T(".ISO")) )
{
FILE* fp = _tfopen(pszFile, _T("rb"));
if(fp)
{
// Read ISO and look for 68K ROM standard program header, ID is always there
// Note: This function works very quick, doesn't compromise performance :)
// it just read each sector first 264 bytes aproximately only.
// Get ISO Size (bytes)
fseek(fp, 0, SEEK_END);
unsigned int lSize = 0;
lSize = ftell(fp);
//rewind(fp);
fseek(fp, 0, SEEK_SET);
// If it has at least 16 sectors proceed
if(lSize > (2048 * 16))
{
// Check for Standard ISO9660 Identifier
unsigned char IsoHeader[2048 * 16 + 1];
unsigned char IsoCheck[6];
fread(IsoHeader, 1, 2048 * 16 + 1, fp); // advance to sector 16 and PVD Field 2
fread(IsoCheck, 1, 5, fp); // get Standard Identifier Field from PVD
// Verify that we have indeed a valid ISO9660 MODE1/2048
if(!memcmp(IsoCheck, "CD001", 5))
{
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Found. \n"));
iso9660_VDH vdh;
// Get Volume Descriptor Header
memset(&vdh, 0, sizeof(vdh));
//memcpy(&vdh, iso9660_ReadOffset(fp, (2048 * 16), sizeof(vdh)), sizeof(vdh));
iso9660_ReadOffset((unsigned char*)&vdh, fp, 2048 * 16, 1, sizeof(vdh));
// Check for a valid Volume Descriptor Type
if(vdh.vdtype == 0x01)
{
#if 0
// This will fail on 64-bit due to differing variable sizes in the pvd struct
// Get Primary Volume Descriptor
iso9660_PVD pvd;
memset(&pvd, 0, sizeof(pvd));
//memcpy(&pvd, iso9660_ReadOffset(fp, (2048 * 16), sizeof(pvd)), sizeof(pvd));
iso9660_ReadOffset((unsigned char*)&pvd, fp, 2048 * 16, 1, sizeof(pvd));
// ROOT DIRECTORY RECORD
// Handle Path Table Location
char szRootSector[32];
unsigned int nRootSector = 0;
sprintf(szRootSector, "%02X%02X%02X%02X",
pvd.root_directory_record.location_of_extent[4],
pvd.root_directory_record.location_of_extent[5],
pvd.root_directory_record.location_of_extent[6],
pvd.root_directory_record.location_of_extent[7]);
// Convert HEX string to Decimal
sscanf(szRootSector, "%X", &nRootSector);
#else
// Just read from the file directly at the correct offset (0x8000 + 0x9e for the start of the root directory record)
unsigned char buffer[8];
char szRootSector[32];
unsigned int nRootSector = 0;
fseek(fp, 0x809e, SEEK_SET);
fread(buffer, 1, 8, fp);
sprintf(szRootSector, "%02x%02x%02x%02x", buffer[4], buffer[5], buffer[6], buffer[7]);
sscanf(szRootSector, "%x", &nRootSector);
#endif
// Process the Root Directory Records
NeoCDList_iso9660_CheckDirRecord(fp, nRootSector);
// Path Table Records are not processed, since NeoGeo CD should not have subdirectories
// ...
}
} else {
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Not Found, cannot continue. \n"));
return 0;
}
}
} else {
//bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
return 0;
}
if(fp) fclose(fp);
} else {
//bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
return 0;
}
return 1;
}
// This will do everything
int GetNeoGeoCD_Identifier()
{
if(!GetIsoPath() || !IsNeoGeoCD()) {
return 0;
}
// Make sure we have a valid ISO file extension...
if(_tcsstr(GetIsoPath(), _T(".iso")) || _tcsstr(GetIsoPath(), _T(".ISO")) )
{
if(_tfopen(GetIsoPath(), _T("rb")))
{
// Read ISO and look for 68K ROM standard program header, ID is always there
// Note: This function works very quick, doesn't compromise performance :)
// it just read each sector first 264 bytes aproximately only.
NeoCDList_CheckISO(GetIsoPath());
} else {
bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
return 0;
}
} else {
bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
return 0;
}
return 1;
}
int NeoCDInfo_Init()
{
NeoCDInfo_Exit();
return GetNeoGeoCD_Identifier();
}
TCHAR* NeoCDInfo_Text(int nText)
{
if(!game || !IsNeoGeoCD() || !bDrvOkay) return NULL;
switch(nText)
{
case DRV_NAME: return game->pszName;
case DRV_FULLNAME: return game->pszTitle;
case DRV_MANUFACTURER: return game->pszCompany;
case DRV_DATE: return game->pszYear;
}
return NULL;
}
int NeoCDInfo_ID()
{
if(!game || !IsNeoGeoCD() || !bDrvOkay) return 0;
return game->id;
}
void NeoCDInfo_Exit()
{
if(game) {
free(game);
game = NULL;
}
}

View File

@ -1 +0,0 @@
// Dummy header as core needs to include this for some reason.

View File

@ -1,63 +0,0 @@
#ifndef __PORT_TYPEDEFS_H
#define __PORT_TYPEDEFS_H
#include <stdint.h>
#include <wchar.h>
#include "inp_keys.h"
#define TCHAR char
#define _T(x) x
#define _tfopen fopen
#define _tcstol strtol
#define _tcsstr strstr
#define _istspace(x) isspace(x)
#define _stprintf sprintf
#define _tcslen strlen
#define _tcsicmp(a, b) strcasecmp(a, b)
#define _tcscpy(to, from) strcpy(to, from)
#define _fgetts fgets
#define _strnicmp(s1, s2, n) strncasecmp(s1, s2, n)
#define _tcsncmp strncmp
#define _tcsncpy strncpy
#define _stscanf sscanf
#define _ftprintf fprintf
#ifdef _MSC_VER
#include <tchar.h>
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)
#define strcasecmp(x, y) _stricmp(x, y)
#define snprintf _snprintf
#else
#define _stricmp(x, y) strcasecmp(x,y)
typedef struct { int x, y, width, height; } RECT;
#undef __cdecl
#define __cdecl
#define bprintf(...) {}
#endif
#undef __fastcall
#undef _fastcall
#define __fastcall /*what does this correspond to?*/
#define _fastcall /*same as above - what does this correspond to?*/
#define ANSIToTCHAR(str, foo, bar) (str)
/* for Windows / Xbox 360 (below VS2010) - typedefs for missing stdint.h types such as uintptr_t?*/
/*FBA defines*/
#define PUF_TEXT_NO_TRANSLATE (0)
#define PUF_TYPE_ERROR (1)
extern TCHAR szAppBurnVer[16];
typedef int HWND;
extern int bDrvOkay;
extern int bRunPause;
extern bool bAlwaysProcessKeyboardInput;
extern HWND hScrnWnd; // Handle to the screen window
extern void InpDIPSWResetDIPs (void);
#endif

View File

@ -1,11 +1,11 @@
#include "burnint.h"
#include "m6805_intf.h"
static INT32 ADDRESS_MAX;
static INT32 ADDRESS_MASK;
static INT32 PAGE;
static INT32 PAGE_MASK;
static INT32 PAGE_SHIFT;
static INT32 M6805_ADDRESS_MAX;
static INT32 M6805_ADDRESS_MASK;
static INT32 M6805_PAGE;
static INT32 M6805_PAGE_MASK;
static INT32 M6805_PAGE_SHIFT;
#define READ 0
#define WRITE 1
@ -38,11 +38,11 @@ void m6805MapMemory(UINT8 *ptr, INT32 nStart, INT32 nEnd, INT32 nType)
if (!DebugCPU_M6805Initted) bprintf(PRINT_ERROR, _T("m6805MapMemory called without init\n"));
#endif
for (INT32 i = nStart / PAGE; i < (nEnd / PAGE) + 1; i++)
for (INT32 i = nStart / M6805_PAGE; i < (nEnd / M6805_PAGE) + 1; i++)
{
if (nType & (1 << READ)) mem[ READ][i] = ptr + ((i * PAGE) - nStart);
if (nType & (1 << WRITE)) mem[WRITE][i] = ptr + ((i * PAGE) - nStart);
if (nType & (1 << FETCH)) mem[FETCH][i] = ptr + ((i * PAGE) - nStart);
if (nType & (1 << READ)) mem[ READ][i] = ptr + ((i * M6805_PAGE) - nStart);
if (nType & (1 << WRITE)) mem[WRITE][i] = ptr + ((i * M6805_PAGE) - nStart);
if (nType & (1 << FETCH)) mem[FETCH][i] = ptr + ((i * M6805_PAGE) - nStart);
}
}
@ -66,10 +66,10 @@ void m6805SetReadHandler(UINT8 (*read)(UINT16))
void m6805Write(UINT16 address, UINT8 data)
{
address &= ADDRESS_MASK;
address &= M6805_ADDRESS_MASK;
if (mem[WRITE][address >> PAGE_SHIFT] != NULL) {
mem[WRITE][address >> PAGE_SHIFT][address & PAGE_MASK] = data;
if (mem[WRITE][address >> M6805_PAGE_SHIFT] != NULL) {
mem[WRITE][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK] = data;
return;
}
@ -83,10 +83,10 @@ void m6805Write(UINT16 address, UINT8 data)
UINT8 m6805Read(UINT16 address)
{
address &= ADDRESS_MASK;
address &= M6805_ADDRESS_MASK;
if (mem[READ][address >> PAGE_SHIFT] != NULL) {
return mem[READ][address >> PAGE_SHIFT][address & PAGE_MASK];
if (mem[READ][address >> M6805_PAGE_SHIFT] != NULL) {
return mem[READ][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK];
}
if (m6805ReadFunction != NULL) {
@ -98,10 +98,10 @@ UINT8 m6805Read(UINT16 address)
UINT8 m6805Fetch(UINT16 address)
{
address &= ADDRESS_MASK;
address &= M6805_ADDRESS_MASK;
if (mem[FETCH][address >> PAGE_SHIFT] != NULL) {
return mem[FETCH][address >> PAGE_SHIFT][address & PAGE_MASK];
if (mem[FETCH][address >> M6805_PAGE_SHIFT] != NULL) {
return mem[FETCH][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK];
}
return m6805Read(address);
@ -113,18 +113,18 @@ void m6805_write_rom(UINT32 address, UINT8 data)
if (!DebugCPU_M6805Initted) bprintf(PRINT_ERROR, _T("m6805_write_rom called without init\n"));
#endif
address &= ADDRESS_MASK;
address &= M6805_ADDRESS_MASK;
if (mem[READ][address >> PAGE_SHIFT] != NULL) {
mem[READ][address >> PAGE_SHIFT][address & PAGE_MASK] = data;
if (mem[READ][address >> M6805_PAGE_SHIFT] != NULL) {
mem[READ][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK] = data;
}
if (mem[WRITE][address >> PAGE_SHIFT] != NULL) {
mem[WRITE][address >> PAGE_SHIFT][address & PAGE_MASK] = data;
if (mem[WRITE][address >> M6805_PAGE_SHIFT] != NULL) {
mem[WRITE][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK] = data;
}
if (mem[FETCH][address >> PAGE_SHIFT] != NULL) {
mem[FETCH][address >> PAGE_SHIFT][address & PAGE_MASK] = data;
if (mem[FETCH][address >> M6805_PAGE_SHIFT] != NULL) {
mem[FETCH][address >> M6805_PAGE_SHIFT][address & M6805_PAGE_MASK] = data;
}
if (m6805WriteFunction != NULL) {
@ -149,16 +149,16 @@ void m6805Init(INT32 num, INT32 max)
{
DebugCPU_M6805Initted = 1;
ADDRESS_MAX = max;
ADDRESS_MASK = ADDRESS_MAX - 1;
PAGE = ADDRESS_MAX / 0x100;
PAGE_MASK = PAGE - 1;
PAGE_SHIFT = 0;
for (PAGE_SHIFT = 0; (1 << PAGE_SHIFT) < PAGE; PAGE_SHIFT++) {}
M6805_ADDRESS_MAX = max;
M6805_ADDRESS_MASK = M6805_ADDRESS_MAX - 1;
M6805_PAGE = M6805_ADDRESS_MAX / 0x100;
M6805_PAGE_MASK = M6805_PAGE - 1;
M6805_PAGE_SHIFT = 0;
for (M6805_PAGE_SHIFT = 0; (1 << M6805_PAGE_SHIFT) < M6805_PAGE; M6805_PAGE_SHIFT++) {}
memset (mem[0], 0, PAGE * sizeof(UINT8 *));
memset (mem[1], 0, PAGE * sizeof(UINT8 *));
memset (mem[2], 0, PAGE * sizeof(UINT8 *));
memset (mem[0], 0, M6805_PAGE * sizeof(UINT8 *));
memset (mem[1], 0, M6805_PAGE * sizeof(UINT8 *));
memset (mem[2], 0, M6805_PAGE * sizeof(UINT8 *));
for (INT32 i = 0; i < num; i++)
CpuCheatRegister(i, &M6805Config);
@ -170,11 +170,11 @@ void m6805Exit()
if (!DebugCPU_M6805Initted) bprintf(PRINT_ERROR, _T("m6805Exit called without init\n"));
#endif
ADDRESS_MAX = 0;
ADDRESS_MASK = 0;
PAGE = 0;
PAGE_MASK = 0;
PAGE_SHIFT = 0;
M6805_ADDRESS_MAX = 0;
M6805_ADDRESS_MASK = 0;
M6805_PAGE = 0;
M6805_PAGE_MASK = 0;
M6805_PAGE_SHIFT = 0;
DebugCPU_M6805Initted = 0;
}

View File

@ -1,7 +1,7 @@
#ifndef COMMON
#define COMMON
#include <stdint.h>
#include "burnint.h"
#ifdef __GNUC__
#define ALIGN_DECL(n) __attribute__ ((aligned (n)))

View File

@ -235,7 +235,7 @@ void write_ioreg(cpu_state *cpu, dword addr, word value)
const int reg = (addr >> 4) & 0x1F;
cpu->io_regs[reg] = value;
switch (reg) {
case PSIZE: cpu->pshift = log2(value); break;
case PSIZE: cpu->pshift = log2((double)value); break;
case CONVDP: cpu->convdp = 1 << (~value & 0x1F); break;
case CONVSP: cpu->convsp = 1 << (~value & 0x1F); break;
case INTPEND:

View File

@ -5,7 +5,7 @@
#ifndef TMS34010_H
#define TMS34010_H
#include "stdint.h"
#include "burnint.h"
#include <string>
//#include <list>
//#include <fstream>

View File

@ -5,7 +5,6 @@
#ifndef TMS34010_GFX_H
#define TMS34010_GFX_H
#include <iostream>
#include "tms34010.h"
#include "tms34010_defs.h"
#include "tms34010_memacc.h"