From 2c3ab6becafe959079aa1907375fc4f84cba448b Mon Sep 17 00:00:00 2001 From: clobber Date: Thu, 14 Aug 2014 03:51:51 -0500 Subject: [PATCH] Major clean up Everything seems to be in working order now --- Makefile | 175 +++ O2EM/Docs/LICENSE.TXT | 138 -- O2EM/Docs/O2EM.TXT | 333 ---- O2EM/Docs/changelog.txt | 316 ---- O2EM/README.TXT | 103 -- O2EM/build/Makefile | 111 -- O2EM/build/makefile_common.mk | 16 - O2EM/sources/allegrowrapper/wrapalleg.c | 206 --- O2EM/sources/allegrowrapper/wrapalleg.h | 38 - O2EM/sources/libretro/font2.c | 270 ---- O2EM/sources/libretro/fontmsx.c | 131 -- O2EM/sources/libretro/graph.c | 452 ------ O2EM/sources/libretro/graph.h | 34 - O2EM/sources/libretro/libretro-o2em.c | 211 --- O2EM/sources/libretro/libretro-o2em.h | 44 - O2EM/sources/libretro/libretro.h | 787 ---------- O2EM/sources/libretro/o2em-mapper.c | 296 ---- O2EM/sources/libretro/vkbd.c | 38 - O2EM/sources/libretro/vkbd.h | 5 - O2EM/sources/libretro/vkbd_def.h | 135 -- README.md | 6 + allegrowrapper/wrapalleg.c | 207 +++ allegrowrapper/wrapalleg.h | 56 + libretro.c | 539 +++++++ libretro.h | 1476 ++++++++++++++++++ O2EM/sources/libretro/link.T => link.T | 0 {O2EM/sources/src => src}/Makefile | 0 {O2EM/sources/src => src}/Makefile.djgpp | 0 {O2EM/sources/src => src}/Makefile.freebsd | 0 {O2EM/sources/src => src}/Makefile.linux | 0 {O2EM/sources/src => src}/Makefile.mingw | 0 {O2EM/sources/src => src}/Makefile.win | 0 {O2EM/sources/src => src}/O2EM.ICO | Bin {O2EM/sources/src => src}/O2EM.RC | 0 {O2EM/sources/src => src}/O2EM.RES | Bin {O2EM/sources/src => src}/O2EM116_private.h | 0 {O2EM/sources/src => src}/O2EM116_private.rc | 0 {O2EM/sources/src => src}/O2em118.dev | 0 {O2EM/sources/src => src}/O2em118.layout | 0 {O2EM/sources/src => src}/audio.c | 30 +- {O2EM/sources/src => src}/audio.h | 0 {O2EM/sources/src => src}/config.h | 0 {O2EM/sources/src => src}/cpu.c | 8 +- {O2EM/sources/src => src}/cpu.h | 0 {O2EM/sources/src => src}/crc32.c | 0 {O2EM/sources/src => src}/crc32.h | 0 {O2EM/sources/src => src}/cset.c | 0 {O2EM/sources/src => src}/cset.h | 0 {O2EM/sources/src => src}/debug.c | 6 +- {O2EM/sources/src => src}/debug.h | 0 {O2EM/sources/src => src}/dis48.c | 0 {O2EM/sources/src => src}/keyboard.c | 27 +- {O2EM/sources/src => src}/keyboard.h | 0 {O2EM/sources/src => src}/main.c | 20 +- {O2EM/sources/src => src}/o2em.png | Bin {O2EM/sources/src => src}/score.c | 2 +- {O2EM/sources/src => src}/score.h | 0 {O2EM/sources/src => src}/system.c | 0 {O2EM/sources/src => src}/table.c | 0 {O2EM/sources/src => src}/table.h | 0 {O2EM/sources/src => src}/timefunc.c | 4 +- {O2EM/sources/src => src}/timefunc.h | 0 {O2EM/sources/src => src}/types.h | 0 {O2EM/sources/src => src}/vdc.c | 41 +- {O2EM/sources/src => src}/vdc.h | 0 {O2EM/sources/src => src}/vmachine.c | 14 +- {O2EM/sources/src => src}/vmachine.h | 0 {O2EM/sources/src => src}/voice.c | 18 +- {O2EM/sources/src => src}/voice.h | 0 {O2EM/sources/src => src}/vpp.c | 12 +- {O2EM/sources/src => src}/vpp.h | 0 {O2EM/sources/src => src}/vpp_cset.c | 0 {O2EM/sources/src => src}/vpp_cset.h | 0 73 files changed, 2543 insertions(+), 3762 deletions(-) create mode 100644 Makefile delete mode 100755 O2EM/Docs/LICENSE.TXT delete mode 100755 O2EM/Docs/O2EM.TXT delete mode 100755 O2EM/Docs/changelog.txt delete mode 100644 O2EM/README.TXT delete mode 100755 O2EM/build/Makefile delete mode 100755 O2EM/build/makefile_common.mk delete mode 100755 O2EM/sources/allegrowrapper/wrapalleg.c delete mode 100755 O2EM/sources/allegrowrapper/wrapalleg.h delete mode 100755 O2EM/sources/libretro/font2.c delete mode 100755 O2EM/sources/libretro/fontmsx.c delete mode 100755 O2EM/sources/libretro/graph.c delete mode 100755 O2EM/sources/libretro/graph.h delete mode 100755 O2EM/sources/libretro/libretro-o2em.c delete mode 100755 O2EM/sources/libretro/libretro-o2em.h delete mode 100755 O2EM/sources/libretro/libretro.h delete mode 100755 O2EM/sources/libretro/o2em-mapper.c delete mode 100755 O2EM/sources/libretro/vkbd.c delete mode 100755 O2EM/sources/libretro/vkbd.h delete mode 100755 O2EM/sources/libretro/vkbd_def.h create mode 100644 README.md create mode 100755 allegrowrapper/wrapalleg.c create mode 100755 allegrowrapper/wrapalleg.h create mode 100644 libretro.c create mode 100755 libretro.h rename O2EM/sources/libretro/link.T => link.T (100%) mode change 100755 => 100644 rename {O2EM/sources/src => src}/Makefile (100%) rename {O2EM/sources/src => src}/Makefile.djgpp (100%) rename {O2EM/sources/src => src}/Makefile.freebsd (100%) rename {O2EM/sources/src => src}/Makefile.linux (100%) rename {O2EM/sources/src => src}/Makefile.mingw (100%) rename {O2EM/sources/src => src}/Makefile.win (100%) rename {O2EM/sources/src => src}/O2EM.ICO (100%) rename {O2EM/sources/src => src}/O2EM.RC (100%) rename {O2EM/sources/src => src}/O2EM.RES (100%) rename {O2EM/sources/src => src}/O2EM116_private.h (100%) rename {O2EM/sources/src => src}/O2EM116_private.rc (100%) rename {O2EM/sources/src => src}/O2em118.dev (100%) rename {O2EM/sources/src => src}/O2em118.layout (100%) rename {O2EM/sources/src => src}/audio.c (89%) rename {O2EM/sources/src => src}/audio.h (100%) rename {O2EM/sources/src => src}/config.h (100%) rename {O2EM/sources/src => src}/cpu.c (94%) rename {O2EM/sources/src => src}/cpu.h (100%) rename {O2EM/sources/src => src}/crc32.c (100%) rename {O2EM/sources/src => src}/crc32.h (100%) rename {O2EM/sources/src => src}/cset.c (100%) rename {O2EM/sources/src => src}/cset.h (100%) rename {O2EM/sources/src => src}/debug.c (95%) rename {O2EM/sources/src => src}/debug.h (100%) rename {O2EM/sources/src => src}/dis48.c (100%) rename {O2EM/sources/src => src}/keyboard.c (93%) rename {O2EM/sources/src => src}/keyboard.h (100%) rename {O2EM/sources/src => src}/main.c (99%) mode change 100644 => 100755 rename {O2EM/sources/src => src}/o2em.png (100%) rename {O2EM/sources/src => src}/score.c (95%) rename {O2EM/sources/src => src}/score.h (100%) rename {O2EM/sources/src => src}/system.c (100%) rename {O2EM/sources/src => src}/table.c (100%) rename {O2EM/sources/src => src}/table.h (100%) rename {O2EM/sources/src => src}/timefunc.c (94%) rename {O2EM/sources/src => src}/timefunc.h (100%) rename {O2EM/sources/src => src}/types.h (100%) rename {O2EM/sources/src => src}/vdc.c (94%) rename {O2EM/sources/src => src}/vdc.h (100%) rename {O2EM/sources/src => src}/vmachine.c (95%) rename {O2EM/sources/src => src}/vmachine.h (100%) rename {O2EM/sources/src => src}/voice.c (88%) rename {O2EM/sources/src => src}/voice.h (100%) rename {O2EM/sources/src => src}/vpp.c (94%) rename {O2EM/sources/src => src}/vpp.h (100%) rename {O2EM/sources/src => src}/vpp_cset.c (100%) rename {O2EM/sources/src => src}/vpp_cset.h (100%) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6dca34b --- /dev/null +++ b/Makefile @@ -0,0 +1,175 @@ +DEBUG = 0 + +ifeq ($(platform),) +platform = unix +ifeq ($(shell uname -a),) + platform = win +else ifneq ($(findstring Darwin,$(shell uname -a)),) + platform = osx + arch = intel +ifeq ($(shell uname -p),powerpc) + arch = ppc +endif +else ifneq ($(findstring MINGW,$(shell uname -a)),) + platform = win +endif +endif + +# system platform +system_platform = unix +ifeq ($(shell uname -a),) +EXE_EXT = .exe + system_platform = win +else ifneq ($(findstring Darwin,$(shell uname -a)),) + system_platform = osx + arch = intel +ifeq ($(shell uname -p),powerpc) + arch = ppc +endif +else ifneq ($(findstring MINGW,$(shell uname -a)),) + system_platform = win +endif + +TARGET_NAME := o2em + +ifeq ($(platform), unix) + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC + SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T +else ifeq ($(platform), osx) + TARGET := $(TARGET_NAME)_libretro.dylib + fpic := -fPIC + SHARED := -dynamiclib + +ifeq ($(arch),ppc) + FLAGS += -DMSB_FIRST + OLD_GCC = 1 +endif +OSXVER = `sw_vers -productVersion | cut -c 4` +ifneq ($(OSXVER),9) + fpic += -mmacosx-version-min=10.5 +endif +else ifeq ($(platform), ios) + TARGET := $(TARGET_NAME)_libretro_ios.dylib + fpic := -fPIC + SHARED := -dynamiclib + + CC = clang -arch armv7 -isysroot $(IOSSDK) + CXX = clang++ -arch armv7 -isysroot $(IOSSDK) +OSXVER = `sw_vers -productVersion | cut -c 4` +ifneq ($(OSXVER),9) + SHARED += -miphoneos-version-min=5.0 + CC += -miphoneos-version-min=5.0 + CXX += -miphoneos-version-min=5.0 +endif +else ifeq ($(platform), qnx) + TARGET := $(TARGET_NAME)_libretro_qnx.so + fpic := -fPIC + SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T + CC = qcc -Vgcc_ntoarmv7le + CXX = QCC -Vgcc_ntoarmv7le_cpp +else ifeq ($(platform), ps3) + TARGET := $(TARGET_NAME)_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 + STATIC_LINKING = 1 + FLAGS += -DMSB_FIRST + OLD_GCC = 1 +else ifeq ($(platform), sncps3) + TARGET := $(TARGET_NAME)_libretro_ps3.a + CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe + CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe + AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe + STATIC_LINKING = 1 + FLAGS += -DMSB_FIRST + NO_GCC = 1 +else ifeq ($(platform), psp1) + TARGET := $(TARGET_NAME)_libretro_psp1.a + CC = psp-gcc$(EXE_EXT) + CXX = psp-g++$(EXE_EXT) + AR = psp-ar$(EXE_EXT) + STATIC_LINKING = 1 + FLAGS += -G0 -DLSB_FIRST +else + TARGET := $(TARGET_NAME)_libretro.dll + CC = gcc + CXX = g++ + SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T + LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm +endif +O2EM_DIR := src + +O2EM_SOURCES := $(O2EM_DIR)/audio.c \ + $(O2EM_DIR)/cpu.c \ + $(O2EM_DIR)/crc32.c \ + $(O2EM_DIR)/cset.c \ + $(O2EM_DIR)/debug.c \ + $(O2EM_DIR)/keyboard.c \ + $(O2EM_DIR)/score.c \ + $(O2EM_DIR)/table.c \ + $(O2EM_DIR)/timefunc.c \ + $(O2EM_DIR)/vdc.c \ + $(O2EM_DIR)/vmachine.c \ + $(O2EM_DIR)/voice.c \ + $(O2EM_DIR)/vpp.c \ + $(O2EM_DIR)/vpp_cset.c + +LIBRETRO_SOURCES := libretro.c + +SOURCES_C := allegrowrapper/wrapalleg.c \ + +SOURCES := $(LIBRETRO_SOURCES) $(O2EM_SOURCES) +OBJECTS := $(SOURCES:.c=.o) $(SOURCES_C:.c=.o) + +all: $(TARGET) + +ifeq ($(DEBUG),1) +FLAGS += -O0 -g +else +FLAGS += -O2 -DNDEBUG +endif + +LDFLAGS += $(fpic) -lz $(SHARED) +FLAGS += $(fpic) +FLAGS += -I. -Isrc -Iallegrowrapper + +ifeq ($(OLD_GCC), 1) +WARNINGS := -Wall +else ifeq ($(NO_GCC), 1) +WARNINGS := +else +WARNINGS := -Wall \ + -Wno-narrowing \ + -Wno-sign-compare \ + -Wno-unused-variable \ + -Wno-unused-function \ + -Wno-uninitialized \ + -Wno-unused-result \ + -Wno-strict-aliasing \ + -Wno-overflow \ + -fno-strict-overflow +endif + +FLAGS += -D__LIBRETRO__ $(WARNINGS) + +CXXFLAGS += $(FLAGS) +CFLAGS += $(FLAGS) + +$(TARGET): $(OBJECTS) +ifeq ($(STATIC_LINKING), 1) + $(AR) rcs $@ $(OBJECTS) +else + $(CXX) -o $@ $^ $(LDFLAGS) +endif + +%.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +clean: + rm -f $(TARGET) $(OBJECTS) + +.PHONY: clean diff --git a/O2EM/Docs/LICENSE.TXT b/O2EM/Docs/LICENSE.TXT deleted file mode 100755 index 746eec5..0000000 --- a/O2EM/Docs/LICENSE.TXT +++ /dev/null @@ -1,138 +0,0 @@ - - The Clarified Artistic License - - Preamble - -The intent of this document is to state the conditions under which a -Package may be copied, such that the Copyright Holder maintains some -semblance of artistic control over the development of the package, -while giving the users of the package the right to use and distribute -the Package in a more-or-less customary fashion, plus the right to make -reasonable modifications. - -Definitions: - - "Package" refers to the collection of files distributed by the - Copyright Holder, and derivatives of that collection of files - created through textual modification. - - "Standard Version" refers to such a Package if it has not been - modified, or has been modified in accordance with the wishes - of the Copyright Holder as specified below. - - "Copyright Holder" is whoever is named in the copyright or - copyrights for the package. - - "You" is you, if you're thinking about copying or distributing - this Package. - - "Distribution fee" is a fee you charge for providing a copy - of this Package to another party. - - "Freely Available" means that no fee is charged for the right to - use the item, though there may be fees involved in handling the - item. It also means that recipients of the item may redistribute - it under the same conditions they received it. - -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that you -duplicate all of the original copyright notices and associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications -derived from the Public Domain, or those made Freely Available, or from -the Copyright Holder. A Package modified in such a way shall still be -considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, provided -that you insert a prominent notice in each changed file stating how and -when you changed that file, and provided that you do at least ONE of the -following: - - a) place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet or an - equivalent medium, or placing the modifications on a major network - archive site allowing unrestricted access to them, or by allowing the - Copyright Holder to include your modifications in the Standard Version - of the Package. - - b) use the modified Package only within your corporation or organization. - - c) rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided, and provide - a separate manual page for each non-standard executable that clearly - documents how it differs from the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - - e) permit and encourge anyone who receives a copy of the modified Package - permission to make your modifications Freely Available - in some specific way. - - -4. You may distribute the programs of this Package in object code or -executable form, provided that you do at least ONE of the following: - - a) distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on where - to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), together - with instructions on where to get the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - - e) offer the machine-readable source of the Package, with your - modifications, by mail order. - -5. You may charge a distribution fee for any distribution of this Package. -If you offer support for this Package, you may charge any fee you choose -for that support. You may not charge a license fee for the right to use -this Package itself. You may distribute this Package in aggregate with -other (possibly commercial and possibly nonfree) programs as part of a -larger (possibly commercial and possibly nonfree) software distribution, -and charge license fees for other parts of that software distribution, -provided that you do not advertise this Package as a product of your own. -If the Package includes an interpreter, You may embed this Package's -interpreter within an executable of yours (by linking); this shall be -construed as a mere form of aggregation, provided that the complete -Standard Version of the interpreter is so embedded. - -6. The scripts and library files supplied as input to or produced as -output from the programs of this Package do not automatically fall -under the copyright of this Package, but belong to whoever generated -them, and may be sold commercially, and may be aggregated with this -Package. If such scripts or library files are aggregated with this -Package via the so-called "undump" or "unexec" methods of producing a -binary executable image, then distribution of such an image shall -neither be construed as a distribution of this Package nor shall it -fall under the restrictions of Paragraphs 3 and 4, provided that you do -not represent such an executable image as a Standard Version of this -Package. - -7. C subroutines (or comparably compiled subroutines in other -languages) supplied by you and linked into this Package in order to -emulate subroutines and variables of the language defined by this -Package shall not be considered part of this Package, but are the -equivalent of input as in Paragraph 6, provided these subroutines do -not change the language in any way that would cause it to fail the -regression tests for the language. - -8. Aggregation of the Standard Version of the Package with a commercial -distribution is always permitted provided that the use of this Package -is embedded; that is, when no overt attempt is made to make this Package's -interfaces visible to the end user of the commercial distribution. -Such use shall not be construed as a distribution of this Package. - -9. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End - diff --git a/O2EM/Docs/O2EM.TXT b/O2EM/Docs/O2EM.TXT deleted file mode 100755 index 2dbf2c9..0000000 --- a/O2EM/Docs/O2EM.TXT +++ /dev/null @@ -1,333 +0,0 @@ - - - O2EM v1.18 (Jan/2007) - - an Odyssey 2 & Videopac+ emulator - - copyright 1996/1998 by Daniel Boris - - Developed by Daniel Boris, Andre de la Rocha and Arlindo Oliveira - - This package is released under the - Clarified Artistic License (see license.txt) - - Project Homepage - http://o2em.sourceforge.net - ---------------------------------------------------------------------------- - - -O2EM is an open source Odyssey2 / Videopac console emulator, created by -Daniel Boris in 1996. Since version 0.80 it has been developed by André de -la Rocha and since version 1.16 it has been developed by Arlindo M. de Oliveira. - -This release includes the source code for O2EM v1.18 and binaries for -Windows. The sources probably can also be compiled under other platforms -that support the Allegro game library. The binary version for Linux/X11 and -DOS continues available just until the version 1.16. - -With the Windows binary, the latest stable version of the Allegro DLL is also -included. To use the Linux version you must get the Allegro library for Linux -yourself and install it as root. The DOS version does not need additional -files. - -O2EM is a command line based program, but there are several Windows frontends -you can use. The "official" one is O2EM Launcher, created by Heitor -Barcellos. - -In order to build O2EM from its sources, you need either the MingW or Cygwin -packages on Windows, DJGPP on DOS and GCC on Linux. See the links below. - -The latest version of O2EM can be found at http://o2em.sourceforge.net If you -want to send bug reports, or be part of the O2EM development, go to the O2EM -project page at SourceForge : http://sourceforge.net/projects/o2em/ - - - -Useful links: - -Dan Boris' home page: http://www.atarihq.com/danb/ -Allegro library: http://alleg.sourceforge.net/ -MingW C/C++ compiler: http://sourceforge.net/projects/mingw/ -Soeren Gust page : http://soeren.informationstheater.de/ -Odyssey2 Home: http://www.classicgaming.com/o2home/ -Odysseymania the brazilian webpage : http://odysseymania.classicgaming.com.br -OdysseyBR Group: http://gamesource.groups.yahoo.com/group/OdysseyBR/ -Videopac Forum: http://www.videopac.org - -Acknowledgments: - - -We wish to thank the following people: - - Keita Iida (Keita/Pooka/Fygar) - for his enthusiasm, for the O2EM beta testing, and general encouragement. - - Marco Kerstens (MarcoK) - for providing Videopac schematics, and general support. - - Matthew Pritchard - for sending some official O2 programming documents. - - Bo Krogsgaard (Therion23) - for putting the idea of doing the emulator into my head to start with. - - Jason F. Gohlke - for providing valuable Voice tech info as well as the voice samples. - - Soeren Gust : For sending his patches to O2EM and for technical - information about the console. Part of his technical document was - used to implement VP+ emulation. - - René van den Enden : for providing information about several - unsupported games and other help. - - Simon Scudder : for sending technical information about the O2 - (including the datasheet of the VP+ gfx chipset), sampled sounds and - his nice O2 disassembler. - - Heitor Barcellos : for creating the O2EM Launcher frontend. - - Marcelo Ribeiro : for the icon used with the windows version of O2EM, - bug reports, and for information about O2 games. - - Rafael : for compiling a big list of bugs present in O2EM v0.87. - - Zimmerman : for sending his patch to add key customization, on which - v1.00 customization was based. - - Arlindo de Oliveira : for sending patches to fix bugs in O2EM and for - his interest in keeping the O2 emulation alive. - - The members of the OdysseyBR user group: for several bug reports, as - well for support in general. - ------------------------------------------------------------------------------ - -Quick Setup: - -To get O2EM up and running quickly follow these steps: - -1. Unzip the O2EM archive on your hard drive, that will create the necessary - standard directories: ROMS, BIOS and VOICE into the main directory O2EM118. -2. Download the bios ROM O2ROM.BIN (or G7400.BIN, or C52.BIN, or JOPAC.BIN) - and put it into BIOS directory. -3. Download one or more game ROMs, for example KCMUNCH.BIN for KC Munchkin and - put the ROM in ROMS directory. -4. From the O2EM118 directory type: o2em KCMUNCH.BIN to start the game.If wants - to play KC Munchkin with BIOS VP+, type: o2em KCMUNCH.BIN -g7400 - ---------------------------------------------------------------------------- -Setup: - - Before you can run O2EM you need a copy of the Odyssey2 or Videopac bios -ROM. For copyright reasons, this ROM image can not be included in this -archive. This ROM image is stored inside the 8048 processor and can be read -out with the appropriate equipment. The image should be 1024 bytes long and -should be in the BIOS directory into the main directory O2EM118. - - You will also need cartridge images, but again for copyright reasons -these can not be provided. PLEASE DO NOT E-mail us asking for ROM images! All -messages asking for ROM images will be promptly deleted. - - If you wish to use Voice emulation for games like KC's Krazy Chase. -Download the voice samples and unzip them into the VOICE directory -into the main directory O2EM118. There are two sets of voice samples, -mainsamp.zip which is the main voice samples and sidsamp.zip which are the -samples used by the game Sid the Spellbinder. You only need the Sid samples -if you want voice in that game. - ---------------------------------------------------------------------------- - - -Usage: - - -o2em [options] - - = file to load with extension - - -options: - --help Help display - --wsize=n Window size used by the emulator (1=original, 2=double size, etc.) - --fullscreen Use full screen mode - --scanlines Enable scanlines use by the video emulation. Scanlines are a - feature that makes your display look like a TV screen. - --nosound Turn off sound emulation - --novoice Turn off voice emulation - --svolume=n Set sound volume (0-100) - --vvolume=n Set voice volume (0-100) - --debug Start the emulator in debug mode - --speed=n Relative speed (100 = original speed) - --nolimit Turn off speed limiter - --bios=file Set the file name and directory to find the console - bios. By default it looks for a file named o2rom.bin. - You can use a bios file from an Odyssey2, Videopac or - Videopac+ console. If you want to run VP+ games (in - VP+ mode) then you need a VP+ bios. - --romdir=path Set the directory to find the game rom. By default it - looks for path named .../roms - --biosdir=path Set the directory to find the console bios. By default it - looks for path named .../bios - --o2rom Start the emulator with Odyssey 2 bios (default for most games). - --c52 Start the emulator with french Odyssey 2 bios. - --g7400 Start the emulator with VP+ bios (default for detected VP+ only games). - --jopac Start the emulator with french VP+ bios. - --euro This option enables the use of European timing / 50Hz mode. - This option is usually not needed as most of the games that - really require this mode will be auto-detected. - --filter Enable the low-pass audio filter. - --scshot=file Set the screen shot file name or template. The screen shot - will be saved when you press the F8 key in the emulator. - The extension of the file you give will set the file type. - supported file types are bmp, pcx and tga. You can also give - a template to save several files, using the @ character. - Using an option like -scshot=dump@.bmp will save files with - names like dump00.bmp, dump01.bmp, etc. The pictures will - have a resolution of (320x240)*wsize. - --exrom Enable the use of an alternative ROM mapping for 4Kb games, to - support some games that use a special 3kb program rom/1kb data - ROM mode. The only known that use it are Four in 1 Row and - Musician and both are detected by their CRC and set correctly. - So this option is to be used only with games that are currently - unknown to O2EM. Do not enable it as default, as it will make - all the 4kb games that do not use this special mode crash. - --s0=QUIT,PAUSE,DEBUG,RESET,SCREENCAP,SAVE,LOAD,INJECT_HIGH - These option defines which keys are used for some of the system - keys, if you use this option, you have to enter all 8 keys, to - override the original keys (ESC,F1,F4,F5,F8,F2,F3,F6) - --s1=mode/keys Define stick 1 mode/keys --s2=mode/keys Define stick 2 mode/keys - - These options define how the console joysticks are emulated. - You can use a joystick connected to your computer or use - the keyboard. You can specify a mode number (compatible with - previous versions of O2EM) to disable the joystick emulation, - to select an actual joystick or to set a default keyboard - emulation mode : - 0=Disable, - 1=Default Right keys (arrows keys and right shift) - 2=Default Left keys (W,S,A,D,SPACE) - 3=Joystick - Example: -s1=1 -s2=3 - - You can also specify a list of 5 keyboard codes that will - be used to emulate the joystick, separated by comas - (without spaces), using this order : UP,DOWN,LEFT,RIGHT,FIRE. - The following codes are accepted (not case sensitive): - A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0_PAD,1_PAD,2_PAD,3_PAD,4_PAD,5_PAD,6_PAD,7_PAD,8_PAD,9_PAD, - TILDE, MINUS, EQUALS, BACKSPACE, TAB, OPENBRACE, CLOSEBRACE, - ENTER, COLON, QUOTE, BACKSLASH, BACKSLASH2, COMMA, STOP, - SLASH, SPACE, INSERT, DEL, HOME, END, PGUP, PGDN, LEFT, - RIGHT, UP, DOWN, SLASH_PAD, ASTERISK, MINUS_PAD, PLUS_PAD, - DEL_PAD, ENTER_PAD, PRTSCR, PAUSE, ABNT_C1, YEN, KANA, AT, - CIRCUMFLEX, COLON2, KANJI, LSHIFT, RSHIFT, LCONTROL, - RCONTROL, ALT, ALTGR, LWIN, RWIN, MENU, SCRLOCK, NUMLOCK - Example: -s1=y,h,g,j,lcontrol -s2=8_PAD,5_PAD,4_PAD,6_PAD,RCONTROL - --scoreadr=address where the high-score is saved for specific rom --scoretype=type how the high-score is saved for specific rom --score=highscore default highscore on launch ("inject" with F6) --scorefile=file file where the highscore is saved on exit - --savefile=file filename for save/load state - - - - ----------------------------------------------------------------------------- - -Default configuration file: - -O2EM now can use a configuration file to set the default options, so you can -specify your preferred options in this file, instead of typing it every time -you execute the emulator. The command line options override the default -settings in the file. This file must be called o2em_def.cfg and be in the -same directory of O2EM118. This configuration file is a text file where you can -put the same options you would use when calling O2EM by the command line, but -each option must be in a different line and you should not precede it with -the - character. You can also put comment lines in the file, starting the -line with the # character. Example configuration file: - - # My config - wsize=3 - Euro - scanlines - filter - g7400 - s1=8_pad,5_pad,4_pad,6_pad,rcontrol - - -You disable any option set in this file when you call O2EM in the command -line, passing the =0 parameter to the option. For this example configuration, -you could disable the filter option set in the file putting -filter=0 when -you call O2EM. - - ----------------------------------------------------------------------------- - -Controls: - - Arrow keys + L = Default joystick 1 emulation - - W,D,S,A + Space = Default joystick 2 emulation - - ESC/F12 = Leave the emulator - - F1 = Pause/Information - - F2 = Save State-File - - F3 = Load State-File - - F4 = Enter debugger - - F5 = Reset emulator (same as pressing the reset on the O2 keyboard) - - F6 = Inject Highscore - - F8 = Make a screen shot - - Caps Lock = Enables/Disables the O2 keyboard input of the keys used by - joystick emulation - ----------------------------------------------------------------------------- - -Debugger: - -The emulator comes with a built in debugger that was used for development. -The debugger is not very polished and fairly incomplete but it can be useful -for single stepping through programs and watching their behavior. - -H = display help - ----------------------------------------------------------------------------- - - diff --git a/O2EM/Docs/changelog.txt b/O2EM/Docs/changelog.txt deleted file mode 100755 index 1364647..0000000 --- a/O2EM/Docs/changelog.txt +++ /dev/null @@ -1,316 +0,0 @@ -v1.18: 01/15/2007 - - - added the option -biosdir to define bios directory path - - added the option -romdir to define rom directory path - - added the option -help to help display - - directory search fix : When you don't have the "roms/" and/or "bios/" - directory, the program will dump core (by Walter de Jong). - - O2Launcher works now, o2em ignore roms and bios path if o2Launcher - is running. - - quad display fix: changed the way quad chars are drawn, fixes problems - in KTAA as well as score display in Black Hole and Red Baron (Soeren Gust) - - support for Soerens MegaCART bank switching (Information about - how to use this will be included in the next verison of Soerens - Bios-Documentation) (Soeren Gust) - - new feature in debugger: savevpp to make an uncompressed dump of the VPP - screen and slide data (Soeren Gust) - - dis48: fix to work under linux again (Soeren Gust) - - init_sound volume is not set to maximum (By Gunter Wambaugh) - - added makefile and options for freeBSD (By Gunter Wambaugh) - - Other minor fixes. - - - all the next changes were implemented by Manopac: - - - added the option -s0 to redefine the system keys (see o2em.txt for usage) - - bugfix: highscore-file is only written if scoretype is set - - changed Default Stick 1 key from right to "L" to enable Fire and - movement at the same time - - two joysticks can be used now: first stick in command-line is mapped to joystick 1, - second to joystick 2 (compatible to old command line options) - - changes in debugger: status of registers is now displayed after instructions - are executed - - new features in debugger: savedatah and savedatab to save data from memory - as sourcecode ("db xxx") - - changed Default Stick 1 key from right to "L" to enable Fire - and movement at the same time - - two joysticks can be used now: first stick in command-line is mapped to - joystick 1, second to joystick 2 (compatible to old command line options) - - changes in debugger: status of registers is now displayed after - instructions are executed - - new features in debugger: savedatah and savedatab to save data from memory - as sourcecode ("db xxx") - - removed the limit that KTAA was the only 3K enabled rom (every - rom divideable by 3K is allowed now) - - dis48: added option -bios to disassemble bios (start at address 0) - - dis48: empty line after each page - - new feature to save the highscore in games (F6 to set in game) - - new feature to save/load state (F2/F3) (with command line option savefile) - - new features in debugger: savevdc and saveext to save data from Extram and VDC - - new feature in debugger: viewsprite - - new feature in debugger: bp (breakpoint) - o2em runs with output until - breakpoint is reached (bpc to clear) - - new feature in debugger: so (step over) - runs to next instruction in memory - - more explicit register display (P1 & PSW) - - fixed the "double size sprites are shifted only 1 instead of 2 pixles" bug - - new features in debugger (load / save file, change values in memory, - assemble to memory) - -v1.17: 05/01/2005 - - - BIOS identified by CRC, to activate a specific BIOS type: -o2rom, or - -g7400, or -c52, or -jopac. The old form can be used. See O2EM.txt for more. - - - Automatic identification of BIOS VP+ when the selected game is only VP+. - - - Creation of the standard directories (ROMS, BIOS, VOICE) when uncompressing - O2EM archive. - - - ATLANTIS, FROGGER, COMANDO NOTURNO and CATCH THE BALL now work without - graphic bugs. This correction is based on a specific patch for each game. - Thanks Rafael Cardoso for reports these bugs. - - -V1.16: 12/28/2004 - - - Fixed a slowdown in Pick Axe Pete (based on a patch by Arlindo de - Oliveira). - - - Reverted back to the old palette for O2 games, while using the new - palette for Videpac Plus games (selected based on bios version in use). - - -V1.15: 12/12/2004 - - - Added support for 12kb and 16kb games. Trans American Rally+ works now. - - - Added fixes to the VP+ gfx emulation made by Soeren Gust. Flashpoint - works properly now. - - - Fixed a bug in the Windows-specific emulation timing code that caused - the emulator to crash when run on a Windows machine which was on for a - few days without a reboot. - - - Fixed a bug in the emulation of the DAA instruction, which caused bugs - in the score of several games (Le Tresor Englouti, Cosmic Conflict, etc.). - - - Fixed instruction timings (patch by Soeren) - - - Modified the palette to use values calculated from the Videopac+ RGB - encoder specs by René van den Enden, instead of guessed values. - - - Other minor fixes. - - - -V1.01: 10/23/2002 - - - Major speed optimization. - - - Implemented VDC <-> VP+ collision detection. - - - On the original machines it is possible to make all VDC - colors bright by clearing P17. This affects the background and - dark grid colors. Implemented. Now the Killer Bees! intro screen - works correctly. - - - Fixed the wrong color order when mixing between VP+ and VDC graphics. - Jopac Moto Crash now works. Fixed by Soeren Gust. - - - Now the VBLANK pulse is visible on the T1 input. This can be used - to differentiate between PAL and NTSC. - - - Other minor fixes. - - - -V1.00: 09/12/2002 - - - Implemented complete Videopac+ G7400 emulation. Implemented it from - scratch, based on the EF9340/41 datasheet (sent by Simon Scudder), on - the technical docs made by Soeren Gust and disassembling the VP+ bios. - You will need a Videopac+ bios image file in order to use this feature. - You can use the -bios option to select it, rename the file to o2rom.bin, - or select it in O2EM Launcher settings. Please note that a few O2 games - do not work with the VP+ bios, so most likely you will need both bios - versions to be able to run all the games. For copyright reasons these - files are not included with O2EM, but you can find them in the Internet. - - - Added a default configuration file. Now you can specify your preferred - options in a configuration file, instead of typing it every time you - execute the emulator. The command line options override the default - settings in the file. See O2EM.txt for more. - - - Extended the -s1 and -s2 switches to allow customizable keys with the - joystick emulation. Based on a patch written by Zimmerman that - implemented customizable keys it in a different way. See O2EM.txt for - more. - - - Added support to the Four in 1 Row game. - - - Added the -exrom switch to enable the use of a special ROM mapping mode. - See O2EM.txt for more. - - - Improved the sound with Frogger and Popeye. - - - Minor fixes. - - - -V0.90: 08/07/2002 - - - Fixed the color palette, based on screen shots from a real O2 console. - - - Fixed a bug in the sprite drawing priority. Now in several games the - sprites look better (Demon Attack, Turtles, Atlantis, Computer Golf, - Football, Helicopter Rescue, etc.). - - - Modified the emulation of sprites and characters in the border region of - the screen. Fixed the bug of character wrapping to the other side of the - screen and other problems (Atlantis and others). Now the main characters of - P.T.Barnum's Acrobats! do not fall from the edge of screen. - - - Fixed the audio pitch and implemented white noise emulation. Now - explosions sound much better! - - - Fixed a background line blinking problem that used to affect lots of - games. - - - Fixed the color bar at the left of the screen. - - - Enhanced the support for European/Pal games. Now several games look and - play better. Shark Hunter intro works correctly. Frogger and Depth Charge - are fully playable ! - - - Implemented an audio filter that accurately emulates the behavior of the - low-pass filter present in the audio output of the real console. The sound - is better now. (Enable it with -filter). - - - Fixed the screen size. Now you can see all the graphics in the game, - including the time in Labyrinth. - - - Implemented Dot Grid emulation. Now Marksman is playable. - - - Implemented a cached video emulation, to make it run faster with slow - machines / video cards. - - - Implemented screen shots (use the F8 key and the -scshot option) - - - Implemented the sprite shifted/smooth modes. Now the main character of - Q*bert looks hi-res. - - - Several minor fixes. - - - The following fixes were made by Soeren Gust: - - - - Implemented the missing JNI instruction. - - - Implemented the 1kb data ROM / 3kb program ROM addressing mode used by - Musician. - - - Fixed the height of the grid lines. - - - Added support for 3Kb per bank - - - -V0.87: 06/21/2002 - - - Fixed a collision bug introduced with version 0.86. - Now Cosmic Conflict runs again. Thanks to Dan Boris for reporting - this bug. - - - Implemented the option to set the O2 bios file name/dir, as - requested by my friend Heitor, to enable him to support it with his - nice O2EMLauncher frontend for O2EM 0.8x, as requested by its users. - Get O2EMLauncher here: http://www.odyssey.com.br/o2emlauncher/ - - - -Version 0.86: - - - Fixed a bug in the drawing of quad characters. Now you can play - Q*Bert and Nimble Numbers Ned. Some other games will also have - improved graphics or text (Popeye, Super Cobra, etc.) . - - - Fixed another bug in the collision detection. Now Demon Attack - works correctly. - - - -Version 0.85: - - - Fixed the collision detection. Now you can play Killer Bees! - - - Implemented partial support to mid-screen changes to the VDC - registers without interrupts. Now several games look better, and some - that didn't work can be played, including Power Lords and Super Cobra. - - - Fixed a bug in the video emulation that made some games like Turtles - and Shark Hunter appear with some strange static characters. - - - -Version 0.80: - -The following changes were already implemented by Daniel Boris in version -0.701. Implemented them again in the sources based on version v0.65: - - - Fixed a bug in the CPU core related to the handling of branch - instructions near page boundaries. (Without it Sid the Spellbinder - crashed after the first level). - - - CPU core now jumps to the correct address on an external interrupt. - Killer Bees runs again. - - - Fixed shape of '$' character and added missing 64th character to - character set (ripped the correct character data from the v0.701 - executable file). - - - Fixed bug in drawing of bottom grid line. - - - Added Voice support. Re implemented it from scratch, based on O2 - technical specs released by Dan Boris and disassembling Smithereens - and Turtles (now it always work with Turtles). - -The following changes are new to version 0.80: - - - Updated the code to compile with Allegro 4.0.x and to work - without changes under Windows, Linux and DOS, with optimizations - for each. - - - Implemented the option of windowed or fullscreen video modes, - with scaling, centering and optional 50% scanlines. - - - Cleaned the code to make it more portable and maintainable. - - - Improved timing, using the most accurate way available for - each platform. - - - Fixed the keyboard scan code translation table. - - - Fixed and improved the built-in debugger. - - - Fixed the reset. It now works with Turtles. - - - Fixed joystick detection code. - - - Implemented variable speed control relative to original O2. - - - Implemented individual volume control for sounds and voice. - - - Implemented Pause/Information (F1). - - - Avoided collision of keyboard input with key joystick - emulation. Now Caps Lock enables/disables the W,D,S,A,Space keys - for keyboard input when they are used by joystick emulation. - Works well with games like K.C.'s Krazy Chase. - - - It now releases more CPU time to the system (if possible). - - - Other minor changes/fixes. - - - diff --git a/O2EM/README.TXT b/O2EM/README.TXT deleted file mode 100644 index 704adf5..0000000 --- a/O2EM/README.TXT +++ /dev/null @@ -1,103 +0,0 @@ - - O2EM v1.18 (Jan/2007) - - an Odyssey 2 & Videopac+ emulator - - copyright 1996/1998 by Daniel Boris - - Developed by Daniel Boris, Andre de la Rocha and Arlindo Oliveira - - This package is released under the - Clarified Artistic License (see license.txt) - - Project Homepage - http://o2em.sourceforge.net - ---------------------------------------------------------------------------- - - -WIP Libretro port , see original O2EM.TXT in Docs directory. - -Very WIP and very bad quick hack to port O2EM to libretro. -Voice are not supported for now , sound is risky and screenshot not implemented . -At this time , works the basis but buggy on linux /android. - -Remember ,Everything not working well, It's a debug release , so expect to more bug. - - ---------------------------------------------------------------------------- - - -1) build - - cd build - make "platform=android" or make "platform=unix" - - -2) Install - - put bios/ and roms/ in : - - /mnt/sdcard/O2EM/ for android - - ./build for unix - - launch retroarch ,select game ... - -3) Usage - - L2 show/hide Statut - R2 swap kbd pages - L show/hide vkbd - R switch Shift ON/OFF - SEL EMU KSPACE - STR EMU KRETURN - A fire/valid key in vkbd - B EMU KL - X EMU K0 - Y EMU K1 - - - VKBD : - - PAGE 1 - - 0 1 2 3 4 5 6 7 8 9 - - + - * / = yes no clear enter VKBD PG2 - - q w e r t y u i o p - - a s d f g h j k l SOUND OFF/ON - - z x c v b n m . ? SPACE - - - PAGE 2 - - 0 1 2 3 4 5 6 7 8 9 - - Quit Pause Reset SShot Save Load Score KBDCol VKBD VKBD PG1 - - q w e r t y u i o p - - a s d f g h j k l SOUND OFF/ON - - z x c v b n m . ? SPACE - - ---------------------------------------------------------------------------- - -Credits: - - -an Odyssey 2 & Videopac+ emulator -copyright 1996/1998 by Daniel Boris -Developed by Daniel Boris, Andre de la Rocha and Arlindo Oliveira - -You can download the O2EM source code here : http://o2em.sourceforge.net - - -RetroArch/Libretro team : http://www.libretro.com - - diff --git a/O2EM/build/Makefile b/O2EM/build/Makefile deleted file mode 100755 index 1b1303a..0000000 --- a/O2EM/build/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -DEBUG := 0 - -include ./makefile_common.mk - -ifeq ($(platform),) -platform = unix -ifeq ($(shell uname -a),) - platform = win -else ifneq ($(findstring MINGW,$(shell uname -a)),) - platform = win -else ifneq ($(findstring Darwin,$(shell uname -a)),) - platform = osx -else ifneq ($(findstring win,$(shell uname -a)),) - platform = win -endif -endif - -ifeq ($(platform), android) - CC = arm-linux-androideabi-gcc - AR = @arm-linux-androideabi-ar - LD = @arm-linux-androideabi-g++ - TARGET := libretro-o2em.so - fpic := -fPIC - SHARED := -Wl,--fix-cortex-a8 -llog -lz -shared -Wl,--version-script=$(LIBRETRO)/link.T -Wl,--no-undefined - PLATFLAGS := -DRETRO -DAND -DLSB_FIRST -DALIGN_DWORD -D__LIBRETRO__ -else ifeq ($(platform), unix) - CC = gcc - TARGET := libretro-o2em.so - fpic := -fPIC - SHARED := -shared -Wl,--version-script=$(LIBRETRO)/link.T -Wl,--no-undefined - PLATFLAGS := -DRETRO -DLSB_FIRST -DALIGN_DWORD -D__LIBRETRO__ -else ifeq ($(platform), osx) - TARGET := libretro.dylib - fpic := -fPIC - SHARED := -dynamiclib - PLATFLAGS := -DRETRO -DLSB_FIRST -DALIGN_DWORD -D__LIBRETRO__ -else ifeq ($(platform), wii) - TARGET := hatari_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) - ZLIB_DIR = ../sources/utils/zlib/ - ZLIB_OBJECTS := $(ZLIB_DIR)adler32.o $(ZLIB_DIR)compress.o $(ZLIB_DIR)crc32.o $(ZLIB_DIR)deflate.o \ - $(ZLIB_DIR)gzclose.o $(ZLIB_DIR)gzlib.o $(ZLIB_DIR)gzread.o\ - $(ZLIB_DIR)gzwrite.o $(ZLIB_DIR)infback.o $(ZLIB_DIR)inffast.o $(ZLIB_DIR)inflate.o \ - $(ZLIB_DIR)trees.o $(ZLIB_DIR)inftrees.o $(ZLIB_DIR)uncompr.o $(ZLIB_DIR)uncompr.o $(ZLIB_DIR)zutil.o - 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__ - SHARED := -lm -lpthread -lc - PLATFLAGS := -DRETRO -DALIGN_DWORD -DWIIPORT -else ifeq ($(platform), ps3) - TARGET := hatari_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 - ZLIB_DIR = ../sources/utils/zlib/ - ZLIB_OBJECTS := $(ZLIB_DIR)adler32.o $(ZLIB_DIR)compress.o $(ZLIB_DIR)crc32.o $(ZLIB_DIR)deflate.o \ - $(ZLIB_DIR)gzclose.o $(ZLIB_DIR)gzlib.o $(ZLIB_DIR)gzread.o\ - $(ZLIB_DIR)gzwrite.o $(ZLIB_DIR)infback.o $(ZLIB_DIR)inffast.o $(ZLIB_DIR)inflate.o \ - $(ZLIB_DIR)trees.o $(ZLIB_DIR)inftrees.o $(ZLIB_DIR)uncompr.o $(ZLIB_DIR)uncompr.o $(ZLIB_DIR)zutil.o - SHARED := -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 -else - CC = i586-mingw32msvc-gcc -#x86_64-w64-mingw32-gcc - PLATFLAGS := -DRETRO -DLSB_FIRST -DALIGN_DWORD -DWIN32PORT -DWIN32 - TARGET := retro-hatari.dll - SHARED := -shared -static-libgcc -s -Wl,--version-script=$(LIBRETRO)/link.T -Wl,--no-undefined -endif - -ifeq ($(DEBUG), 1) - CFLAGS += -O0 -g -else - CFLAGS += -O3 -endif - -CFLAGS += $(SHARED) $(fpic) \ - -std=gnu99 -finline-functions -funroll-loops -fsigned-char \ - -Wno-strict-prototypes -ffast-math -fomit-frame-pointer -fno-strength-reduce -fno-builtin -finline-functions -s - -CXXFLAGS += $(CFLAGS) -std=gnu++0x -CPPFLAGS += $(CFLAGS) - -all: $(TARGET) - -ifeq ($(platform), wii) -$(TARGET): $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) -else ifeq ($(platform), ps3) -$(TARGET): $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) -else ifeq ($(platform), win) -$(TARGET): $(OBJECTS) - $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm -lz -else -$(TARGET): $(OBJECTS) - $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm - -endif - -%.o: %.c - $(CC) $(CFLAGS) $(PLATFLAGS) $(HINCLUDES) -c -o $@ $< - -clean: - rm -f $(OBJECTS) $(TARGET) - -.PHONY: clean - diff --git a/O2EM/build/makefile_common.mk b/O2EM/build/makefile_common.mk deleted file mode 100755 index ce7ee53..0000000 --- a/O2EM/build/makefile_common.mk +++ /dev/null @@ -1,16 +0,0 @@ -EMU = ../sources/src -LIBRETRO = ../sources/libretro -WALLEGRO = ../sources/allegrowrapper - -CORE_SRCS = $(EMU)/audio.o $(EMU)/cpu.o $(EMU)/cset.o $(EMU)/keyboard.o $(EMU)/main.o $(EMU)/table.o $(EMU)/vdc.o \ -$(EMU)/vmachine.o $(EMU)/debug.o $(EMU)/timefunc.o $(EMU)/voice.o $(EMU)/crc32.o $(EMU)/vpp_cset.o $(EMU)/vpp.o $(EMU)/score.o - -BUILD_APP = $(ZLIB_OBJECTS) $(CORE_SRCS) - -HINCLUDES := -I./$(EMU) -I$(LIBRETRO) -I$(WALLEGRO) - -OBJECTS := $(BUILD_APP) $(WALLEGRO)/wrapalleg.o $(LIBRETRO)/libretro-o2em.o $(LIBRETRO)/o2em-mapper.o $(LIBRETRO)/vkbd.o \ - $(LIBRETRO)/graph.o $(LIBRETRO)/fontmsx.o \ - - - diff --git a/O2EM/sources/allegrowrapper/wrapalleg.c b/O2EM/sources/allegrowrapper/wrapalleg.c deleted file mode 100755 index ce4f221..0000000 --- a/O2EM/sources/allegrowrapper/wrapalleg.c +++ /dev/null @@ -1,206 +0,0 @@ - -#include "wrapalleg.h" - -#include -#include -#define abs(a) miabs(a) - -int miabs(int a){ - if((a)<0)a=-a; - return a; -} - -void upcase(char *p) -{ - while(*p != '\0') - { - if(*p >= 97 && *p <= 122) - *p -= 32; - ++p; - } -} -void downcase(char *p) -{ - while(*p != '\0') - { - if(*p >= 97-32 && *p <= 122-32) - *p += 32; - ++p; - } -} - -void clear(BITMAP *buff){ - - memset(&buff->line,0,buff->w*buff->h); -} - -BITMAP *create_bitmap(int w,int h){ - - BITMAP *buff; - - buff = malloc(sizeof (BITMAP)); - buff->line=malloc(1*w*h); - - buff->w=w; - buff->h=h; - buff->pitch=w; - buff->depth=1; - - return buff; -} - -int destroy_bitmap(BITMAP *buff){ - - if (buff->line) { - free(buff->line); - } - free(buff); - - return 0; -} - - -void rect(BITMAP *buff,int x,int y,int x2,int y2,unsigned char color){ - - int i,j,idx; - - int dx= abs(x2-x); - int dy= abs(y2-y); - int V_WIDTH = buff->w; - unsigned char *buffer=buff->line[0]; - - for(i=x;iw; - unsigned char *buffer=buff->line[0]; - - for(i=x;iw; - unsigned char *buffer=buff->line[0]; - - for(i=x;iw; - unsigned char *buffer=buff->line[0]; - - for(j=y;jw; - unsigned char *buffer=buff->line[0]; - - dx = x2 - x1; - dy = y2 - y1; - sx = (dx >= 0) ? 1 : -1; - sy = (dy >= 0) ? 1 : -1; - - if (dx==0) { - if (dy>0) { - DrawVline(buff, x1, y1,0, dy, color); - return; - - } else if (dy<0) { - DrawVline(buff, x1, y2,0, -dy, color); - return; - - } else { - idx=x1+y1*V_WIDTH; - buffer[idx]=color; - return ; - } - } - if (dy == 0) { - if (dx>0) { - DrawHline(buff, x1, y1, dx, 0, color); - return; - - } else if (dx<0) { - DrawHline(buff, x2, y1, -dx,0, color); - return; - } - } - - dx = sx * dx + 1; - dy = sy * dy + 1; - - pixx = 1; - pixy = V_WIDTH; - - pixx *= sx; - pixy *= sy; - - if (dx < dy) { - swaptmp = dx; - dx = dy; - dy = swaptmp; - swaptmp = pixx; - pixx = pixy; - pixy = swaptmp; - } - - x = 0; - y = 0; - - idx=x1+y1*V_WIDTH; - - for (; x < dx; x++, idx +=pixx) { - buffer[idx]=color; - y += dy; - if (y >= dx) { - y -= dx; - idx += pixy; - } - } - -} diff --git a/O2EM/sources/allegrowrapper/wrapalleg.h b/O2EM/sources/allegrowrapper/wrapalleg.h deleted file mode 100755 index ef2ee46..0000000 --- a/O2EM/sources/allegrowrapper/wrapalleg.h +++ /dev/null @@ -1,38 +0,0 @@ - -#ifndef WRAP_H -#define WRAP_H 1 - -#define INLINE static inline -#define rest(a) usleep(a) -#define strupr upcase -#define strlwr downcase -#define keypressed() 0 -#define poll_keyboard() -#define yield_timeslice() - -typedef struct -{ - unsigned char *line; - int w; - int h; - int pitch; - int depth; - -}BITMAP; - -typedef struct -{ - unsigned char r; - unsigned char g; - unsigned char b; -}APALETTE; - - - -extern unsigned char key[256*2]; - -#define INLINE static inline - - -#endif - diff --git a/O2EM/sources/libretro/font2.c b/O2EM/sources/libretro/font2.c deleted file mode 100755 index d1868a7..0000000 --- a/O2EM/sources/libretro/font2.c +++ /dev/null @@ -1,270 +0,0 @@ -/****************************************************************/ -/* Apple IIgs emulator */ -/* */ -/* Apple 2GS Original fonts. */ -/* All the characters are coded in their original set. */ -/* Only the USA keyboard is recognized with ROM 01. */ -/* */ -/****************************************************************/ - -unsigned char font_array[256*8] -= { -0xc7, 0xbb, 0xab, 0xa3, 0xa7, 0xbf, 0xc3, 0xff, -0xef, 0xd7, 0xbb, 0xbb, 0x83, 0xbb, 0xbb, 0xff, -0x87, 0xbb, 0xbb, 0x87, 0xbb, 0xbb, 0x87, 0xff, -0xc7, 0xbb, 0xbf, 0xbf, 0xbf, 0xbb, 0xc7, 0xff, -0x87, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0x87, 0xff, -0x83, 0xbf, 0xbf, 0x87, 0xbf, 0xbf, 0x83, 0xff, -0x83, 0xbf, 0xbf, 0x87, 0xbf, 0xbf, 0xbf, 0xff, -0xc3, 0xbf, 0xbf, 0xbf, 0xb3, 0xbb, 0xc3, 0xff, -0xbb, 0xbb, 0xbb, 0x83, 0xbb, 0xbb, 0xbb, 0xff, -0xc7, 0xef, 0xef, 0xef, 0xef, 0xef, 0xc7, 0xff, -0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xbb, 0xc7, 0xff, -0xbb, 0xb7, 0xaf, 0x9f, 0xaf, 0xb7, 0xbb, 0xff, -0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x83, 0xff, -0xbb, 0x93, 0xab, 0xab, 0xbb, 0xbb, 0xbb, 0xff, -0xbb, 0xbb, 0x9b, 0xab, 0xb3, 0xbb, 0xbb, 0xff, -0xc7, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xc7, 0xff, -0x87, 0xbb, 0xbb, 0x87, 0xbf, 0xbf, 0xbf, 0xff, -0xc7, 0xbb, 0xbb, 0xbb, 0xab, 0xb7, 0xcb, 0xff, -0x87, 0xbb, 0xbb, 0x87, 0xaf, 0xb7, 0xbb, 0xff, -0xc7, 0xbb, 0xbf, 0xc7, 0xfb, 0xbb, 0xc7, 0xff, -0x83, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xff, -0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xc7, 0xff, -0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xd7, 0xef, 0xff, -0xbb, 0xbb, 0xbb, 0xab, 0xab, 0x93, 0xbb, 0xff, -0xbb, 0xbb, 0xd7, 0xef, 0xd7, 0xbb, 0xbb, 0xff, -0xbb, 0xbb, 0xd7, 0xef, 0xef, 0xef, 0xef, 0xff, -0x83, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x83, 0xff, -0x83, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x83, 0xff, -0xff, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xff, 0xff, -0x83, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0x83, 0xff, -0xff, 0xff, 0xef, 0xd7, 0xbb, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xef, 0xef, 0xef, 0xef, 0xef, 0xff, 0xef, 0xff, -0xd7, 0xd7, 0xd7, 0xff, 0xff, 0xff, 0xff, 0xff, -0xd7, 0xd7, 0x83, 0xd7, 0x83, 0xd7, 0xd7, 0xff, -0xef, 0xc3, 0xaf, 0xc7, 0xeb, 0x87, 0xef, 0xff, -0x9f, 0x9b, 0xf7, 0xef, 0xdf, 0xb3, 0xf3, 0xff, -0xdf, 0xaf, 0xaf, 0xdf, 0xab, 0xb7, 0xcb, 0xff, -0xef, 0xef, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, -0xef, 0xdf, 0xbf, 0xbf, 0xbf, 0xdf, 0xef, 0xff, -0xef, 0xf7, 0xfb, 0xfb, 0xfb, 0xf7, 0xef, 0xff, -0xef, 0xab, 0xc7, 0xef, 0xc7, 0xab, 0xef, 0xff, -0xff, 0xef, 0xef, 0x83, 0xef, 0xef, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xef, 0xef, 0xdf, 0xff, -0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, -0xff, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0xff, 0xff, -0xc7, 0xbb, 0xb3, 0xab, 0x9b, 0xbb, 0xc7, 0xff, -0xef, 0xcf, 0xef, 0xef, 0xef, 0xef, 0xc7, 0xff, -0xc7, 0xbb, 0xfb, 0xe7, 0xdf, 0xbf, 0x83, 0xff, -0x83, 0xfb, 0xf7, 0xe7, 0xfb, 0xbb, 0xc7, 0xff, -0xf7, 0xe7, 0xd7, 0xb7, 0x83, 0xf7, 0xf7, 0xff, -0x83, 0xbf, 0x87, 0xfb, 0xfb, 0xbb, 0xc7, 0xff, -0xe3, 0xdf, 0xbf, 0x87, 0xbb, 0xbb, 0xc7, 0xff, -0x83, 0xfb, 0xf7, 0xef, 0xdf, 0xdf, 0xdf, 0xff, -0xc7, 0xbb, 0xbb, 0xc7, 0xbb, 0xbb, 0xc7, 0xff, -0xc7, 0xbb, 0xbb, 0xc3, 0xfb, 0xf7, 0x8f, 0xff, -0xff, 0xff, 0xef, 0xff, 0xef, 0xff, 0xff, 0xff, -0xff, 0xff, 0xef, 0xff, 0xef, 0xef, 0xdf, 0xff, -0xf7, 0xef, 0xdf, 0xbf, 0xdf, 0xef, 0xf7, 0xff, -0xff, 0xff, 0x83, 0xff, 0x83, 0xff, 0xff, 0xff, -0xdf, 0xef, 0xf7, 0xfb, 0xf7, 0xef, 0xdf, 0xff, -0xc7, 0xbb, 0xf7, 0xef, 0xef, 0xff, 0xef, 0xff, -0x08, 0x10, 0x6c, 0xfe, 0xfc, 0xfc, 0x7e, 0x6c, -0x08, 0x10, 0x6c, 0x82, 0x84, 0x84, 0x52, 0x6c, -0x00, 0x00, 0x40, 0x60, 0x70, 0x78, 0x6c, 0x42, -0xfe, 0x44, 0x28, 0x10, 0x10, 0x28, 0x54, 0xfe, -0x00, 0x02, 0x04, 0x88, 0x50, 0x20, 0x20, 0x00, -0xfe, 0xfc, 0xfa, 0x36, 0xae, 0xde, 0xde, 0xfe, -0xfc, 0xfc, 0xfc, 0xdc, 0x9c, 0x00, 0x9e, 0xde, -0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0xfe, -0x10, 0x20, 0x40, 0xfe, 0x40, 0x20, 0x10, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, -0x10, 0x10, 0x10, 0x10, 0x92, 0x54, 0x38, 0x10, -0x10, 0x38, 0x54, 0x92, 0x10, 0x10, 0x10, 0x10, -0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x02, 0x02, 0x22, 0x62, 0xfe, 0x60, 0x20, -0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, -0xc8, 0x18, 0x38, 0x7e, 0x38, 0x18, 0x08, 0xf6, -0x26, 0x30, 0x38, 0xfc, 0x38, 0x30, 0x20, 0xde, -0x02, 0x12, 0x10, 0xfe, 0x7c, 0x38, 0x12, 0x02, -0x02, 0x12, 0x38, 0x7c, 0xfe, 0x10, 0x12, 0x02, -0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, -0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, -0x10, 0x08, 0x04, 0xfe, 0x04, 0x08, 0x10, 0x00, -0x54, 0xaa, 0x54, 0xaa, 0x54, 0xaa, 0x54, 0xaa, -0xaa, 0x54, 0xaa, 0x54, 0xaa, 0x54, 0xaa, 0x54, -0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0xfe, 0x00, -0x00, 0x00, 0xfc, 0x02, 0x02, 0x02, 0xfe, 0x00, -0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, -0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, -0x28, 0x28, 0xee, 0x00, 0xee, 0x28, 0x28, 0x00, -0xfe, 0x02, 0x02, 0x32, 0x32, 0x02, 0x02, 0xfe, -0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -0xdf, 0xef, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xc7, 0xfb, 0xc3, 0xbb, 0xc3, 0xff, -0xbf, 0xbf, 0x87, 0xbb, 0xbb, 0xbb, 0x87, 0xff, -0xff, 0xff, 0xc3, 0xbf, 0xbf, 0xbf, 0xc3, 0xff, -0xfb, 0xfb, 0xc3, 0xbb, 0xbb, 0xbb, 0xc3, 0xff, -0xff, 0xff, 0xc7, 0xbb, 0x83, 0xbf, 0xc3, 0xff, -0xe7, 0xdb, 0xdf, 0x87, 0xdf, 0xdf, 0xdf, 0xff, -0xff, 0xff, 0xc7, 0xbb, 0xbb, 0xc3, 0xfb, 0xc7, -0xbf, 0xbf, 0x87, 0xbb, 0xbb, 0xbb, 0xbb, 0xff, -0xef, 0xff, 0xcf, 0xef, 0xef, 0xef, 0xc7, 0xff, -0xf7, 0xff, 0xe7, 0xf7, 0xf7, 0xf7, 0xb7, 0xcf, -0xbf, 0xbf, 0xbb, 0xb7, 0x8f, 0xb7, 0xbb, 0xff, -0xcf, 0xef, 0xef, 0xef, 0xef, 0xef, 0xc7, 0xff, -0xff, 0xff, 0x93, 0xab, 0xab, 0xab, 0xbb, 0xff, -0xff, 0xff, 0x87, 0xbb, 0xbb, 0xbb, 0xbb, 0xff, -0xff, 0xff, 0xc7, 0xbb, 0xbb, 0xbb, 0xc7, 0xff, -0xff, 0xff, 0x87, 0xbb, 0xbb, 0x87, 0xbf, 0xbf, -0xff, 0xff, 0xc3, 0xbb, 0xbb, 0xc3, 0xfb, 0xfb, -0xff, 0xff, 0xa3, 0x9f, 0xbf, 0xbf, 0xbf, 0xff, -0xff, 0xff, 0xc3, 0xbf, 0xc7, 0xfb, 0x87, 0xff, -0xdf, 0xdf, 0x87, 0xdf, 0xdf, 0xdb, 0xe7, 0xff, -0xff, 0xff, 0xbb, 0xbb, 0xbb, 0xb3, 0xcb, 0xff, -0xff, 0xff, 0xbb, 0xbb, 0xbb, 0xd7, 0xef, 0xff, -0xff, 0xff, 0xbb, 0xbb, 0xab, 0xab, 0x93, 0xff, -0xff, 0xff, 0xbb, 0xd7, 0xef, 0xd7, 0xbb, 0xff, -0xff, 0xff, 0xbb, 0xbb, 0xbb, 0xc3, 0xfb, 0xc7, -0xff, 0xff, 0x83, 0xf7, 0xef, 0xdf, 0x83, 0xff, -0xe3, 0xcf, 0xcf, 0x9f, 0xcf, 0xcf, 0xe3, 0xff, -0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, -0x8f, 0xe7, 0xe7, 0xf3, 0xe7, 0xe7, 0x8f, 0xff, -0xcb, 0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xab, 0xd7, 0xab, 0xd7, 0xab, 0xff, 0xff, -0x38, 0x44, 0x54, 0x5c, 0x58, 0x40, 0x3c, 0x00, -0x10, 0x28, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x00, -0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x78, 0x00, -0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, -0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, -0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7c, 0x00, -0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x00, -0x3c, 0x40, 0x40, 0x40, 0x4c, 0x44, 0x3c, 0x00, -0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x00, -0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, -0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, -0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, -0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, -0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, -0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x00, -0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, -0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, -0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, -0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, -0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, -0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, -0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, -0x44, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, -0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, -0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, -0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, -0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, 0x00, -0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x00, -0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, -0x7c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, -0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, -0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, -0x28, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x28, 0x00, -0x10, 0x3c, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, -0x60, 0x64, 0x08, 0x10, 0x20, 0x4c, 0x0c, 0x00, -0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, -0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, -0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00, -0x10, 0x08, 0x04, 0x04, 0x04, 0x08, 0x10, 0x00, -0x10, 0x54, 0x38, 0x10, 0x38, 0x54, 0x10, 0x00, -0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, -0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, -0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, -0x38, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x38, 0x00, -0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, -0x38, 0x44, 0x04, 0x18, 0x20, 0x40, 0x7c, 0x00, -0x7c, 0x04, 0x08, 0x18, 0x04, 0x44, 0x38, 0x00, -0x08, 0x18, 0x28, 0x48, 0x7c, 0x08, 0x08, 0x00, -0x7c, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, -0x1c, 0x20, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, -0x7c, 0x04, 0x08, 0x10, 0x20, 0x20, 0x20, 0x00, -0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, -0x38, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x70, 0x00, -0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, -0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x20, 0x00, -0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, -0x00, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x00, 0x00, -0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, -0x38, 0x44, 0x08, 0x10, 0x10, 0x00, 0x10, 0x00, -0x38, 0x44, 0x54, 0x5c, 0x58, 0x40, 0x3c, 0x00, -0x10, 0x28, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x00, -0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x78, 0x00, -0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, -0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, -0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7c, 0x00, -0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x00, -0x3c, 0x40, 0x40, 0x40, 0x4c, 0x44, 0x3c, 0x00, -0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x00, -0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, -0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, -0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, -0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, -0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, -0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x00, -0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, -0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, -0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, -0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, -0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, -0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, -0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, -0x44, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, -0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, -0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, -0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, -0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, 0x00, -0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x00, -0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, -0x7c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, -0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, -0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, -0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, -0x00, 0x00, 0x3c, 0x40, 0x40, 0x40, 0x3c, 0x00, -0x04, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x3c, 0x00, -0x00, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, -0x18, 0x24, 0x20, 0x78, 0x20, 0x20, 0x20, 0x00, -0x00, 0x00, 0x38, 0x44, 0x44, 0x3c, 0x04, 0x38, -0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, -0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, -0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x48, 0x30, -0x40, 0x40, 0x44, 0x48, 0x70, 0x48, 0x44, 0x00, -0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, -0x00, 0x00, 0x6c, 0x54, 0x54, 0x54, 0x44, 0x00, -0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, -0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, -0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, -0x00, 0x00, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x04, -0x00, 0x00, 0x5c, 0x60, 0x40, 0x40, 0x40, 0x00, -0x00, 0x00, 0x3c, 0x40, 0x38, 0x04, 0x78, 0x00, -0x20, 0x20, 0x78, 0x20, 0x20, 0x24, 0x18, 0x00, -0x00, 0x00, 0x44, 0x44, 0x44, 0x4c, 0x34, 0x00, -0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, -0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x00, -0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, -0x00, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x38, -0x00, 0x00, 0x7c, 0x08, 0x10, 0x20, 0x7c, 0x00, -0x1c, 0x30, 0x30, 0x60, 0x30, 0x30, 0x1c, 0x00, -0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, -0x70, 0x18, 0x18, 0x0c, 0x18, 0x18, 0x70, 0x00, -0x34, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x54, 0x28, 0x54, 0x28, 0x54, 0x00, 0x00, -}; - -/* Well, this is finally done ! */ diff --git a/O2EM/sources/libretro/fontmsx.c b/O2EM/sources/libretro/fontmsx.c deleted file mode 100755 index 86f9e64..0000000 --- a/O2EM/sources/libretro/fontmsx.c +++ /dev/null @@ -1,131 +0,0 @@ - -unsigned char msx[]= -"\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x42\xa5\x81\xa5\x99\x42\x3c" -"\x3c\x7e\xdb\xff\xff\xdb\x66\x3c\x6c\xfe\xfe\xfe\x7c\x38\x10\x00" -"\x10\x38\x7c\xfe\x7c\x38\x10\x00\x10\x38\x54\xfe\x54\x10\x38\x00" -"\x10\x38\x7c\xfe\xfe\x10\x38\x00\x00\x00\x00\x30\x30\x00\x00\x00" -"\xff\xff\xff\xe7\xe7\xff\xff\xff\x38\x44\x82\x82\x82\x44\x38\x00" -"\xc7\xbb\x7d\x7d\x7d\xbb\xc7\xff\x0f\x03\x05\x79\x88\x88\x88\x70" -"\x38\x44\x44\x44\x38\x10\x7c\x10\x30\x28\x24\x24\x28\x20\xe0\xc0" -"\x3c\x24\x3c\x24\x24\xe4\xdc\x18\x10\x54\x38\xee\x38\x54\x10\x00" -"\x10\x10\x10\x7c\x10\x10\x10\x10\x10\x10\x10\xff\x00\x00\x00\x00" -"\x00\x00\x00\xff\x10\x10\x10\x10\x10\x10\x10\xf0\x10\x10\x10\x10" -"\x10\x10\x10\x1f\x10\x10\x10\x10\x10\x10\x10\xff\x10\x10\x10\x10" -"\x10\x10\x10\x10\x10\x10\x10\x10\x00\x00\x00\xff\x00\x00\x00\x00" -"\x00\x00\x00\x1f\x10\x10\x10\x10\x00\x00\x00\xf0\x10\x10\x10\x10" -"\x10\x10\x10\x1f\x00\x00\x00\x00\x10\x10\x10\xf0\x00\x00\x00\x00" -"\x81\x42\x24\x18\x18\x24\x42\x81\x01\x02\x04\x08\x10\x20\x40\x80" -"\x80\x40\x20\x10\x08\x04\x02\x01\x00\x10\x10\xff\x10\x10\x00\x00" -"\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20\x20\x20\x00\x00\x20\x00" -"\x50\x50\x50\x00\x00\x00\x00\x00\x50\x50\xf8\x50\xf8\x50\x50\x00" -"\x20\x78\xa0\x70\x28\xf0\x20\x00\xc0\xc8\x10\x20\x40\x98\x18\x00" -"\x40\xa0\x40\xa8\x90\x98\x60\x00\x10\x20\x40\x00\x00\x00\x00\x00" -"\x10\x20\x40\x40\x40\x20\x10\x00\x40\x20\x10\x10\x10\x20\x40\x00" -"\x20\xa8\x70\x20\x70\xa8\x20\x00\x00\x20\x20\xf8\x20\x20\x00\x00" -"\x00\x00\x00\x00\x00\x20\x20\x40\x00\x00\x00\x78\x00\x00\x00\x00" -"\x00\x00\x00\x00\x00\x60\x60\x00\x00\x00\x08\x10\x20\x40\x80\x00" -"\x70\x88\x98\xa8\xc8\x88\x70\x00\x20\x60\xa0\x20\x20\x20\xf8\x00" -"\x70\x88\x08\x10\x60\x80\xf8\x00\x70\x88\x08\x30\x08\x88\x70\x00" -"\x10\x30\x50\x90\xf8\x10\x10\x00\xf8\x80\xe0\x10\x08\x10\xe0\x00" -"\x30\x40\x80\xf0\x88\x88\x70\x00\xf8\x88\x10\x20\x20\x20\x20\x00" -"\x70\x88\x88\x70\x88\x88\x70\x00\x70\x88\x88\x78\x08\x10\x60\x00" -"\x00\x00\x20\x00\x00\x20\x00\x00\x00\x00\x20\x00\x00\x20\x20\x40" -"\x18\x30\x60\xc0\x60\x30\x18\x00\x00\x00\xf8\x00\xf8\x00\x00\x00" -"\xc0\x60\x30\x18\x30\x60\xc0\x00\x70\x88\x08\x10\x20\x00\x20\x00" -"\x70\x88\x08\x68\xa8\xa8\x70\x00\x20\x50\x88\x88\xf8\x88\x88\x00" -"\xf0\x48\x48\x70\x48\x48\xf0\x00\x30\x48\x80\x80\x80\x48\x30\x00" -"\xe0\x50\x48\x48\x48\x50\xe0\x00\xf8\x80\x80\xf0\x80\x80\xf8\x00" -"\xf8\x80\x80\xf0\x80\x80\x80\x00\x70\x88\x80\xb8\x88\x88\x70\x00" -"\x88\x88\x88\xf8\x88\x88\x88\x00\x70\x20\x20\x20\x20\x20\x70\x00" -"\x38\x10\x10\x10\x90\x90\x60\x00\x88\x90\xa0\xc0\xa0\x90\x88\x00" -"\x80\x80\x80\x80\x80\x80\xf8\x00\x88\xd8\xa8\xa8\x88\x88\x88\x00" -"\x88\xc8\xc8\xa8\x98\x98\x88\x00\x70\x88\x88\x88\x88\x88\x70\x00" -"\xf0\x88\x88\xf0\x80\x80\x80\x00\x70\x88\x88\x88\xa8\x90\x68\x00" -"\xf0\x88\x88\xf0\xa0\x90\x88\x00\x70\x88\x80\x70\x08\x88\x70\x00" -"\xf8\x20\x20\x20\x20\x20\x20\x00\x88\x88\x88\x88\x88\x88\x70\x00" -"\x88\x88\x88\x88\x50\x50\x20\x00\x88\x88\x88\xa8\xa8\xd8\x88\x00" -"\x88\x88\x50\x20\x50\x88\x88\x00\x88\x88\x88\x70\x20\x20\x20\x00" -"\xf8\x08\x10\x20\x40\x80\xf8\x00\x70\x40\x40\x40\x40\x40\x70\x00" -"\x00\x00\x80\x40\x20\x10\x08\x00\x70\x10\x10\x10\x10\x10\x70\x00" -"\x20\x50\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00" -"\x40\x20\x10\x00\x00\x00\x00\x00\x00\x00\x70\x08\x78\x88\x78\x00" -"\x80\x80\xb0\xc8\x88\xc8\xb0\x00\x00\x00\x70\x88\x80\x88\x70\x00" -"\x08\x08\x68\x98\x88\x98\x68\x00\x00\x00\x70\x88\xf8\x80\x70\x00" -"\x10\x28\x20\xf8\x20\x20\x20\x00\x00\x00\x68\x98\x98\x68\x08\x70" -"\x80\x80\xf0\x88\x88\x88\x88\x00\x20\x00\x60\x20\x20\x20\x70\x00" -"\x10\x00\x30\x10\x10\x10\x90\x60\x40\x40\x48\x50\x60\x50\x48\x00" -"\x60\x20\x20\x20\x20\x20\x70\x00\x00\x00\xd0\xa8\xa8\xa8\xa8\x00" -"\x00\x00\xb0\xc8\x88\x88\x88\x00\x00\x00\x70\x88\x88\x88\x70\x00" -"\x00\x00\xb0\xc8\xc8\xb0\x80\x80\x00\x00\x68\x98\x98\x68\x08\x08" -"\x00\x00\xb0\xc8\x80\x80\x80\x00\x00\x00\x78\x80\xf0\x08\xf0\x00" -"\x40\x40\xf0\x40\x40\x48\x30\x00\x00\x00\x90\x90\x90\x90\x68\x00" -"\x00\x00\x88\x88\x88\x50\x20\x00\x00\x00\x88\xa8\xa8\xa8\x50\x00" -"\x00\x00\x88\x50\x20\x50\x88\x00\x00\x00\x88\x88\x98\x68\x08\x70" -"\x00\x00\xf8\x10\x20\x40\xf8\x00\x18\x20\x20\x40\x20\x20\x18\x00" -"\x20\x20\x20\x00\x20\x20\x20\x00\xc0\x20\x20\x10\x20\x20\xc0\x00" -"\x40\xa8\x10\x00\x00\x00\x00\x00\x00\x00\x20\x50\xf8\x00\x00\x00" -"\x70\x88\x80\x80\x88\x70\x20\x60\x90\x00\x00\x90\x90\x90\x68\x00" -"\x10\x20\x70\x88\xf8\x80\x70\x00\x20\x50\x70\x08\x78\x88\x78\x00" -"\x48\x00\x70\x08\x78\x88\x78\x00\x20\x10\x70\x08\x78\x88\x78\x00" -"\x20\x00\x70\x08\x78\x88\x78\x00\x00\x70\x80\x80\x80\x70\x10\x60" -"\x20\x50\x70\x88\xf8\x80\x70\x00\x50\x00\x70\x88\xf8\x80\x70\x00" -"\x20\x10\x70\x88\xf8\x80\x70\x00\x50\x00\x00\x60\x20\x20\x70\x00" -"\x20\x50\x00\x60\x20\x20\x70\x00\x40\x20\x00\x60\x20\x20\x70\x00" -"\x50\x00\x20\x50\x88\xf8\x88\x00\x20\x00\x20\x50\x88\xf8\x88\x00" -"\x10\x20\xf8\x80\xf0\x80\xf8\x00\x00\x00\x6c\x12\x7e\x90\x6e\x00" -"\x3e\x50\x90\x9c\xf0\x90\x9e\x00\x60\x90\x00\x60\x90\x90\x60\x00" -"\x90\x00\x00\x60\x90\x90\x60\x00\x40\x20\x00\x60\x90\x90\x60\x00" -"\x40\xa0\x00\xa0\xa0\xa0\x50\x00\x40\x20\x00\xa0\xa0\xa0\x50\x00" -"\x90\x00\x90\x90\xb0\x50\x10\xe0\x50\x00\x70\x88\x88\x88\x70\x00" -"\x50\x00\x88\x88\x88\x88\x70\x00\x20\x20\x78\x80\x80\x78\x20\x20" -"\x18\x24\x20\xf8\x20\xe2\x5c\x00\x88\x50\x20\xf8\x20\xf8\x20\x00" -"\xc0\xa0\xa0\xc8\x9c\x88\x88\x8c\x18\x20\x20\xf8\x20\x20\x20\x40" -"\x10\x20\x70\x08\x78\x88\x78\x00\x10\x20\x00\x60\x20\x20\x70\x00" -"\x20\x40\x00\x60\x90\x90\x60\x00\x20\x40\x00\x90\x90\x90\x68\x00" -"\x50\xa0\x00\xa0\xd0\x90\x90\x00\x28\x50\x00\xc8\xa8\x98\x88\x00" -"\x00\x70\x08\x78\x88\x78\x00\xf8\x00\x60\x90\x90\x90\x60\x00\xf0" -"\x20\x00\x20\x40\x80\x88\x70\x00\x00\x00\x00\xf8\x80\x80\x00\x00" -"\x00\x00\x00\xf8\x08\x08\x00\x00\x84\x88\x90\xa8\x54\x84\x08\x1c" -"\x84\x88\x90\xa8\x58\xa8\x3c\x08\x20\x00\x00\x20\x20\x20\x20\x00" -"\x00\x00\x24\x48\x90\x48\x24\x00\x00\x00\x90\x48\x24\x48\x90\x00" -"\x28\x50\x20\x50\x88\xf8\x88\x00\x28\x50\x70\x08\x78\x88\x78\x00" -"\x28\x50\x00\x70\x20\x20\x70\x00\x28\x50\x00\x20\x20\x20\x70\x00" -"\x28\x50\x00\x70\x88\x88\x70\x00\x50\xa0\x00\x60\x90\x90\x60\x00" -"\x28\x50\x00\x88\x88\x88\x70\x00\x50\xa0\x00\xa0\xa0\xa0\x50\x00" -"\xfc\x48\x48\x48\xe8\x08\x50\x20\x00\x50\x00\x50\x50\x50\x10\x20" -"\xc0\x44\xc8\x54\xec\x54\x9e\x04\x10\xa8\x40\x00\x00\x00\x00\x00" -"\x00\x20\x50\x88\x50\x20\x00\x00\x88\x10\x20\x40\x80\x28\x00\x00" -"\x7c\xa8\xa8\x68\x28\x28\x28\x00\x38\x40\x30\x48\x48\x30\x08\x70" -"\x00\x00\x00\x00\x00\x00\xff\xff\xf0\xf0\xf0\xf0\x0f\x0f\x0f\x0f" -"\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00" -"\x00\x00\x00\x3c\x3c\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00" -"\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x0f\x0f\x0f\x0f\xf0\xf0\xf0\xf0" -"\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\x03\x03\x03\x03\x03\x03\x03\x03" -"\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x11\x22\x44\x88\x11\x22\x44\x88" -"\x88\x44\x22\x11\x88\x44\x22\x11\xfe\x7c\x38\x10\x00\x00\x00\x00" -"\x00\x00\x00\x00\x10\x38\x7c\xfe\x80\xc0\xe0\xf0\xe0\xc0\x80\x00" -"\x01\x03\x07\x0f\x07\x03\x01\x00\xff\x7e\x3c\x18\x18\x3c\x7e\xff" -"\x81\xc3\xe7\xff\xff\xe7\xc3\x81\xf0\xf0\xf0\xf0\x00\x00\x00\x00" -"\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00" -"\x00\x00\x00\x00\xf0\xf0\xf0\xf0\x33\x33\xcc\xcc\x33\x33\xcc\xcc" -"\x00\x20\x20\x50\x50\x88\xf8\x00\x20\x20\x70\x20\x70\x20\x20\x00" -"\x00\x00\x00\x50\x88\xa8\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff" -"\x00\x00\x00\x00\xff\xff\xff\xff\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf0" -"\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\xff\xff\xff\xff\x00\x00\x00\x00" -"\x00\x00\x68\x90\x90\x90\x68\x00\x30\x48\x48\x70\x48\x48\x70\xc0" -"\xf8\x88\x80\x80\x80\x80\x80\x00\xf8\x50\x50\x50\x50\x50\x98\x00" -"\xf8\x88\x40\x20\x40\x88\xf8\x00\x00\x00\x78\x90\x90\x90\x60\x00" -"\x00\x50\x50\x50\x50\x68\x80\x80\x00\x50\xa0\x20\x20\x20\x20\x00" -"\xf8\x20\x70\xa8\xa8\x70\x20\xf8\x20\x50\x88\xf8\x88\x50\x20\x00" -"\x70\x88\x88\x88\x50\x50\xd8\x00\x30\x40\x40\x20\x50\x50\x50\x20" -"\x00\x00\x00\x50\xa8\xa8\x50\x00\x08\x70\xa8\xa8\xa8\x70\x80\x00" -"\x38\x40\x80\xf8\x80\x40\x38\x00\x70\x88\x88\x88\x88\x88\x88\x00" -"\x00\xf8\x00\xf8\x00\xf8\x00\x00\x20\x20\xf8\x20\x20\x00\xf8\x00" -"\xc0\x30\x08\x30\xc0\x00\xf8\x00\x18\x60\x80\x60\x18\x00\xf8\x00" -"\x10\x28\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xa0\x40" -"\x00\x20\x00\xf8\x00\x20\x00\x00\x00\x50\xa0\x00\x50\xa0\x00\x00" -"\x00\x18\x24\x24\x18\x00\x00\x00\x00\x30\x78\x78\x30\x00\x00\x00" -"\x00\x00\x00\x00\x30\x00\x00\x00\x3e\x20\x20\x20\xa0\x60\x20\x00" -"\xa0\x50\x50\x50\x00\x00\x00\x00\x40\xa0\x20\x40\xe0\x00\x00\x00" -"\x00\x38\x38\x38\x38\x38\x38\x00\x00\x00\x00\x00\x00\x00\x00"; - diff --git a/O2EM/sources/libretro/graph.c b/O2EM/sources/libretro/graph.c deleted file mode 100755 index 9e6ccc6..0000000 --- a/O2EM/sources/libretro/graph.c +++ /dev/null @@ -1,452 +0,0 @@ - -#include -#include -#include -#include - -#include "graph.h" -#include "libretro-o2em.h" - -extern unsigned char msx[]; - -void printch(char *buffer,int x, int y, unsigned couleur,unsigned char ch,int taille,int pl,int zde) -{ - int i,j; - unsigned char *font; - int rectx,recty; - -#if defined PITCH && PITCH == 4 -unsigned *mbuffer=(unsigned*)buffer; -#else -unsigned short *mbuffer=(unsigned short *)buffer; -#endif - font=&msx[(int)ch * 8]; - - for(i=0;i<8;i++,font++) - { - for(j=0;j<8;j++) - { - if ((*font &(128>>j))) - { - rectx = x+(j<<0); - if(taille==1)recty = y+(i<<1); - else recty = y+(i<<0); - - mbuffer[recty* VIRTUAL_WIDTH + rectx] = couleur; - if(pl==1)mbuffer[(recty+1)* VIRTUAL_WIDTH + rectx] = couleur; - - } - } - } -} - -void textpixel(char *buffer,int x,int y,unsigned color,int tail,int plein,int zdep, char *string,...) -{ - int boucle=0; - char text[256]; - va_list ap; - - if (string == NULL)return; - - va_start(ap, string); - vsprintf(text, string, ap); - va_end(ap); - - while(text[boucle]!=0){ - printch(buffer,x,y,color,text[boucle],tail,plein,zdep); - boucle++;x+=8;//6; - } - -} - -void textCLpixel(char *buffer,int lim,int x,int x2,int y,unsigned color,int tail,int plein,int zdep,char *string,...) -{ - int boucle=0; - char text[256]; - va_list ap; - - if (string == NULL)return; - - va_start(ap, string); - vsprintf(text, string, ap); - va_end(ap); - - while(text[boucle]!=0 && boucle= 0) ? 1 : -1; - sy = (dy >= 0) ? 1 : -1; - - if (dx==0) { - if (dy>0) { - DrawVlineBmp(buffer, x1, y1,0, dy, color); - return; - - } else if (dy<0) { - DrawVlineBmp(buffer, x1, y2,0, -dy, color); - return; - - } else { - idx=x1+y1*VIRTUAL_WIDTH; - mbuffer[idx]=color; - return ; - } - } - if (dy == 0) { - if (dx>0) { - DrawHlineBmp(buffer, x1, y1, dx, 0, color); - return; - - } else if (dx<0) { - DrawHlineBmp(buffer, x2, y1, -dx,0, color); - return; - } - } - - dx = sx * dx + 1; - dy = sy * dy + 1; - - pixx = 1; - pixy = VIRTUAL_WIDTH; - - pixx *= sx; - pixy *= sy; - - if (dx < dy) { - swaptmp = dx; - dx = dy; - dy = swaptmp; - swaptmp = pixx; - pixx = pixy; - pixy = swaptmp; - } - - x = 0; - y = 0; - - idx=x1+y1*VIRTUAL_WIDTH; - - for (; x < dx; x++, idx +=pixx) { - mbuffer[idx]=color; - y += dy; - if (y >= dx) { - y -= dx; - idx += pixy; - } - } - -} -/* -void DrawBox(char *buffer,box b,char t[],unsigned color){ - - - DrawBoxBmp(mbuffer,b.x,b.y,b.dx,b.dy,color); - textCpixel(mbuffer,b.x, 3*b.x + b.dx ,b.y+2,color,1,1,4,"%s",t); - -} - -void DrawBoxF(char *buffer,box b,char t[],unsigned color,unsigned border){ - - int ydec=b.y+(b.dy/2)-4; - - - if(ydeclibrary_name = "O2EM"; - info->library_version = "1.18"; - info->valid_extensions = "bin"; - info->need_fullpath = true; - info->block_extract = false; -} - -void retro_get_system_av_info(struct retro_system_av_info *info) -{ - struct retro_game_geometry geom = { TEX_WIDTH, TEX_HEIGHT, TEX_WIDTH, TEX_HEIGHT,4.0 / 3.0 }; - struct retro_system_timing timing = { 60.0, 44100.0 }; - - info->geometry = geom; - info->timing = timing; -} - -void retro_set_environment(retro_environment_t cb) -{ - environ_cb = cb; -} - -void retro_set_audio_sample(retro_audio_sample_t cb) -{ - audio_cb = cb; -} - -void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) -{ - audio_batch_cb = cb; -} - -void retro_set_video_refresh(retro_video_refresh_t cb) -{ - video_cb = cb; -} - - -void retro_reset(void){} - -void retro_shutdown_o2em(void) -{ - environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL); -} - -void dumpaudio(int len){ - int x; - if(SND==1) - { - signed short int *p=(signed short int *)SNDBUF; - for(x=0;x=320); - else{ - - if(down && retrok==304/*0x2a*/){ - - if(SHIFTON == 1)retro_key_up(retrok); - else retro_key_down(retrok); - SHIFTON=-SHIFTON; - - } - else { - if(down && retrok!=-1) - retro_key_down(retrok); - else if(!down && retrok!=-1) - retro_key_up(retrok); - } - - } - -} - -bool retro_load_game(const struct retro_game_info *info) -{ - const char *full_path; - - enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; - if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) - { - fprintf(stderr, "RGB565 is not supported.\n"); - return false; - } - - struct retro_keyboard_callback cb = { keyboard_cb }; - environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb); - - (void)info; - - full_path = info->path; - - strcpy(RPATH,full_path); - - RLOOP=1; - - Emu_init(); - - return true; -} - -void retro_unload_game(void){ - -} - -unsigned retro_get_region(void) -{ - return RETRO_REGION_NTSC; -} - -bool retro_load_game_special(unsigned type, const struct retro_game_info *info, size_t num) -{ - (void)type; - (void)info; - (void)num; - return false; -} - -size_t retro_serialize_size(void) -{ - return 0; -} - -bool retro_serialize(void *data_, size_t size) -{ - return false; -} - -bool retro_unserialize(const void *data_, size_t size) -{ - return false; -} - -void *retro_get_memory_data(unsigned id) -{ - (void)id; - return NULL; -} - -size_t retro_get_memory_size(unsigned id) -{ - (void)id; - return 0; -} - -void retro_cheat_reset(void) {} - -void retro_cheat_set(unsigned index, bool enabled, const char *code) -{ - (void)index; - (void)enabled; - (void)code; -} - diff --git a/O2EM/sources/libretro/libretro-o2em.h b/O2EM/sources/libretro/libretro-o2em.h deleted file mode 100755 index f89b0fc..0000000 --- a/O2EM/sources/libretro/libretro-o2em.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef LIBRETRO_HATARI_H -#define LIBRETRO_HATARI_H 1 - -#include -#include -#include -#include -#include - -#define Uint8 unsigned char -#define Uint16 unsigned short int -#define Uint32 unsigned int - -#include - -#define PITCH 2 - -#define EMUWITH 340 -#define EMUHEIGHT 250 - -#define TEX_WIDTH 400 -#define TEX_HEIGHT 300 -#define VIRTUAL_WIDTH TEX_WIDTH -#define CROP_WIDTH 340 -#define CROP_HEIGHT 210 - -#define NPLGN 10 -#define NLIGN 5 -#define NLETT 5 - -#define XSIDE (CROP_WIDTH/NPLGN -1) -#define YSIDE (CROP_HEIGHT/8 -1) - -#define YBASE0 (CROP_HEIGHT - NLIGN*YSIDE -8) -#define XBASE0 0+4+2 -#define XBASE3 0 -#define YBASE3 YBASE0 -4 - -#define STAT_DECX 120 -#define STAT_YSZ 20 - -#define RGB565(r, g, b) (((r) << (5+6)) | ((g) << 6) | (b)) - -#endif diff --git a/O2EM/sources/libretro/libretro.h b/O2EM/sources/libretro/libretro.h deleted file mode 100755 index ff4f4fd..0000000 --- a/O2EM/sources/libretro/libretro.h +++ /dev/null @@ -1,787 +0,0 @@ -/* Copyright (C) 2010-2013 The RetroArch team - * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this libretro API header (libretro.h). - * --------------------------------------------------------------------------------------- - * - * Permission is hereby granted, free of charge, - * to any person obtaining a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIBRETRO_H__ -#define LIBRETRO_H__ - -#include -#include -#include - -// 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 -#endif -#endif - -// Used for checking API/ABI mismatches that can break libretro implementations. -// It is not incremented for compatible changes to the API. -#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 - -// Abstracts the concept of a pointing mechanism, e.g. touch. -// This allows libretro to query in absolute coordinates where on the screen a mouse (or something similar) is being placed. -// For a touch centric device, coordinates reported are the coordinates of the press. -// -// Coordinates in X and Y are reported as: -// [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen, -// and 0x7fff corresponds to the far right/bottom of the screen. -// The "screen" is here defined as area that is passed to the frontend and later displayed on the monitor. -// The frontend is free to scale/resize this screen as it sees fit, however, -// (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the game image, etc. -// -// To check if the pointer coordinates are valid (e.g. a touch display actually being touched), -// PRESSED returns 1 or 0. -// If using a mouse, PRESSED will usually correspond to the left mouse button. -// PRESSED will only return 1 if the pointer is inside the game screen. -// -// For multi-touch, the index variable can be used to successively query more presses. -// If index = 0 returns true for _PRESSED, coordinates can be extracted -// with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with index = 1, and so on. -// Eventually _PRESSED will return false for an index. No further presses are registered at this point. -#define RETRO_DEVICE_POINTER 6 - -// 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 - -// Id values for POINTER. -#define RETRO_DEVICE_ID_POINTER_X 0 -#define RETRO_DEVICE_ID_POINTER_Y 1 -#define RETRO_DEVICE_ID_POINTER_PRESSED 2 - -// 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, - - RETROK_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) -}; - -enum retro_mod -{ - RETROKMOD_NONE = 0x0000, - - RETROKMOD_SHIFT = 0x01, - RETROKMOD_CTRL = 0x02, - RETROKMOD_ALT = 0x04, - RETROKMOD_META = 0x08, - - RETROKMOD_NUMLOCK = 0x10, - RETROKMOD_CAPSLOCK = 0x20, - RETROKMOD_SCROLLOCK = 0x40, - - RETROKMOD_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) -}; - -// If set, this call is not part of the public libretro API yet. It can change or be removed at any time. -#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000 - -// 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. - // -// Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES), and reserved to avoid possible ABI clash. -#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. -#define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12 - // const struct retro_keyboard_callback * -- - // Sets a callback function used to notify core about keyboard events. - // -#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13 - // const struct retro_disk_control_callback * -- - // Sets an interface which frontend can use to eject and insert disk images. - // This is used for games which consist of multiple images and must be manually - // swapped out by the user (e.g. PSX). -#define RETRO_ENVIRONMENT_SET_HW_RENDER (14 | RETRO_ENVIRONMENT_EXPERIMENTAL) - // struct retro_hw_render_callback * -- - // NOTE: This call is currently very experimental, and should not be considered part of the public API. - // The interface could be changed or removed at any time. - // Sets an interface to let a libretro core render with hardware acceleration. - // Should be called in retro_load_game(). - // If successful, libretro cores will be able to render to a frontend-provided framebuffer. - // The size of this framebuffer will be at least as large as max_width/max_height provided in get_av_info(). - // If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or NULL to retro_video_refresh_t. -#define RETRO_ENVIRONMENT_GET_VARIABLE 15 - // struct retro_variable * -- - // Interface to aquire user-defined information from environment - // that cannot feasibly be supported in a multi-system way. - // 'key' should be set to a key which has already been set by SET_VARIABLES. - // 'data' will be set to a value or NULL. - // -#define RETRO_ENVIRONMENT_SET_VARIABLES 16 - // const struct retro_variable * -- - // Allows an implementation to signal the environment - // which variables it might want to check for later using GET_VARIABLE. - // This allows the frontend to present these variables to a user dynamically. - // This should be called as early as possible (ideally in retro_set_environment). - // - // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element. - // retro_variable::key should be namespaced to not collide with other implementations' keys. E.g. A core called 'foo' should use keys named as 'foo_option'. - // retro_variable::value should contain a human readable description of the key as well as a '|' delimited list of expected values. - // The number of possible options should be very limited, i.e. it should be feasible to cycle through options without a keyboard. - // First entry should be treated as a default. - // - // Example entry: - // { "foo_option", "Speed hack coprocessor X; false|true" } - // - // Text before first ';' is description. This ';' must be followed by a space, and followed by a list of possible values split up with '|'. - // Only strings are operated on. The possible values will generally be displayed and stored as-is by the frontend. - // -#define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17 - // bool * -- - // Result is set to true if some variables are updated by - // frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE. - // Variables should be queried with GET_VARIABLE. - // -#define RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME 18 - // const bool * -- - // If true, the libretro implementation supports calls to retro_load_game() with NULL as argument. - // Used by cores which can run without particular game data. - // This should be called within retro_set_environment() only. - - -// Pass this to retro_video_refresh_t if rendering to hardware. -// Passing NULL to retro_video_refresh_t is still a frame dupe as normal. -#define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1) - -// Invalidates the current HW context. -// If called, all GPU resources must be reinitialized. -// Usually called when frontend reinits video driver. -// Also called first time video driver is initialized, allowing libretro core to init resources. -typedef void (*retro_hw_context_reset_t)(void); -// Gets current framebuffer which is to be rendered to. Could change every frame potentially. -typedef uintptr_t (*retro_hw_get_current_framebuffer_t)(void); - -// Get a symbol from HW context. -typedef void (*retro_proc_address_t)(void); -typedef retro_proc_address_t (*retro_hw_get_proc_address_t)(const char *sym); - -enum retro_hw_context_type -{ - RETRO_HW_CONTEXT_NONE = 0, - RETRO_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+. - RETRO_HW_CONTEXT_OPENGLES2, // GLES 2.0 - - RETRO_HW_CONTEXT_DUMMY = INT_MAX -}; - -struct retro_hw_render_callback -{ - enum retro_hw_context_type context_type; // Which API to use. Set by libretro core. - retro_hw_context_reset_t context_reset; // Set by libretro core. - retro_hw_get_current_framebuffer_t get_current_framebuffer; // Set by frontend. - retro_hw_get_proc_address_t get_proc_address; // Set by frontend. - bool depth; // Set if render buffers should have depth component attached. -}; - -// Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. -// down is set if the key is being pressed, or false if it is being released. -// keycode is the RETROK value of the char. -// character is the text character of the pressed key. (UTF-32). -// key_modifiers is a set of RETROKMOD values or'ed together. -typedef void (*retro_keyboard_event_t)(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers); - -struct retro_keyboard_callback -{ - retro_keyboard_event_t callback; -}; - -// Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. -// Should be set for implementations which can swap out multiple disk images in runtime. -// If the implementation can do this automatically, it should strive to do so. -// However, there are cases where the user must manually do so. -// -// Overview: To swap a disk image, eject the disk image with set_eject_state(true). -// Set the disk index with set_image_index(index). Insert the disk again with set_eject_state(false). - -// If ejected is true, "ejects" the virtual disk tray. -// When ejected, the disk image index can be set. -typedef bool (*retro_set_eject_state_t)(bool ejected); -// Gets current eject state. The initial state is 'not ejected'. -typedef bool (*retro_get_eject_state_t)(void); -// Gets current disk index. First disk is index 0. -// If return value is >= get_num_images(), no disk is currently inserted. -typedef unsigned (*retro_get_image_index_t)(void); -// Sets image index. Can only be called when disk is ejected. -// The implementation supports setting "no disk" by using an index >= get_num_images(). -typedef bool (*retro_set_image_index_t)(unsigned index); -// Gets total number of images which are available to use. -typedef unsigned (*retro_get_num_images_t)(void); -// -// Replaces the disk image associated with index. -// Arguments to pass in info have same requirements as retro_load_game(). -// Virtual disk tray must be ejected when calling this. -// Replacing a disk image with info = NULL will remove the disk image from the internal list. -// As a result, calls to get_image_index() can change. -// -// E.g. replace_image_index(1, NULL), and previous get_image_index() returned 4 before. -// Index 1 will be removed, and the new index is 3. -struct retro_game_info; -typedef bool (*retro_replace_image_index_t)(unsigned index, const struct retro_game_info *info); -// Adds a new valid index (get_num_images()) to the internal disk list. -// This will increment subsequent return values from get_num_images() by 1. -// This image index cannot be used until a disk image has been set with replace_image_index. -typedef bool (*retro_add_image_index_t)(void); - -struct retro_disk_control_callback -{ - retro_set_eject_state_t set_eject_state; - retro_get_eject_state_t get_eject_state; - - retro_get_image_index_t get_image_index; - retro_set_image_index_t set_image_index; - retro_get_num_images_t get_num_images; - - retro_replace_image_index_t replace_image_index; - retro_add_image_index_t add_image_index; -}; - -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 diff --git a/O2EM/sources/libretro/o2em-mapper.c b/O2EM/sources/libretro/o2em-mapper.c deleted file mode 100755 index c5342ae..0000000 --- a/O2EM/sources/libretro/o2em-mapper.c +++ /dev/null @@ -1,296 +0,0 @@ -#include "libretro.h" - -#include "libretro-o2em.h" - -#include "graph.h" -#include "vkbd.h" - -#include -#include -#include - -unsigned short int mbmp[TEX_WIDTH * TEX_HEIGHT]; - -int RLOOP=1,NPAGE=-1, KCOL=1, BKGCOLOR=0; -int SHIFTON=-1,SHOWKEY=-1,STATUTON=-1; -int PAUSE=-1,SND=1; - -short signed int SNDBUF[1024*2]; -int snd_sampler = 44100 / 60; -char RPATH[512]; - -static int mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - -long mframe=0; -unsigned long Ktime=0 , LastFPSTime=0; - -int BOXDEC= 32+2; -int STAT_BASEY=CROP_HEIGHT; - -int jbt[5]={0,0,0,0,0}; -extern unsigned char key[256*2]; - -void RetroLoop(){ - - if(PAUSE==-1)cpu_exec(); - RLOOP=1; -} - -extern int omain(int argc, char *argv[]); - -static retro_input_state_t input_state_cb; -static retro_input_poll_t input_poll_cb; - -void retro_set_input_state(retro_input_state_t cb) -{ - input_state_cb = cb; -} - -void retro_set_input_poll(retro_input_poll_t cb) -{ - input_poll_cb = cb; -} - -long GetTicks(void) -{ // in MSec - struct timeval tv; - gettimeofday (&tv, NULL); - return (tv.tv_sec*1000000 + tv.tv_usec)/1000; -} - -void texture_init(){ - - memset(mbmp, 0, sizeof(mbmp)); -} - -void Emu_init(){ - - int result = 0; - - char **argv2 = (char *[]){"o2em\0", "vp_16.bin\0","\0"}; - - argv2[1]=RPATH; - omain(2,argv2); -} - -void Emu_uninit(){ - - close_audio(); - close_voice(); - close_display(); - retro_destroybmp(); -} - -void Print_Statut(){ - - Draw_text((char*)mbmp,STAT_DECX+40 ,STAT_BASEY,0xffff,0x8080,1,2,40,(SHIFTON>0?"SHFT":"")); - Draw_text((char*)mbmp,STAT_DECX+80 ,STAT_BASEY,0xffff,0x8080,1,2,40,"MS:%d",0); - Draw_text((char*)mbmp,STAT_DECX+120,STAT_BASEY,0xffff,0x8080,1,2,40,"Joy:%d",0); -} - -void retro_key_down(unsigned char retrok){ - key[retrok]=1; -} - -void retro_key_up(unsigned char retrok){ - key[retrok]=0; -} - -/* -L2 show/hide Statut -R2 swap kbd pages -L show/hide vkbd -R switch Shift ON/OFF -SEL EMU KSPACE -STR EMU KRETURN -A fire/mousea/valid key in vkbd -B EMU KL -X EMU K0 -Y EMU K1 -*/ -void update_joy(void){ - - int i; - input_poll_cb(); - - if(SHOWKEY!=1){ - for(i=4;i<9;i++)jbt[i-4]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i ); // Joy press UP/DW/RT/LF/A - - key[RETROK_l]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 0 ); //B -> L - key[RETROK_RETURN]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 3 ); // START -> RETURN - key[RETROK_SPACE]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 2 ); // SELECT -> SPACE - key[RETROK_0]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 9 ); // X -> 0 - key[RETROK_1]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 1 ); // Y -> 1 - - } -} - -void update_input(void) -{ - int i; - // 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 - static int vbt[16]={0x1C,0x39,0x01,0x3B,0x01,0x02,0x04,0x08,0x80,0x6D,0x15,0x31,0x24,0x1F,0x6E,0x6F}; - static int oldi=-1; - static int vkx=0,vky=0; - - if(oldi!=-1){ - retro_key_up(oldi); - oldi=-1; - } - - input_poll_cb(); - - - i=10;//show vkey toggle - 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; - SHOWKEY=-SHOWKEY; - } - - i=11;//switch shift On/Off - 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; - SHIFTON=-SHIFTON; - } - - i=12;//show/hide statut - 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; - STATUTON=-STATUTON; - } - - i=13;//swap kbd pages - 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; - if(SHOWKEY==1){ - NPAGE=-NPAGE; - } - } - - if(SHOWKEY==1){ - - static int vkflag[5]={0,0,0,0,0}; - - if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP) && vkflag[0]==0 ) - vkflag[0]=1; - else if (vkflag[0]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP) ){ - vkflag[0]=0; - vky -= 1; - } - - if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN) && vkflag[1]==0 ) - vkflag[1]=1; - else if (vkflag[1]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN) ){ - vkflag[1]=0; - vky += 1; - } - - if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT) && vkflag[2]==0 ) - vkflag[2]=1; - else if (vkflag[2]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT) ){ - vkflag[2]=0; - vkx -= 1; - } - - if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT) && vkflag[3]==0 ) - vkflag[3]=1; - else if (vkflag[3]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT) ){ - vkflag[3]=0; - vkx += 1; - } - - if(vkx<0)vkx=9; - if(vkx>9)vkx=0; - if(vky<0)vky=4; - if(vky>4)vky=0; - - virtual_kdb((char*)mbmp,vkx,vky); - - i=8; - if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && vkflag[4]==0) - vkflag[4]=1; - else if( !input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && vkflag[4]==1) { - - vkflag[4]=0; - i=check_vkey2(vkx,vky); - - if(i==-2){ //SWAP VKBD PAGE - NPAGE=-NPAGE;oldi=-1; - } - else if(i==-1){ //NOP - oldi=-1; - } - else if(i==-3){//KDB bgcolor - KCOL=-KCOL; - oldi=-1; - } - else if(i==-4){//VKbd show/hide - oldi=-1; - SHOWKEY=-SHOWKEY; - } - else if(i==-5){//inject - rscore(); - oldi=-1; - } - else if(i==-6){//quit - retro_shutdown_o2em(); - oldi=-1; - } - else if(i==-7){//pause - PAUSE=-PAUSE; - oldi=-1; - } - else if(i==-8){//reset - rreset(); - oldi=-1; - } - else if(i==-9){//screenshot - //TODO - oldi=-1; - } - else if(i==-10){//save - rsavestate(); - oldi=-1; - } - else if(i==-11){//load - rloadstate(); - oldi=-1; - } - else if(i==-12){//SOUND ON/OFF - SND=-SND; - oldi=-1; - } - else { - if(i==304){ - - if(SHIFTON == 1)retro_key_up(i); - else retro_key_down(i); - SHIFTON=-SHIFTON; - oldi=-1; - } - else { - oldi=i; - retro_key_down(i); - } - } - - } - - if(STATUTON==1)Print_Statut(); - - return; - } - - if(STATUTON==1)Print_Statut(); - -} - diff --git a/O2EM/sources/libretro/vkbd.c b/O2EM/sources/libretro/vkbd.c deleted file mode 100755 index d55f6c7..0000000 --- a/O2EM/sources/libretro/vkbd.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "libretro-o2em.h" - -#include "vkbd_def.h" -#include "graph.h" - -extern int NPAGE; -extern int KCOL; -extern int BKGCOLOR; -extern int SHIFTON; - -void virtual_kdb(char *pix,int vx,int vy) -{ - int y,x,page=NPAGE==-1?0:50; - short unsigned coul=RGB565(28, 28, 31); - BKGCOLOR=(KCOL>0?0x8080:0); - - for(x=0;x +#include +#include +#define abs(a) miabs(a) + +int miabs(int a){ + if((a)<0)a=-a; + return a; +} + +void upcase(char *p) +{ + while(*p != '\0') + { + if(*p >= 97 && *p <= 122) + *p -= 32; + ++p; + } +} +void downcase(char *p) +{ + while(*p != '\0') + { + if(*p >= 97-32 && *p <= 122-32) + *p += 32; + ++p; + } +} + +void clear(BITMAP *buff){ + + memset(&buff->line,0,buff->w*buff->h); +} + +BITMAP *create_bitmap(int w,int h){ + + BITMAP *buff; + + buff = malloc(sizeof (BITMAP)); + buff->line=malloc(1*w*h); + + buff->w=w; + buff->h=h; + buff->pitch=w; + buff->depth=1; + + return buff; +} + +int destroy_bitmap(BITMAP *buff){ + + if (buff->line) { + free(buff->line); + } + free(buff); + + return 0; +} + + +void rect(BITMAP *buff,int x,int y,int x2,int y2,unsigned char color){ + +// int i,j,idx; +// +// int dx= abs(x2-x); +// int dy= abs(y2-y); +// int V_WIDTH = buff->w; +// unsigned char *buffer=buff->line[0]; +// +// for(i=x;iw; +// unsigned char *buffer=buff->line[0]; +// +// for(i=x;iw; +// unsigned char *buffer=buff->line[0]; +// +// for(i=x;iw; +// unsigned char *buffer=buff->line[0]; +// +// for(j=y;jw; +// unsigned char *buffer=buff->line[0]; +// +// dx = x2 - x1; +// dy = y2 - y1; +// sx = (dx >= 0) ? 1 : -1; +// sy = (dy >= 0) ? 1 : -1; +// +// if (dx==0) { +// if (dy>0) { +// DrawVline(buff, x1, y1,0, dy, color); +// return; +// +// } else if (dy<0) { +// DrawVline(buff, x1, y2,0, -dy, color); +// return; +// +// } else { +// idx=x1+y1*V_WIDTH; +// buffer[idx]=color; +// return ; +// } +// } +// if (dy == 0) { +// if (dx>0) { +// DrawHline(buff, x1, y1, dx, 0, color); +// return; +// +// } else if (dx<0) { +// DrawHline(buff, x2, y1, -dx,0, color); +// return; +// } +// } +// +// dx = sx * dx + 1; +// dy = sy * dy + 1; +// +// pixx = 1; +// pixy = V_WIDTH; +// +// pixx *= sx; +// pixy *= sy; +// +// if (dx < dy) { +// swaptmp = dx; +// dx = dy; +// dy = swaptmp; +// swaptmp = pixx; +// pixx = pixy; +// pixy = swaptmp; +// } +// +// x = 0; +// y = 0; +// +// idx=x1+y1*V_WIDTH; +// +// for (; x < dx; x++, idx +=pixx) { +// buffer[idx]=color; +// y += dy; +// if (y >= dx) { +// y -= dx; +// idx += pixy; +// } +// } + +} diff --git a/allegrowrapper/wrapalleg.h b/allegrowrapper/wrapalleg.h new file mode 100755 index 0000000..76258a5 --- /dev/null +++ b/allegrowrapper/wrapalleg.h @@ -0,0 +1,56 @@ + +#ifndef WRAP_H +#define WRAP_H 1 + +#include +#define INLINE static inline +#define rest(a) usleep(a) +#define strupr upcase +#define strlwr downcase +#define keypressed() 0 +#define poll_keyboard() +#define yield_timeslice() + +typedef struct +{ + unsigned char *line; + int w; + int h; + int pitch; + int depth; + +}BITMAP; + +typedef struct +{ + unsigned char r; + unsigned char g; + unsigned char b; +}APALETTE; + + +BITMAP *create_bitmap(int w,int h); +int destroy_bitmap(BITMAP *buff); +void line(BITMAP *buff,int x1,int y1,int x2,int y2,unsigned char color); +void rect(BITMAP *buff,int x,int y,int x2,int y2,unsigned char color); +void rectfill(BITMAP *buff,int x,int y,int x2,int y2,unsigned char color); +void upcase(char *p); +void downcase(char *p); + +extern unsigned char key[256*2]; + +extern void update_joy(void); + +#define INLINE static inline + +#define EMUWIDTH 340 +#define EMUHEIGHT 250 + +#define TEX_WIDTH 400 +#define TEX_HEIGHT 300 + +#define RGB565(r, g, b) (((r) << (5+6)) | ((g) << 6) | (b)) + + +#endif + diff --git a/libretro.c b/libretro.c new file mode 100644 index 0000000..f57f468 --- /dev/null +++ b/libretro.c @@ -0,0 +1,539 @@ +#ifndef _MSC_VER +#include +#include +#endif +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#define snprintf _snprintf +#pragma pack(1) +#endif + +#include "libretro.h" + +#include "audio.h" +#include "config.h" +#include "cpu.h" +#include "crc32.h" +#include "debug.h" +#include "keyboard.h" +#include "score.h" +#include "vdc.h" +#include "vmachine.h" +#include "voice.h" +#include "vpp.h" + +#include "wrapalleg.h" + +static retro_log_printf_t log_cb; +static retro_video_refresh_t video_cb; +static retro_input_poll_t input_poll_cb; +static retro_input_state_t input_state_cb; +static retro_environment_t environ_cb; +static retro_audio_sample_t audio_cb; +static retro_audio_sample_batch_t audio_batch_cb; + +void retro_set_environment(retro_environment_t cb) { environ_cb = cb; } +void retro_set_video_refresh(retro_video_refresh_t cb) { video_cb = cb; } +void retro_set_audio_sample(retro_audio_sample_t cb) { audio_cb = cb; } +void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; } +void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; } +void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; } + +unsigned short int mbmp[TEX_WIDTH * TEX_HEIGHT]; +uint8_t soundBuffer[1056]; +int SND; +int RLOOP=0; +int jbt[5]={0,0,0,0,0}; + +int contax, o2flag, g74flag, c52flag, jopflag, helpflag; + +unsigned long crcx = ~0; + +static char bios[MAXC], scshot[MAXC], xrom[MAXC], romdir[MAXC], xbios[MAXC], +biosdir[MAXC], arkivo[MAXC][MAXC], biossux[MAXC], romssux[MAXC], +odyssey2[MAXC], g7400[MAXC], c52[MAXC], jopac[MAXC], file_l[MAXC], bios_l[MAXC], +file_v[MAXC],scorefile[MAXC], statefile[MAXC], path2[MAXC]; + +static int does_file_exist(const char *filename) +{ + struct stat st; + int result = stat(filename, &st); + return result == 0; +} + +static long filesize(FILE *stream){ + long curpos, length; + curpos = ftell(stream); + fseek(stream, 0L, SEEK_END); + length = ftell(stream); + fseek(stream, curpos, SEEK_SET); + return length; +} + +static void load_bios(const char *biosname){ + FILE *fn; + static char s[MAXC+10]; + unsigned long crc; + int i; + + if ((biosname[strlen(biosname)-1]=='/') || (biosname[strlen(biosname)-1]=='\\') || (biosname[strlen(biosname)-1]==':')) { + strcpy(s,biosname); + strcat(s,odyssey2); + fn = fopen(s,"rb"); + + if (!fn) { + strcpy(s,biosname); + strcat(s,odyssey2); + fn = fopen(s,"rb"); + } + } + else { + strcpy(s,biosname); + fn = fopen(biosname,"rb"); + } + + if (!fn) { + fprintf(stderr,"Error loading bios ROM (%s)\n",s); + exit(EXIT_FAILURE); + } + if (fread(rom_table[0],1024,1,fn) != 1) { + fprintf(stderr,"Error loading bios ROM %s\n",odyssey2); + exit(EXIT_FAILURE); + } + + strcpy(s,biosname); + fn = fopen(biosname,"rb"); + + if (!fn) { + fprintf(stderr,"Error loading bios ROM (%s)\n",s); + exit(EXIT_FAILURE); + } + if (fread(rom_table[0],1024,1,fn) != 1) { + fprintf(stderr,"Error loading bios ROM %s\n",odyssey2); + exit(EXIT_FAILURE); + } + + fclose(fn); + + for (i=1; i<8; i++) + memcpy(rom_table[i],rom_table[0],1024); + + crc = crc32_buf(rom_table[0],1024); + + if (crc==0x8016A315) { + printf("Odyssey2 bios ROM loaded\n"); + app_data.vpp = 0; + app_data.bios = ROM_O2; + } else if (crc==0xE20A9F41) { + printf("Videopac+ G7400 bios ROM loaded\n"); + app_data.vpp = 1; + app_data.bios = ROM_G7400; + } else if (crc==0xA318E8D6) { + if (!((!o2flag)&&(c52flag))) printf("C52 bios ROM loaded\n"); else printf("Ok\n"); + app_data.vpp = 0; + app_data.bios = ROM_C52; + } else if (crc==0x11647CA5) { + if (g74flag) printf("Jopac bios ROM loaded\n"); else printf(" Ok\n"); + app_data.vpp = 1; + app_data.bios = ROM_JOPAC; + } else { + printf("Bios ROM loaded (unknown version)\n"); + app_data.vpp = 0; + app_data.bios = ROM_UNKNOWN; + } +} + +static void load_cart(const char *file){ + FILE *fn; + long l; + int i, nb; + + app_data.crc = crc32_file(file); + if (app_data.crc == 0xAFB23F89) app_data.exrom = 1; /* Musician */ + if (app_data.crc == 0x3BFEF56B) app_data.exrom = 1; /* Four in 1 Row! */ + if (app_data.crc == 0x9B5E9356) app_data.exrom = 1; /* Four in 1 Row! (french) */ + + if (((app_data.crc == 0x975AB8DA) || (app_data.crc == 0xE246A812)) && (!app_data.debug)) { + fprintf(stderr,"Error: file %s is an incomplete ROM dump\n",file_v); + exit(EXIT_FAILURE); + } + + fn=fopen(file,"rb"); + if (!fn) { + fprintf(stderr,"Error loading %s\n",file_v); + exit(EXIT_FAILURE); + } + printf("Loading: \"%s\" Size: ",file_v); + l = filesize(fn); + + if ((l % 1024) != 0) { + fprintf(stderr,"Error: file %s is an invalid ROM dump\n",file_v); + exit(EXIT_FAILURE); + } + + /* special MegaCART design by Soeren Gust */ + if ((l == 32768) || (l == 65536) || (l == 131072) || (l == 262144) || (l == 524288) || (l == 1048576)) { + app_data.megaxrom = 1; + app_data.bank = 1; + megarom = malloc(1048576); + if (megarom == NULL) { + fprintf(stderr, "Out of memory loading %s\n", file); + exit(EXIT_FAILURE); + } + if (fread(megarom, l, 1, fn) != 1) { + fprintf(stderr,"Error loading %s\n",file); + exit(EXIT_FAILURE); + } + + /* mirror shorter files into full megabyte */ + if (l < 65536) memcpy(megarom+32768,megarom,32768); + if (l < 131072) memcpy(megarom+65536,megarom,65536); + if (l < 262144) memcpy(megarom+131072,megarom,131072); + if (l < 524288) memcpy(megarom+262144,megarom,262144); + if (l < 1048576) memcpy(megarom+524288,megarom,524288); + /* start in bank 0xff */ + memcpy(&rom_table[0][1024], megarom + 4096*255 + 1024, 3072); + printf("MegaCart %ldK", l / 1024); + nb = 1; + } else if (((l % 3072) == 0)) + { + app_data.three_k = 1; + nb = l/3072; + + for (i=nb-1; i>=0; i--) { + if (fread(&rom_table[i][1024],3072,1,fn) != 1) { + fprintf(stderr,"Error loading %s\n",file); + exit(EXIT_FAILURE); + } + } + printf("%dK",nb*3); + + } else { + + nb = l/2048; + + if ((nb == 2) && (app_data.exrom)) { + + if (fread(&extROM[0], 1024,1,fn) != 1) { + fprintf(stderr,"Error loading %s\n",file); + exit(EXIT_FAILURE); + } + if (fread(&rom_table[0][1024],3072,1,fn) != 1) { + fprintf(stderr,"Error loading %s\n",file); + exit(EXIT_FAILURE); + } + printf("3K EXROM"); + + } else { + for (i=nb-1; i>=0; i--) { + if (fread(&rom_table[i][1024],2048,1,fn) != 1) { + fprintf(stderr,"Error loading %s\n",file); + exit(EXIT_FAILURE); + } + memcpy(&rom_table[i][3072],&rom_table[i][2048],1024); /* simulate missing A10 */ + } + printf("%dK",nb*2); + } + } + fclose(fn); + rom = rom_table[0]; + if (nb==1) + app_data.bank = 1; + else if (nb==2) + app_data.bank = app_data.exrom ? 1 : 2; + else if (nb==4) + app_data.bank = 3; + else + app_data.bank = 4; + + if ((rom_table[nb-1][1024+12]=='O') && (rom_table[nb-1][1024+13]=='P') && (rom_table[nb-1][1024+14]=='N') && (rom_table[nb-1][1024+15]=='B')) + app_data.openb=1; + + printf(" CRC: %08lX\n",app_data.crc); +} + +void update_joy(void) +{ +} + +static void update_input() +{ + if (!input_poll_cb) + return; + + input_poll_cb(); + + // Joystick + jbt[0]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP); + jbt[1]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN); + jbt[2]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT); + jbt[3]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT); + jbt[4]= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A); // "Action" button on the joystick + + // Numeric and Alpha + key[RETROK_l]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B); // L + key[RETROK_RETURN]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START); // RETURN + key[RETROK_SPACE]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT); // SPACE + key[RETROK_0]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X); // 0 + key[RETROK_1]=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y); // 1 + //TODO: Define more and 2 player support +} + +/************************************ + * libretro implementation + ************************************/ + +static struct retro_system_av_info g_av_info; + +void retro_get_system_info(struct retro_system_info *info) +{ + memset(info, 0, sizeof(*info)); + info->library_name = "O2EM"; + info->library_version = "1.18"; + info->need_fullpath = false; + info->valid_extensions = "bin"; +} + +void retro_get_system_av_info(struct retro_system_av_info *info) +{ + memset(info, 0, sizeof(*info)); + info->timing.fps = evblclk == EVBLCLK_NTSC ? 60 : 50; + info->timing.sample_rate = 44100; + info->geometry.base_width = EMUWIDTH; + info->geometry.base_height = EMUHEIGHT; + info->geometry.max_width = EMUWIDTH; + info->geometry.max_height = EMUHEIGHT; + info->geometry.aspect_ratio = 4.0 / 3.0; +} + +void retro_set_controller_port_device(unsigned port, unsigned device) +{ + (void)port; + (void)device; +} + +size_t retro_serialize_size(void) +{ + //return STATE_SIZE; + return 0; +} + +bool retro_serialize(void *data, size_t size) +{ + //savestate(fileName); + return false; +} + +bool retro_unserialize(const void *data, size_t size) +{ + //loadstate(fileName); + return false; +} + +void retro_cheat_reset(void) +{} + +void retro_cheat_set(unsigned index, bool enabled, const char *code) +{ + (void)index; + (void)enabled; + (void)code; +} + +bool retro_load_game(const struct retro_game_info *info) +{ + enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; + if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) + { + if (log_cb) + log_cb(RETRO_LOG_INFO, "[O2EM]: RGB565 is not supported.\n"); + return false; + } + + const char *full_path; + full_path = info->path; + const char *system_directory_c = NULL; + char bios_file_path[256]; + + // BIOS is required + environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &system_directory_c); + if (!system_directory_c) + { + if (log_cb) + log_cb(RETRO_LOG_WARN, "[O2EM]: no system directory defined, unable to look for o2rom.bin\n"); + return false; + } + else + { + +#ifdef _WIN32 + char slash = '\\'; +#else + char slash = '/'; +#endif + + snprintf(bios_file_path, sizeof(bios_file_path), "%s%c%s", system_directory_c, slash, "o2rom.bin"); + + if (!does_file_exist(bios_file_path)) + { + if (log_cb) + log_cb(RETRO_LOG_WARN, "[O2EM]: o2rom.bin not found, cannot load BIOS\n"); + return false; + } + } + + app_data.debug = 0; + app_data.stick[0] = app_data.stick[1] = 1; + app_data.sticknumber[0] = app_data.sticknumber[1] = 0; + set_defjoykeys(0,0); + set_defjoykeys(1,1); + set_defsystemkeys(); + app_data.bank = 0; + app_data.limit = 1; + app_data.sound_en = 1; + app_data.speed = 100; + app_data.wsize = 2; + app_data.fullscreen = 0; + app_data.scanlines = 0; + app_data.voice = 1; + app_data.window_title = "O2EM v" O2EM_VERSION; + app_data.svolume = 100; + app_data.vvolume = 100; + app_data.filter = 0; + app_data.exrom = 0; + app_data.three_k = 0; + app_data.crc = 0; + app_data.scshot = scshot; + app_data.statefile = statefile; + app_data.euro = 0; + app_data.openb = 0; + app_data.vpp = 0; + app_data.bios = 0; + app_data.scoretype = 0; + app_data.scoreaddress = 0; + app_data.default_highscore = 0; + app_data.breakpoint = 65535; + app_data.megaxrom = 0; + //strcpy(file,""); + //strcpy(file_l,""); + //strcpy(bios_l,""); + //strcpy(bios,""); + //strcpy(scshot,""); + //strcpy(statefile,""); + //strcpy(xrom,""); + strcpy(scorefile,"highscore.txt"); + //read_default_config(); + + init_audio(); + + app_data.crc = crc32_file(full_path); + + //suck_bios(); + o2flag = 1; + + crcx = app_data.crc; + //suck_roms(); + + load_bios(bios_file_path); + + load_cart(full_path); + //if (app_data.voice) load_voice_samples(path2); + + init_display(); + + init_cpu(); + + init_system(); + + set_score(app_data.scoretype, app_data.scoreaddress, app_data.default_highscore); + + return true; +} + +bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info) +{ + (void)game_type; + (void)info; + (void)num_info; + return false; +} + +void retro_unload_game(void) +{ +} + +unsigned retro_get_region(void) +{ + return evblclk == EVBLCLK_NTSC ? RETRO_REGION_NTSC : RETRO_REGION_PAL; +} + +unsigned retro_api_version(void) +{ + return RETRO_API_VERSION; +} + +void *retro_get_memory_data(unsigned id) +{ + return NULL; +} + +size_t retro_get_memory_size(unsigned id) +{ + return 0; +} + +void retro_init(void) +{ + struct retro_log_callback log; + unsigned level = 5; + + if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) + log_cb = log.log; + else + log_cb = NULL; + + environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); + + memset(mbmp, 0, sizeof(mbmp)); + RLOOP=1; +} + +void retro_deinit(void) +{ + close_audio(); + close_voice(); + close_display(); + retro_destroybmp(); +} + +void retro_reset(void) +{ + init_cpu(); + init_roms(); + init_vpp(); + clearscr(); +} + +void retro_run(void) +{ + update_input(); + + cpu_exec(); + RLOOP=1; + + video_cb(mbmp, EMUWIDTH, EMUHEIGHT, TEX_WIDTH << 1); + + int length = evblclk == EVBLCLK_NTSC ? 44100/60 : 44100/50; + // Convert 8u to 16s + for(int i = 0; i != length; i ++) + { + int16_t sample16 = (soundBuffer[i] << 8) - 32768; + int16_t frame[2] = {sample16, sample16}; + audio_cb(frame[0], frame[1]); + } +} diff --git a/libretro.h b/libretro.h new file mode 100755 index 0000000..9b58d9c --- /dev/null +++ b/libretro.h @@ -0,0 +1,1476 @@ +/* Copyright (C) 2010-2014 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro API header (libretro.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIBRETRO_H__ +#define LIBRETRO_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __cplusplus +#if defined(_MSC_VER) && !defined(SN_TARGET_PS3) +/* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */ +#define bool unsigned char +#define true 1 +#define false 0 +#else +#include +#endif +#endif + +// Used for checking API/ABI mismatches that can break libretro implementations. +// It is not incremented for compatible changes to the API. +#define RETRO_API_VERSION 1 + +// +// Libretros fundamental device abstractions. +///////// +// +// Libretros input system consists of some standardized device types such as a joypad (with/without analog), +// mouse, keyboard, lightgun and a pointer. The functionality of these devices are fixed, and individual cores map +// their own concept of a controller to libretros abstractions. +// This makes it possible for frontends to map the abstract types to a real input device, +// and not having to worry about binding input correctly to arbitrary controller layouts. + + +#define RETRO_DEVICE_TYPE_SHIFT 8 +#define RETRO_DEVICE_MASK ((1 << RETRO_DEVICE_TYPE_SHIFT) - 1) +#define RETRO_DEVICE_SUBCLASS(base, id) (((id + 1) << RETRO_DEVICE_TYPE_SHIFT) | base) + +// Input disabled. +#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. +// For event/text based keyboard input, see RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. +#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 + +// Abstracts the concept of a pointing mechanism, e.g. touch. +// This allows libretro to query in absolute coordinates where on the screen a mouse (or something similar) is being placed. +// For a touch centric device, coordinates reported are the coordinates of the press. +// +// Coordinates in X and Y are reported as: +// [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen, +// and 0x7fff corresponds to the far right/bottom of the screen. +// The "screen" is here defined as area that is passed to the frontend and later displayed on the monitor. +// The frontend is free to scale/resize this screen as it sees fit, however, +// (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the game image, etc. +// +// To check if the pointer coordinates are valid (e.g. a touch display actually being touched), +// PRESSED returns 1 or 0. +// If using a mouse on a desktop, PRESSED will usually correspond to the left mouse button, but this is a frontend decision. +// PRESSED will only return 1 if the pointer is inside the game screen. +// +// For multi-touch, the index variable can be used to successively query more presses. +// If index = 0 returns true for _PRESSED, coordinates can be extracted +// with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with index = 1, and so on. +// Eventually _PRESSED will return false for an index. No further presses are registered at this point. +#define RETRO_DEVICE_POINTER 6 + +// 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 +#define RETRO_DEVICE_ID_MOUSE_WHEELUP 4 +#define RETRO_DEVICE_ID_MOUSE_WHEELDOWN 5 +#define RETRO_DEVICE_ID_MOUSE_MIDDLE 6 + +// 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 + +// Id values for POINTER. +#define RETRO_DEVICE_ID_POINTER_X 0 +#define RETRO_DEVICE_ID_POINTER_Y 1 +#define RETRO_DEVICE_ID_POINTER_PRESSED 2 + +// Returned from retro_get_region(). +#define RETRO_REGION_NTSC 0 +#define RETRO_REGION_PAL 1 + +// Id values for LANGUAGE +enum retro_language +{ + RETRO_LANGUAGE_ENGLISH = 0, + RETRO_LANGUAGE_JAPANESE = 1, + RETRO_LANGUAGE_FRENCH = 2, + RETRO_LANGUAGE_SPANISH = 3, + RETRO_LANGUAGE_GERMAN = 4, + RETRO_LANGUAGE_ITALIAN = 5, + RETRO_LANGUAGE_DUTCH = 6, + RETRO_LANGUAGE_PORTUGUESE = 7, + RETRO_LANGUAGE_RUSSIAN = 8, + RETRO_LANGUAGE_KOREAN = 9, + RETRO_LANGUAGE_CHINESE_TRADITIONAL = 10, + RETRO_LANGUAGE_CHINESE_SIMPLIFIED = 11, + RETRO_LANGUAGE_LAST, + + RETRO_LANGUAGE_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +// 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 SAVE_DIRECTORY (preferably) or 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 + +// 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, + + RETROK_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +enum retro_mod +{ + RETROKMOD_NONE = 0x0000, + + RETROKMOD_SHIFT = 0x01, + RETROKMOD_CTRL = 0x02, + RETROKMOD_ALT = 0x04, + RETROKMOD_META = 0x08, + + RETROKMOD_NUMLOCK = 0x10, + RETROKMOD_CAPSLOCK = 0x20, + RETROKMOD_SCROLLOCK = 0x40, + + RETROKMOD_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +// If set, this call is not part of the public libretro API yet. It can change or be removed at any time. +#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000 +// Environment callback to be used internally in frontend. +#define RETRO_ENVIRONMENT_PRIVATE 0x20000 + +// 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. + // +// Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES), and reserved to avoid possible ABI clash. +#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 via RETRO_ENVIRONMENT_GET_LOG_INTERFACE (or as a fallback, 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". + // + // This function can be called on a per-game basis, + // as certain games an implementation can play might be + // particularly 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 content 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. + // + // NOTE: Some cores used this folder also for "save" data such as memory cards, etc, for lack of a better place to put it. + // This is now discouraged, and if possible, cores should try to use the new GET_SAVE_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. +#define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12 + // const struct retro_keyboard_callback * -- + // Sets a callback function used to notify core about keyboard events. + // +#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13 + // const struct retro_disk_control_callback * -- + // Sets an interface which frontend can use to eject and insert disk images. + // This is used for games which consist of multiple images and must be manually + // swapped out by the user (e.g. PSX). +#define RETRO_ENVIRONMENT_SET_HW_RENDER 14 + // struct retro_hw_render_callback * -- + // Sets an interface to let a libretro core render with hardware acceleration. + // Should be called in retro_load_game(). + // If successful, libretro cores will be able to render to a frontend-provided framebuffer. + // The size of this framebuffer will be at least as large as max_width/max_height provided in get_av_info(). + // If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or NULL to retro_video_refresh_t. +#define RETRO_ENVIRONMENT_GET_VARIABLE 15 + // struct retro_variable * -- + // Interface to acquire user-defined information from environment + // that cannot feasibly be supported in a multi-system way. + // 'key' should be set to a key which has already been set by SET_VARIABLES. + // 'data' will be set to a value or NULL. + // +#define RETRO_ENVIRONMENT_SET_VARIABLES 16 + // const struct retro_variable * -- + // Allows an implementation to signal the environment + // which variables it might want to check for later using GET_VARIABLE. + // This allows the frontend to present these variables to a user dynamically. + // This should be called as early as possible (ideally in retro_set_environment). + // + // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element. + // retro_variable::key should be namespaced to not collide with other implementations' keys. E.g. A core called 'foo' should use keys named as 'foo_option'. + // retro_variable::value should contain a human readable description of the key as well as a '|' delimited list of expected values. + // The number of possible options should be very limited, i.e. it should be feasible to cycle through options without a keyboard. + // First entry should be treated as a default. + // + // Example entry: + // { "foo_option", "Speed hack coprocessor X; false|true" } + // + // Text before first ';' is description. This ';' must be followed by a space, and followed by a list of possible values split up with '|'. + // Only strings are operated on. The possible values will generally be displayed and stored as-is by the frontend. + // +#define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17 + // bool * -- + // Result is set to true if some variables are updated by + // frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE. + // Variables should be queried with GET_VARIABLE. + // +#define RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME 18 + // const bool * -- + // If true, the libretro implementation supports calls to retro_load_game() with NULL as argument. + // Used by cores which can run without particular game data. + // This should be called within retro_set_environment() only. + // +#define RETRO_ENVIRONMENT_GET_LIBRETRO_PATH 19 + // const char ** -- + // Retrieves the absolute path from where this libretro implementation was loaded. + // NULL is returned if the libretro was loaded statically (i.e. linked statically to frontend), or if the path cannot be determined. + // Mostly useful in cooperation with SET_SUPPORT_NO_GAME as assets can be loaded without ugly hacks. + // + // +// Environment 20 was an obsolete version of SET_AUDIO_CALLBACK. It was not used by any known core at the time, +// and was removed from the API. +#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22 + // const struct retro_audio_callback * -- + // Sets an interface which is used to notify a libretro core about audio being available for writing. + // The callback can be called from any thread, so a core using this must have a thread safe audio implementation. + // It is intended for games where audio and video are completely asynchronous and audio can be generated on the fly. + // This interface is not recommended for use with emulators which have highly synchronous audio. + // + // The callback only notifies about writability; the libretro core still has to call the normal audio callbacks + // to write audio. The audio callbacks must be called from within the notification callback. + // The amount of audio data to write is up to the implementation. + // Generally, the audio callback will be called continously in a loop. + // + // Due to thread safety guarantees and lack of sync between audio and video, a frontend + // can selectively disallow this interface based on internal configuration. A core using + // this interface must also implement the "normal" audio interface. + // + // A libretro core using SET_AUDIO_CALLBACK should also make use of SET_FRAME_TIME_CALLBACK. +#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21 + // const struct retro_frame_time_callback * -- + // Lets the core know how much time has passed since last invocation of retro_run(). + // The frontend can tamper with the timing to fake fast-forward, slow-motion, frame stepping, etc. + // In this case the delta time will use the reference value in frame_time_callback.. + // +#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23 + // struct retro_rumble_interface * -- + // Gets an interface which is used by a libretro core to set state of rumble motors in controllers. + // A strong and weak motor is supported, and they can be controlled indepedently. + // +#define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24 + // uint64_t * -- + // Gets a bitmask telling which device type are expected to be handled properly in a call to retro_input_state_t. + // Devices which are not handled or recognized always return 0 in retro_input_state_t. + // Example bitmask: caps = (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG). + // Should only be called in retro_run(). + // +#define RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE (25 | RETRO_ENVIRONMENT_EXPERIMENTAL) + // struct retro_sensor_interface * -- + // Gets access to the sensor interface. + // The purpose of this interface is to allow + // setting state related to sensors such as polling rate, enabling/disable it entirely, etc. + // Reading sensor state is done via the normal input_state_callback API. + // +#define RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE (26 | RETRO_ENVIRONMENT_EXPERIMENTAL) + // struct retro_camera_callback * -- + // Gets an interface to a video camera driver. + // A libretro core can use this interface to get access to a video camera. + // New video frames are delivered in a callback in same thread as retro_run(). + // + // GET_CAMERA_INTERFACE should be called in retro_load_game(). + // + // Depending on the camera implementation used, camera frames will be delivered as a raw framebuffer, + // or as an OpenGL texture directly. + // + // The core has to tell the frontend here which types of buffers can be handled properly. + // An OpenGL texture can only be handled when using a libretro GL core (SET_HW_RENDER). + // It is recommended to use a libretro GL core when using camera interface. + // + // The camera is not started automatically. The retrieved start/stop functions must be used to explicitly + // start and stop the camera driver. + // +#define RETRO_ENVIRONMENT_GET_LOG_INTERFACE 27 + // struct retro_log_callback * -- + // Gets an interface for logging. This is useful for logging in a cross-platform way + // as certain platforms cannot use use stderr for logging. It also allows the frontend to + // show logging information in a more suitable way. + // If this interface is not used, libretro cores should log to stderr as desired. +#define RETRO_ENVIRONMENT_GET_PERF_INTERFACE 28 + // struct retro_perf_callback * -- + // Gets an interface for performance counters. This is useful for performance logging in a + // cross-platform way and for detecting architecture-specific features, such as SIMD support. +#define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE 29 + // struct retro_location_callback * -- + // Gets access to the location interface. + // The purpose of this interface is to be able to retrieve location-based information from the host device, + // such as current latitude / longitude. + // +#define RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY 30 + // const char ** -- + // Returns the "content" directory of the frontend. + // This directory can be used to store specific assets that the core relies upon, such as art assets, + // input data, etc 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_GET_SAVE_DIRECTORY 31 + // const char ** -- + // Returns the "save" directory of the frontend. + // This directory can be used to store SRAM, memory cards, high scores, etc, if the libretro core + // cannot use the regular memory interface (retro_get_memory_data()). + // + // NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for similar things before. + // They should still check GET_SYSTEM_DIRECTORY if they want to be backwards compatible. + // The path here can be NULL. It should only be non-NULL if the frontend user has set a specific save path. + // +#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32 + // const struct retro_system_av_info * -- + // Sets a new av_info structure. This can only be called from within retro_run(). + // This should *only* be used if the core is completely altering the internal resolutions, aspect ratios, timings, sampling rate, etc. + // Calling this can require a full reinitialization of video/audio drivers in the frontend, + // so it is important to call it very sparingly, and usually only with the users explicit consent. + // An eventual driver reinitialize will happen so that video and audio callbacks + // happening after this call within the same retro_run() call will target the newly initialized driver. + // + // This callback makes it possible to support configurable resolutions in games, which can be useful to + // avoid setting the "worst case" in max_width/max_height. + // + // ***HIGHLY RECOMMENDED*** Do not call this callback every time resolution changes in an emulator core if it's + // expected to be a temporary change, for the reasons of possible driver reinitialization. + // This call is not a free pass for not trying to provide correct values in retro_get_system_av_info(). If you need to change things like aspect ratio or nominal width/height, use RETRO_ENVIRONMENT_SET_GEOMETRY, which is a softer variant of SET_SYSTEM_AV_INFO. + // + // If this returns false, the frontend does not acknowledge a changed av_info struct. +#define RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK 33 + // const struct retro_get_proc_address_interface * -- + // Allows a libretro core to announce support for the get_proc_address() interface. + // This interface allows for a standard way to extend libretro where use of environment calls are too indirect, + // e.g. for cases where the frontend wants to call directly into the core. + // + // If a core wants to expose this interface, SET_PROC_ADDRESS_CALLBACK **MUST** be called from within retro_set_environment(). + // +#define RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO 34 + // const struct retro_subsystem_info * -- + // This environment call introduces the concept of libretro "subsystems". + // A subsystem is a variant of a libretro core which supports different kinds of games. + // The purpose of this is to support e.g. emulators which might have special needs, e.g. Super Nintendos Super GameBoy, Sufami Turbo. + // It can also be used to pick among subsystems in an explicit way if the libretro implementation is a multi-system emulator itself. + // + // Loading a game via a subsystem is done with retro_load_game_special(), + // and this environment call allows a libretro core to expose which subsystems are supported for use with retro_load_game_special(). + // A core passes an array of retro_game_special_info which is terminated with a zeroed out retro_game_special_info struct. + // + // If a core wants to use this functionality, SET_SUBSYSTEM_INFO **MUST** be called from within retro_set_environment(). + // +#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35 + // const struct retro_controller_info * -- + // This environment call lets a libretro core tell the frontend which + // controller types are recognized in calls to retro_set_controller_port_device(). + // + // Some emulators such as Super Nintendo + // support multiple lightgun types which must be specifically selected from. + // It is therefore sometimes necessary for a frontend to be able to tell + // the core about a special kind of input device which is not covered by the + // libretro input API. + // + // In order for a frontend to understand the workings of an input device, + // it must be a specialized type + // of the generic device types already defined in the libretro API. + // + // Which devices are supported can vary per input port. + // The core must pass an array of const struct retro_controller_info which is terminated with + // a blanked out struct. Each element of the struct corresponds to an ascending port index to retro_set_controller_port_device(). + // Even if special device types are set in the libretro core, libretro should only poll input based on the base input device types. +#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL) + // const struct retro_memory_map * -- + // This environment call lets a libretro core tell the frontend about the memory maps this + // core emulates. This can be used to implement, for example, cheats in a core-agnostic way. + // + // Should only be used by emulators; it doesn't make much sense for anything else. + // It is recommended to expose all relevant pointers through retro_get_memory_* as well. + // + // Can be called from retro_init and retro_load_game. + // +#define RETRO_ENVIRONMENT_SET_GEOMETRY 37 + // const struct retro_game_geometry * -- + // This environment call is similar to SET_SYSTEM_AV_INFO for changing video parameters, + // but provides a guarantee that drivers will not be reinitialized. + // This can only be called from within retro_run(). + // + // The purpose of this call is to allow a core to alter nominal width/heights as well as aspect ratios on-the-fly, + // which can be useful for some emulators to change in run-time. + // + // max_width/max_height arguments are ignored and cannot be changed + // with this call as this could potentially require a reinitialization or a non-constant time operation. + // If max_width/max_height are to be changed, SET_SYSTEM_AV_INFO is required. + // + // A frontend must guarantee that this environment call completes in constant time. + +#define RETRO_ENVIRONMENT_GET_USERNAME 38 + // const char ** + // Returns the specified username of the frontend, if specified by the user. + // This username can be used as a nickname for a core that has online facilities or any other mode where personalization // of the user is desirable. + // The returned value can be NULL. + // If this environ callback is used by a core that requires a valid username, a default username should be specified + // by the core. + // + // +#define RETRO_ENVIRONMENT_GET_LANGUAGE 39 + // const unsigned * -- + // Returns the specified language of the frontend, if specified by the user. + // It can be used by the core for localization purposes. + // + +#define RETRO_MEMDESC_CONST (1 << 0) // The frontend will never change this memory area once retro_load_game has returned. +#define RETRO_MEMDESC_BIGENDIAN (1 << 1) // The memory area contains big endian data. Default is little endian. +#define RETRO_MEMDESC_ALIGN_2 (1 << 16) // All memory access in this area is aligned to their own size, or 2, whichever is smaller. +#define RETRO_MEMDESC_ALIGN_4 (2 << 16) +#define RETRO_MEMDESC_ALIGN_8 (3 << 16) +#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) // All memory in this region is accessed at least 2 bytes at the time. +#define RETRO_MEMDESC_MINSIZE_4 (2 << 24) +#define RETRO_MEMDESC_MINSIZE_8 (3 << 24) +struct retro_memory_descriptor +{ + uint64_t flags; + + // Pointer to the start of the relevant ROM or RAM chip. + // It's strongly recommended to use 'offset' if possible, rather than doing math on the pointer. + // If the same byte is mapped my multiple descriptors, their descriptors must have the same pointer. + // If 'start' does not point to the first byte in the pointer, put the difference in 'offset' instead. + // May be NULL if there's nothing usable here (e.g. hardware registers and open bus). No flags should be set if the pointer is NULL. + // It's recommended to minimize the number of descriptors if possible, but not mandatory. + void *ptr; + size_t offset; + + // This is the location in the emulated address space where the mapping starts. + size_t start; + + // Which bits must be same as in 'start' for this mapping to apply. + // The first memory descriptor to claim a certain byte is the one that applies. + // A bit which is set in 'start' must also be set in this. + // Can be zero, in which case each byte is assumed mapped exactly once. In this case, 'len' must be a power of two. + size_t select; + + // If this is nonzero, the set bits are assumed not connected to the memory chip's address pins. + size_t disconnect; + + // This one tells the size of the current memory area. + // If, after start+disconnect are applied, the address is higher than this, the highest bit of the address is cleared. + // If the address is still too high, the next highest bit is cleared. + // Can be zero, in which case it's assumed to be infinite (as limited by 'select' and 'disconnect'). + size_t len; + + // To go from emulated address to physical address, the following order applies: + // Subtract 'start', pick off 'disconnect', apply 'len', add 'offset'. + + // The address space name must consist of only a-zA-Z0-9_-, should be as short as feasible (maximum length is 8 plus the NUL), + // and may not be any other address space plus one or more 0-9A-F at the end. + // However, multiple memory descriptors for the same address space is allowed, and the address + // space name can be empty. NULL is treated as empty. + // Address space names are case sensitive, but avoid lowercase if possible. + // The same pointer may exist in multiple address spaces. + // Examples: + // blank+blank - valid (multiple things may be mapped in the same namespace) + // 'Sp'+'Sp' - valid (multiple things may be mapped in the same namespace) + // 'A'+'B' - valid (neither is a prefix of each other) + // 'S'+blank - valid ('S' is not in 0-9A-F) + // 'a'+blank - valid ('a' is not in 0-9A-F) + // 'a'+'A' - valid (neither is a prefix of each other) + // 'AR'+blank - valid ('R' is not in 0-9A-F) + // 'ARB'+blank - valid (the B can't be part of the address either, because there is no namespace 'AR') + // blank+'B' - not valid, because it's ambigous which address space B1234 would refer to. + // The length can't be used for that purpose; the frontend may want to append arbitrary data to an address, without a separator. + const char *addrspace; +}; +// The frontend may use the largest value of 'start'+'select' in a certain namespace to infer the size of the address space. +// If the address space is larger than that, a mapping with .ptr=NULL should be at the end of the array, with .select set to all ones for as long as the address space is big. +// Sample descriptors (minus .ptr, and RETRO_MEMFLAG_ on the flags): +// SNES WRAM: +// .start=0x7E0000, .len=0x20000 +// (Note that this must be mapped before the ROM in most cases; some of the ROM mappers try to claim $7E0000, or at least $7E8000.) +// SNES SPC700 RAM: +// .addrspace="S", .len=0x10000 +// SNES WRAM mirrors: +// .flags=MIRROR, .start=0x000000, .select=0xC0E000, .len=0x2000 +// .flags=MIRROR, .start=0x800000, .select=0xC0E000, .len=0x2000 +// SNES WRAM mirrors, alternate equivalent descriptor: +// .flags=MIRROR, .select=0x40E000, .disconnect=~0x1FFF +// (Various similar constructions can be created by combining parts of the above two.) +// SNES LoROM (512KB, mirrored a couple of times): +// .flags=CONST, .start=0x008000, .select=0x408000, .disconnect=0x8000, .len=512*1024 +// .flags=CONST, .start=0x400000, .select=0x400000, .disconnect=0x8000, .len=512*1024 +// SNES HiROM (4MB): +// .flags=CONST, .start=0x400000, .select=0x400000, .len=4*1024*1024 +// .flags=CONST, .offset=0x8000, .start=0x008000, .select=0x408000, .len=4*1024*1024 +// SNES ExHiROM (8MB): +// .flags=CONST, .offset=0, .start=0xC00000, .select=0xC00000, .len=4*1024*1024 +// .flags=CONST, .offset=4*1024*1024, .start=0x400000, .select=0xC00000, .len=4*1024*1024 +// .flags=CONST, .offset=0x8000, .start=0x808000, .select=0xC08000, .len=4*1024*1024 +// .flags=CONST, .offset=4*1024*1024+0x8000, .start=0x008000, .select=0xC08000, .len=4*1024*1024 +// Clarify the size of the address space: +// .ptr=NULL, .select=0xFFFFFF +// .len can be implied by .select in many of them, but was included for clarity. + +struct retro_memory_map +{ + const struct retro_memory_descriptor *descriptors; + unsigned num_descriptors; +}; + +struct retro_controller_description +{ + // Human-readable description of the controller. Even if using a generic input device type, this can be + // set to the particular device type the core uses. + const char *desc; + + // Device type passed to retro_set_controller_port_device(). If the device type is a sub-class of a generic input device type, + // use the RETRO_DEVICE_SUBCLASS macro to create an ID. E.g. RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1). + unsigned id; +}; + +struct retro_controller_info +{ + const struct retro_controller_description *types; + unsigned num_types; +}; + +struct retro_subsystem_memory_info +{ + const char *extension; // The extension associated with a memory type, e.g. "psram". + unsigned type; // The memory type for retro_get_memory(). This should be at least 0x100 to avoid conflict with standardized libretro memory types. +}; + +struct retro_subsystem_rom_info +{ + const char *desc; // Describes what the content is (SGB bios, GB rom, etc). + const char *valid_extensions; // Same definition as retro_get_system_info(). + bool need_fullpath; // Same definition as retro_get_system_info(). + bool block_extract; // Same definition as retro_get_system_info(). + bool required; // This is set if the content is required to load a game. If this is set to false, a zeroed-out retro_game_info can be passed. + + // Content can have multiple associated persistent memory types (retro_get_memory()). + const struct retro_subsystem_memory_info *memory; + unsigned num_memory; +}; + +struct retro_subsystem_info +{ + const char *desc; // Human-readable string of the subsystem type, e.g. "Super GameBoy" + // A computer friendly short string identifier for the subsystem type. + // This name must be [a-z]. + // E.g. if desc is "Super GameBoy", this can be "sgb". + // This identifier can be used for command-line interfaces, etc. + const char *ident; + + // Infos for each content file. The first entry is assumed to be the "most significant" content for frontend purposes. + // E.g. with Super GameBoy, the first content should be the GameBoy ROM, as it is the most "significant" content to a user. + // If a frontend creates new file paths based on the content used (e.g. savestates), it should use the path for the first ROM to do so. + const struct retro_subsystem_rom_info *roms; + + unsigned num_roms; // Number of content files associated with a subsystem. + unsigned id; // The type passed to retro_load_game_special(). +}; + +typedef void (*retro_proc_address_t)(void); +// libretro API extension functions: +// (None here so far). +////// + +// Get a symbol from a libretro core. +// Cores should only return symbols which are actual extensions to the libretro API. +// Frontends should not use this to obtain symbols to standard libretro entry points (static linking or dlsym). +// The symbol name must be equal to the function name, e.g. if void retro_foo(void); exists, the symbol must be called "retro_foo". +// The returned function pointer must be cast to the corresponding type. +typedef retro_proc_address_t (*retro_get_proc_address_t)(const char *sym); +struct retro_get_proc_address_interface +{ + retro_get_proc_address_t get_proc_address; +}; + +enum retro_log_level +{ + RETRO_LOG_DEBUG = 0, + RETRO_LOG_INFO, + RETRO_LOG_WARN, + RETRO_LOG_ERROR, + + RETRO_LOG_DUMMY = INT_MAX +}; + +// Logging function. Takes log level argument as well. +typedef void (*retro_log_printf_t)(enum retro_log_level level, const char *fmt, ...); + +struct retro_log_callback +{ + retro_log_printf_t log; +}; + +// Performance related functions +// +// ID values for SIMD CPU features +#define RETRO_SIMD_SSE (1 << 0) +#define RETRO_SIMD_SSE2 (1 << 1) +#define RETRO_SIMD_VMX (1 << 2) +#define RETRO_SIMD_VMX128 (1 << 3) +#define RETRO_SIMD_AVX (1 << 4) +#define RETRO_SIMD_NEON (1 << 5) +#define RETRO_SIMD_SSE3 (1 << 6) +#define RETRO_SIMD_SSSE3 (1 << 7) +#define RETRO_SIMD_MMX (1 << 8) +#define RETRO_SIMD_MMXEXT (1 << 9) +#define RETRO_SIMD_SSE4 (1 << 10) +#define RETRO_SIMD_SSE42 (1 << 11) +#define RETRO_SIMD_AVX2 (1 << 12) +#define RETRO_SIMD_VFPU (1 << 13) +#define RETRO_SIMD_PS (1 << 14) + +typedef uint64_t retro_perf_tick_t; +typedef int64_t retro_time_t; + +struct retro_perf_counter +{ + const char *ident; + retro_perf_tick_t start; + retro_perf_tick_t total; + retro_perf_tick_t call_cnt; + + bool registered; +}; + +// Returns current time in microseconds. Tries to use the most accurate timer available. +typedef retro_time_t (*retro_perf_get_time_usec_t)(void); +// A simple counter. Usually nanoseconds, but can also be CPU cycles. +// Can be used directly if desired (when creating a more sophisticated performance counter system). +typedef retro_perf_tick_t (*retro_perf_get_counter_t)(void); +// Returns a bit-mask of detected CPU features (RETRO_SIMD_*). +typedef uint64_t (*retro_get_cpu_features_t)(void); +// Asks frontend to log and/or display the state of performance counters. +// Performance counters can always be poked into manually as well. +typedef void (*retro_perf_log_t)(void); +// Register a performance counter. +// ident field must be set with a discrete value and other values in retro_perf_counter must be 0. +// Registering can be called multiple times. To avoid calling to frontend redundantly, you can check registered field first. +typedef void (*retro_perf_register_t)(struct retro_perf_counter *counter); +// Starts and stops a registered counter. +typedef void (*retro_perf_start_t)(struct retro_perf_counter *counter); +typedef void (*retro_perf_stop_t)(struct retro_perf_counter *counter); + +// For convenience it can be useful to wrap register, start and stop in macros. +// E.g.: +// #ifdef LOG_PERFORMANCE +// #define RETRO_PERFORMANCE_INIT(perf_cb, name) static struct retro_perf_counter name = {#name}; if (!name.registered) perf_cb.perf_register(&(name)) +// #define RETRO_PERFORMANCE_START(perf_cb, name) perf_cb.perf_start(&(name)) +// #define RETRO_PERFORMANCE_STOP(perf_cb, name) perf_cb.perf_stop(&(name)) +// #else +// ... Blank macros ... +// #endif +// These can then be used mid-functions around code snippets. +// +// extern struct retro_perf_callback perf_cb; // Somewhere in the core. +// +// void do_some_heavy_work(void) +// { +// RETRO_PERFORMANCE_INIT(cb, work_1); +// RETRO_PERFORMANCE_START(cb, work_1); +// heavy_work_1(); +// RETRO_PERFORMANCE_STOP(cb, work_1); +// +// RETRO_PERFORMANCE_INIT(cb, work_2); +// RETRO_PERFORMANCE_START(cb, work_2); +// heavy_work_2(); +// RETRO_PERFORMANCE_STOP(cb, work_2); +// } +// +// void retro_deinit(void) +// { +// perf_cb.perf_log(); // Log all perf counters here for example. +// } + +struct retro_perf_callback +{ + retro_perf_get_time_usec_t get_time_usec; + retro_get_cpu_features_t get_cpu_features; + + retro_perf_get_counter_t get_perf_counter; + retro_perf_register_t perf_register; + retro_perf_start_t perf_start; + retro_perf_stop_t perf_stop; + retro_perf_log_t perf_log; +}; + +// FIXME: Document the sensor API and work out behavior. +// It will be marked as experimental until then. +enum retro_sensor_action +{ + RETRO_SENSOR_ACCELEROMETER_ENABLE = 0, + RETRO_SENSOR_ACCELEROMETER_DISABLE, + + RETRO_SENSOR_DUMMY = INT_MAX +}; + +// Id values for SENSOR types. +#define RETRO_SENSOR_ACCELEROMETER_X 0 +#define RETRO_SENSOR_ACCELEROMETER_Y 1 +#define RETRO_SENSOR_ACCELEROMETER_Z 2 + +typedef bool (*retro_set_sensor_state_t)(unsigned port, enum retro_sensor_action action, unsigned rate); +typedef float (*retro_sensor_get_input_t)(unsigned port, unsigned id); +struct retro_sensor_interface +{ + retro_set_sensor_state_t set_sensor_state; + retro_sensor_get_input_t get_sensor_input; +}; +//// + +enum retro_camera_buffer +{ + RETRO_CAMERA_BUFFER_OPENGL_TEXTURE = 0, + RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER, + + RETRO_CAMERA_BUFFER_DUMMY = INT_MAX +}; + +// Starts the camera driver. Can only be called in retro_run(). +typedef bool (*retro_camera_start_t)(void); +// Stops the camera driver. Can only be called in retro_run(). +typedef void (*retro_camera_stop_t)(void); +// Callback which signals when the camera driver is initialized and/or deinitialized. +// retro_camera_start_t can be called in initialized callback. +typedef void (*retro_camera_lifetime_status_t)(void); +// A callback for raw framebuffer data. buffer points to an XRGB8888 buffer. +// Width, height and pitch are similar to retro_video_refresh_t. +// First pixel is top-left origin. +typedef void (*retro_camera_frame_raw_framebuffer_t)(const uint32_t *buffer, unsigned width, unsigned height, size_t pitch); +// A callback for when OpenGL textures are used. +// +// texture_id is a texture owned by camera driver. +// Its state or content should be considered immutable, except for things like texture filtering and clamping. +// +// texture_target is the texture target for the GL texture. +// These can include e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE, and possibly more depending on extensions. +// +// affine points to a packed 3x3 column-major matrix used to apply an affine transform to texture coordinates. (affine_matrix * vec3(coord_x, coord_y, 1.0)) +// After transform, normalized texture coord (0, 0) should be bottom-left and (1, 1) should be top-right (or (width, height) for RECTANGLE). +// +// GL-specific typedefs are avoided here to avoid relying on gl.h in the API definition. +typedef void (*retro_camera_frame_opengl_texture_t)(unsigned texture_id, unsigned texture_target, const float *affine); +struct retro_camera_callback +{ + uint64_t caps; // Set by libretro core. Example bitmask: caps = (1 << RETRO_CAMERA_BUFFER_OPENGL_TEXTURE) | (1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER). + + unsigned width; // Desired resolution for camera. Is only used as a hint. + unsigned height; + retro_camera_start_t start; // Set by frontend. + retro_camera_stop_t stop; // Set by frontend. + + retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer; // Set by libretro core if raw framebuffer callbacks will be used. + retro_camera_frame_opengl_texture_t frame_opengl_texture; // Set by libretro core if OpenGL texture callbacks will be used. + + // Set by libretro core. Called after camera driver is initialized and ready to be started. + // Can be NULL, in which this callback is not called. + retro_camera_lifetime_status_t initialized; + + // Set by libretro core. Called right before camera driver is deinitialized. + // Can be NULL, in which this callback is not called. + retro_camera_lifetime_status_t deinitialized; +}; + +// Sets the interval of time and/or distance at which to update/poll location-based data. +// To ensure compatibility with all location-based implementations, values for both +// interval_ms and interval_distance should be provided. +// interval_ms is the interval expressed in milliseconds. +// interval_distance is the distance interval expressed in meters. +typedef void (*retro_location_set_interval_t)(unsigned interval_ms, unsigned interval_distance); + +// Start location services. The device will start listening for changes to the +// current location at regular intervals (which are defined with retro_location_set_interval_t). +typedef bool (*retro_location_start_t)(void); + +// Stop location services. The device will stop listening for changes to the current +// location. +typedef void (*retro_location_stop_t)(void); + +// Get the position of the current location. Will set parameters to 0 if no new +// location update has happened since the last time. +typedef bool (*retro_location_get_position_t)(double *lat, double *lon, double *horiz_accuracy, + double *vert_accuracy); + +// Callback which signals when the location driver is initialized and/or deinitialized. +// retro_location_start_t can be called in initialized callback. +typedef void (*retro_location_lifetime_status_t)(void); + +struct retro_location_callback +{ + retro_location_start_t start; + retro_location_stop_t stop; + retro_location_get_position_t get_position; + retro_location_set_interval_t set_interval; + + retro_location_lifetime_status_t initialized; + retro_location_lifetime_status_t deinitialized; +}; + +enum retro_rumble_effect +{ + RETRO_RUMBLE_STRONG = 0, + RETRO_RUMBLE_WEAK = 1, + + RETRO_RUMBLE_DUMMY = INT_MAX +}; + +// Sets rumble state for joypad plugged in port 'port'. Rumble effects are controlled independently, +// and setting e.g. strong rumble does not override weak rumble. +// Strength has a range of [0, 0xffff]. +// +// Returns true if rumble state request was honored. Calling this before first retro_run() is likely to return false. +typedef bool (*retro_set_rumble_state_t)(unsigned port, enum retro_rumble_effect effect, uint16_t strength); +struct retro_rumble_interface +{ + retro_set_rumble_state_t set_rumble_state; +}; + +// Notifies libretro that audio data should be written. +typedef void (*retro_audio_callback_t)(void); + +// True: Audio driver in frontend is active, and callback is expected to be called regularily. +// False: Audio driver in frontend is paused or inactive. Audio callback will not be called until set_state has been called with true. +// Initial state is false (inactive). +typedef void (*retro_audio_set_state_callback_t)(bool enabled); +struct retro_audio_callback +{ + retro_audio_callback_t callback; + retro_audio_set_state_callback_t set_state; +}; + +// Notifies a libretro core of time spent since last invocation of retro_run() in microseconds. +// It will be called right before retro_run() every frame. +// The frontend can tamper with timing to support cases like fast-forward, slow-motion and framestepping. +// In those scenarios the reference frame time value will be used. +typedef int64_t retro_usec_t; +typedef void (*retro_frame_time_callback_t)(retro_usec_t usec); +struct retro_frame_time_callback +{ + retro_frame_time_callback_t callback; + retro_usec_t reference; // Represents the time of one frame. It is computed as 1000000 / fps, but the implementation will resolve the rounding to ensure that framestepping, etc is exact. +}; + +// Pass this to retro_video_refresh_t if rendering to hardware. +// Passing NULL to retro_video_refresh_t is still a frame dupe as normal. +#define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1) + +// Invalidates the current HW context. +// Any GL state is lost, and must not be deinitialized explicitly. If explicit deinitialization is desired by the libretro core, +// it should implement context_destroy callback. +// If called, all GPU resources must be reinitialized. +// Usually called when frontend reinits video driver. +// Also called first time video driver is initialized, allowing libretro core to initialize resources. +typedef void (*retro_hw_context_reset_t)(void); +// Gets current framebuffer which is to be rendered to. Could change every frame potentially. +typedef uintptr_t (*retro_hw_get_current_framebuffer_t)(void); + +// Get a symbol from HW context. +typedef retro_proc_address_t (*retro_hw_get_proc_address_t)(const char *sym); + +enum retro_hw_context_type +{ + RETRO_HW_CONTEXT_NONE = 0, + RETRO_HW_CONTEXT_OPENGL = 1, // OpenGL 2.x. Driver can choose to use latest compatibility context. + RETRO_HW_CONTEXT_OPENGLES2 = 2, // GLES 2.0 + RETRO_HW_CONTEXT_OPENGL_CORE = 3, // Modern desktop core GL context. Use version_major/version_minor fields to set GL version. + RETRO_HW_CONTEXT_OPENGLES3 = 4, // GLES 3.0 + RETRO_HW_CONTEXT_OPENGLES_VERSION = 5, // GLES 3.1+. Set version_major/version_minor. For GLES2 and GLES3, use the corresponding enums directly. + + RETRO_HW_CONTEXT_DUMMY = INT_MAX +}; + +struct retro_hw_render_callback +{ + enum retro_hw_context_type context_type; // Which API to use. Set by libretro core. + + // Called when a context has been created or when it has been reset. + // An OpenGL context is only valid after context_reset() has been called. + // + // When context_reset is called, OpenGL resources in the libretro implementation are guaranteed to be invalid. + // It is possible that context_reset is called multiple times during an application lifecycle. + // If context_reset is called without any notification (context_destroy), + // the OpenGL context was lost and resources should just be recreated + // without any attempt to "free" old resources. + retro_hw_context_reset_t context_reset; + + retro_hw_get_current_framebuffer_t get_current_framebuffer; // Set by frontend. + retro_hw_get_proc_address_t get_proc_address; // Set by frontend. + bool depth; // Set if render buffers should have depth component attached. + bool stencil; // Set if stencil buffers should be attached. + // If depth and stencil are true, a packed 24/8 buffer will be added. Only attaching stencil is invalid and will be ignored. + bool bottom_left_origin; // Use conventional bottom-left origin convention. Is false, standard libretro top-left origin semantics are used. + unsigned version_major; // Major version number for core GL context or GLES 3.1+. + unsigned version_minor; // Minor version number for core GL context or GLES 3.1+. + + bool cache_context; // If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling fullscreen, etc. + // The reset callback might still be called in extreme situations such as if the context is lost beyond recovery. + // For optimal stability, set this to false, and allow context to be reset at any time. + + retro_hw_context_reset_t context_destroy; // A callback to be called before the context is destroyed in a controlled way by the frontend. + // OpenGL resources can be deinitialized cleanly at this step. + // context_destroy can be set to NULL, in which resources will just be destroyed without any notification. + // + // Even when context_destroy is non-NULL, it is possible that context_reset is called without any destroy notification. + // This happens if context is lost by external factors (such as notified by GL_ARB_robustness). + // In this case, the context is assumed to be already dead, + // and the libretro implementation must not try to free any OpenGL resources in the subsequent context_reset. + + bool debug_context; // Creates a debug context. +}; + +// Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. +// down is set if the key is being pressed, or false if it is being released. +// keycode is the RETROK value of the char. +// character is the text character of the pressed key. (UTF-32). +// key_modifiers is a set of RETROKMOD values or'ed together. +// +// The pressed/keycode state can be indepedent of the character. +// It is also possible that multiple characters are generated from a single keypress. +// Keycode events should be treated separately from character events. +// However, when possible, the frontend should try to synchronize these. +// If only a character is posted, keycode should be RETROK_UNKNOWN. +// Similarily if only a keycode event is generated with no corresponding character, character should be 0. +typedef void (*retro_keyboard_event_t)(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers); + +struct retro_keyboard_callback +{ + retro_keyboard_event_t callback; +}; + +// Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. +// Should be set for implementations which can swap out multiple disk images in runtime. +// If the implementation can do this automatically, it should strive to do so. +// However, there are cases where the user must manually do so. +// +// Overview: To swap a disk image, eject the disk image with set_eject_state(true). +// Set the disk index with set_image_index(index). Insert the disk again with set_eject_state(false). + +// If ejected is true, "ejects" the virtual disk tray. +// When ejected, the disk image index can be set. +typedef bool (*retro_set_eject_state_t)(bool ejected); +// Gets current eject state. The initial state is 'not ejected'. +typedef bool (*retro_get_eject_state_t)(void); +// Gets current disk index. First disk is index 0. +// If return value is >= get_num_images(), no disk is currently inserted. +typedef unsigned (*retro_get_image_index_t)(void); +// Sets image index. Can only be called when disk is ejected. +// The implementation supports setting "no disk" by using an index >= get_num_images(). +typedef bool (*retro_set_image_index_t)(unsigned index); +// Gets total number of images which are available to use. +typedef unsigned (*retro_get_num_images_t)(void); +// +// Replaces the disk image associated with index. +// Arguments to pass in info have same requirements as retro_load_game(). +// Virtual disk tray must be ejected when calling this. +// Replacing a disk image with info = NULL will remove the disk image from the internal list. +// As a result, calls to get_image_index() can change. +// +// E.g. replace_image_index(1, NULL), and previous get_image_index() returned 4 before. +// Index 1 will be removed, and the new index is 3. +struct retro_game_info; +typedef bool (*retro_replace_image_index_t)(unsigned index, const struct retro_game_info *info); +// Adds a new valid index (get_num_images()) to the internal disk list. +// This will increment subsequent return values from get_num_images() by 1. +// This image index cannot be used until a disk image has been set with replace_image_index. +typedef bool (*retro_add_image_index_t)(void); + +struct retro_disk_control_callback +{ + retro_set_eject_state_t set_eject_state; + retro_get_eject_state_t get_eject_state; + + retro_get_image_index_t get_image_index; + retro_set_image_index_t set_image_index; + retro_get_num_images_t get_num_images; + + retro_replace_image_index_t replace_image_index; + retro_add_image_index_t add_image_index; +}; + +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 content. + // 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'. +// By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all available ports. +// Setting a particular device type is not a guarantee that libretro cores will only poll input based on that particular device type. It is only a hint to the libretro core when a core cannot automatically detect the appropriate input device type on its own. It is also relevant when a core can change its behavior depending on device type. +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 diff --git a/O2EM/sources/libretro/link.T b/link.T old mode 100755 new mode 100644 similarity index 100% rename from O2EM/sources/libretro/link.T rename to link.T diff --git a/O2EM/sources/src/Makefile b/src/Makefile similarity index 100% rename from O2EM/sources/src/Makefile rename to src/Makefile diff --git a/O2EM/sources/src/Makefile.djgpp b/src/Makefile.djgpp similarity index 100% rename from O2EM/sources/src/Makefile.djgpp rename to src/Makefile.djgpp diff --git a/O2EM/sources/src/Makefile.freebsd b/src/Makefile.freebsd similarity index 100% rename from O2EM/sources/src/Makefile.freebsd rename to src/Makefile.freebsd diff --git a/O2EM/sources/src/Makefile.linux b/src/Makefile.linux similarity index 100% rename from O2EM/sources/src/Makefile.linux rename to src/Makefile.linux diff --git a/O2EM/sources/src/Makefile.mingw b/src/Makefile.mingw similarity index 100% rename from O2EM/sources/src/Makefile.mingw rename to src/Makefile.mingw diff --git a/O2EM/sources/src/Makefile.win b/src/Makefile.win similarity index 100% rename from O2EM/sources/src/Makefile.win rename to src/Makefile.win diff --git a/O2EM/sources/src/O2EM.ICO b/src/O2EM.ICO similarity index 100% rename from O2EM/sources/src/O2EM.ICO rename to src/O2EM.ICO diff --git a/O2EM/sources/src/O2EM.RC b/src/O2EM.RC similarity index 100% rename from O2EM/sources/src/O2EM.RC rename to src/O2EM.RC diff --git a/O2EM/sources/src/O2EM.RES b/src/O2EM.RES similarity index 100% rename from O2EM/sources/src/O2EM.RES rename to src/O2EM.RES diff --git a/O2EM/sources/src/O2EM116_private.h b/src/O2EM116_private.h similarity index 100% rename from O2EM/sources/src/O2EM116_private.h rename to src/O2EM116_private.h diff --git a/O2EM/sources/src/O2EM116_private.rc b/src/O2EM116_private.rc similarity index 100% rename from O2EM/sources/src/O2EM116_private.rc rename to src/O2EM116_private.rc diff --git a/O2EM/sources/src/O2em118.dev b/src/O2em118.dev similarity index 100% rename from O2EM/sources/src/O2em118.dev rename to src/O2em118.dev diff --git a/O2EM/sources/src/O2em118.layout b/src/O2em118.layout similarity index 100% rename from O2EM/sources/src/O2em118.layout rename to src/O2em118.layout diff --git a/O2EM/sources/src/audio.c b/src/audio.c similarity index 89% rename from O2EM/sources/src/audio.c rename to src/audio.c index a92096c..668a45d 100755 --- a/O2EM/sources/src/audio.c +++ b/src/audio.c @@ -24,11 +24,11 @@ #include "vmachine.h" #include "audio.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else extern int SND; -extern short signed int SNDBUF[1024*2]; +extern uint8_t soundBuffer[1056]; #endif #define SAMPLE_RATE 44100 @@ -44,7 +44,7 @@ extern short signed int SNDBUF[1024*2]; int sound_IRQ; -#ifndef RETRO +#ifndef __LIBRETRO__ static AUDIOSTREAM *stream=NULL; #endif FILE *sndlog=NULL; @@ -98,7 +98,7 @@ void audio_process(unsigned char *buffer){ void update_audio(void) { -#ifndef RETRO +#ifndef __LIBRETRO__ unsigned char *p; if (app_data.sound_en) { p = (unsigned char *)get_audio_stream_buffer(stream); @@ -109,13 +109,12 @@ void update_audio(void) { } } #else - unsigned char *p; - p = (unsigned char *)SNDBUF; - if (p) { - audio_process(p); - dumpaudio(evblclk==EVBLCLK_NTSC?44100/60:44100/50); - - } + //unsigned char *p; + //p = (unsigned char *)SNDBUF; + //if (p) { + // audio_process(p); + audio_process(soundBuffer); + //} #endif } @@ -126,7 +125,7 @@ void init_audio(void) { sound_IRQ=0; if ((app_data.sound_en) || (app_data.voice)) { printf("Initializing sound system...\n"); -#ifndef RETRO +#ifndef __LIBRETRO__ i = install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL); if (i != 0) { printf(" ERROR: could not initialize sound card\n %s\n",allegro_error); @@ -148,7 +147,6 @@ void init_audio(void) { } } #else -//TODO SOUND init_sound_stream(); #endif } @@ -164,7 +162,7 @@ void init_sound_stream(void){ vol = (255*app_data.svolume)/100; else vol = (255*app_data.svolume)/200; -#ifndef RETRO +#ifndef __LIBRETRO__ stream = play_audio_stream(SOUND_BUFFER_LEN,8,0,SAMPLE_RATE,vol,128); if (!stream) { printf("Error creating audio stream!\n"); @@ -178,7 +176,7 @@ void init_sound_stream(void){ void mute_audio(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (app_data.sound_en && stream){ stop_audio_stream(stream); stream=NULL; @@ -190,7 +188,7 @@ void mute_audio(void){ void close_audio(void) { -#ifndef RETRO +#ifndef __LIBRETRO__ if (app_data.sound_en && stream) { stop_audio_stream(stream); } diff --git a/O2EM/sources/src/audio.h b/src/audio.h similarity index 100% rename from O2EM/sources/src/audio.h rename to src/audio.h diff --git a/O2EM/sources/src/config.h b/src/config.h similarity index 100% rename from O2EM/sources/src/config.h rename to src/config.h diff --git a/O2EM/sources/src/cpu.c b/src/cpu.c similarity index 94% rename from O2EM/sources/src/cpu.c rename to src/cpu.c index 304552e..235956e 100755 --- a/O2EM/sources/src/cpu.c +++ b/src/cpu.c @@ -83,7 +83,7 @@ void make_psw_debug(void){ make_psw(); } -#ifdef RETRO +#ifdef __LIBRETRO__ extern int RLOOP; #endif @@ -93,7 +93,7 @@ void cpu_exec(void) { Byte dat; int temp; - #ifndef RETRO + #ifndef __LIBRETRO__ for (;;) #else while(RLOOP==1) @@ -1568,14 +1568,14 @@ void cpu_exec(void) { } if ((mstate==1) && (master_clk > evblclk)) { handle_evbl(); -#ifdef RETRO +#ifdef __LIBRETRO__ RLOOP=0; #endif if (app_data.crc == 0xA7344D1F) handle_evbll(); /* Atlantis */ break; } -#ifndef RETRO +#ifndef __LIBRETRO__ if (app_data.debug) break; if (pc==app_data.breakpoint) break; diff --git a/O2EM/sources/src/cpu.h b/src/cpu.h similarity index 100% rename from O2EM/sources/src/cpu.h rename to src/cpu.h diff --git a/O2EM/sources/src/crc32.c b/src/crc32.c similarity index 100% rename from O2EM/sources/src/crc32.c rename to src/crc32.c diff --git a/O2EM/sources/src/crc32.h b/src/crc32.h similarity index 100% rename from O2EM/sources/src/crc32.h rename to src/crc32.h diff --git a/O2EM/sources/src/cset.c b/src/cset.c similarity index 100% rename from O2EM/sources/src/cset.c rename to src/cset.c diff --git a/O2EM/sources/src/cset.h b/src/cset.h similarity index 100% rename from O2EM/sources/src/cset.h rename to src/cset.h diff --git a/O2EM/sources/src/debug.c b/src/debug.c similarity index 95% rename from O2EM/sources/src/debug.c rename to src/debug.c index 071d699..7d4cfd0 100755 --- a/O2EM/sources/src/debug.c +++ b/src/debug.c @@ -24,7 +24,7 @@ #include "table.h" #include "debug.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "wrapalleg.h" @@ -71,7 +71,7 @@ void debug(void) { done=go=0; -#ifndef RETRO +#ifndef __LIBRETRO__ set_display_switch_mode(SWITCH_BACKGROUND); #endif if (sndlog) fclose(sndlog); @@ -173,7 +173,7 @@ void debug(void) { rest(1); } while((key_done==0) && (!keypressed())); set_textmode(); -#ifndef RETRO +#ifndef __LIBRETRO__ set_display_switch_mode(SWITCH_BACKGROUND); #endif } else if (!strcmp(tok,"viewsprite")) { diff --git a/O2EM/sources/src/debug.h b/src/debug.h similarity index 100% rename from O2EM/sources/src/debug.h rename to src/debug.h diff --git a/O2EM/sources/src/dis48.c b/src/dis48.c similarity index 100% rename from O2EM/sources/src/dis48.c rename to src/dis48.c diff --git a/O2EM/sources/src/keyboard.c b/src/keyboard.c similarity index 93% rename from O2EM/sources/src/keyboard.c rename to src/keyboard.c index 912ab22..66959d7 100755 --- a/O2EM/sources/src/keyboard.c +++ b/src/keyboard.c @@ -28,7 +28,7 @@ #include "vpp.h" #include "keyboard.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "libretro.h" @@ -45,7 +45,7 @@ Byte new_int=0; /* Is new interrupt installed */ Byte key_done=0; Byte key_debug=0; -#ifndef RETRO +#ifndef __LIBRETRO__ struct keyb keybtab[] = { {KEY_A,"A"}, @@ -331,7 +331,7 @@ void set_systemkeys(int k_quit,int k_pause,int k_debug,int k_reset,int k_screenc syskeys[7] = k_inject; } -#ifdef RETRO +#ifdef __LIBRETRO__ unsigned char key[256*2]; void rloadstate(){ @@ -361,22 +361,11 @@ void rsavestate(){ } } -void rreset(){ - init_cpu(); - init_roms(); - init_vpp(); - clearscr(); -} - void rscore(){ set_score(app_data.scoretype, app_data.scoreaddress, app_data.default_highscore); } -void rscrshot(){ - //TODO -} - #endif void handle_key(void){ @@ -497,7 +486,7 @@ void handle_key(void){ if (key[syskeys[4]]) { -#ifndef RETRO +#ifndef __LIBRETRO__ BITMAP *bmp; PALETTE pal; char *p; @@ -546,7 +535,7 @@ Byte keyjoy(int jn){ Byte d; d=0xFF; if ((jn>=0) && (jn<=1)){ -#ifdef RETRO +#ifdef __LIBRETRO__ if (jbt[0]) d &= 0xFE; if (jbt[1]) d &= 0xFB; if (jbt[2]) d &= 0xF7; @@ -571,13 +560,13 @@ void init_keyboard(void){ key_done=0; key_debug=0; -#ifndef RETRO +#ifndef __LIBRETRO__ install_keyboard(); #else memset(key,0,512); #endif new_int=1; -#ifndef RETRO +#ifndef __LIBRETRO__ NeedsPoll = keyboard_needs_poll(); #else NeedsPoll = 1; @@ -586,7 +575,7 @@ void init_keyboard(void){ void Set_Old_Int9(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ remove_keyboard(); #endif new_int=0; diff --git a/O2EM/sources/src/keyboard.h b/src/keyboard.h similarity index 100% rename from O2EM/sources/src/keyboard.h rename to src/keyboard.h diff --git a/O2EM/sources/src/main.c b/src/main.c old mode 100644 new mode 100755 similarity index 99% rename from O2EM/sources/src/main.c rename to src/main.c index a1b30e5..ebfeda9 --- a/O2EM/sources/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ #include "keyboard.h" #include "voice.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "wrapalleg.h" @@ -177,17 +177,17 @@ int omain(int argc, char *argv[]){ exit(EXIT_FAILURE); } -#ifdef RETRO +#ifdef __LIBRETRO__ sprintf(statefile,"%s.state\0",file); #endif printf("Starting emulation ...\n"); -#ifndef RETRO +#ifndef __LIBRETRO__ allegro_init(); install_timer(); #endif init_audio(); -#ifndef RETRO +#ifndef __LIBRETRO__ printf("Using Allegro %s\n",allegro_id); #endif @@ -205,7 +205,7 @@ sprintf(statefile,"%s.state\0",file); strcpy(xrom,"roms/"); strcpy(romdir,file); -#ifndef RETRO +#ifndef __LIBRETRO__ strcpy(file,xrom); strcat(file,romdir); #endif @@ -235,7 +235,7 @@ sprintf(statefile,"%s.state\0",file); strcpy (xrom,romdir); } -#ifdef RETRO +#ifdef __LIBRETRO__ #ifdef AND sprintf(xrom,"%s\0","/mnt/sdcard/O2EM/roms/"); strcpy(romdir,xrom); @@ -273,7 +273,7 @@ if (!launcher_flag_b){ strcpy (xbios,"bios/"); strcpy (biosdir,xbios); } -#ifdef RETRO +#ifdef __LIBRETRO__ #ifdef AND sprintf(xbios,"%s\0","/mnt/sdcard/O2EM/bios/"); strcpy (biosdir,xbios); @@ -405,7 +405,7 @@ if (!launcher_flag_b){ #endif #endif -#ifdef RETRO +#ifdef __LIBRETRO__ return 1; #endif run(); @@ -869,7 +869,7 @@ static void load_cart(char *file){ } /*************************** Helpus*/ void helpus(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ allegro_init(); install_timer(); #endif @@ -894,7 +894,7 @@ int file_name(char *pathx) if (dir_p == NULL) { fprintf(stderr,"dir '%s' not found !\n", pathx); exit(-1); } while(0 != (dir_entry_p = readdir(dir_p))) { -#ifndef RETRO +#ifndef __LIBRETRO__ strcpy(arkivo[contax], dir_entry_p->d_name); #else sprintf(arkivo[contax],"%s\0",dir_entry_p->d_name); diff --git a/O2EM/sources/src/o2em.png b/src/o2em.png similarity index 100% rename from O2EM/sources/src/o2em.png rename to src/o2em.png diff --git a/O2EM/sources/src/score.c b/src/score.c similarity index 95% rename from O2EM/sources/src/score.c rename to src/score.c index 1e22d77..72ea97a 100755 --- a/O2EM/sources/src/score.c +++ b/src/score.c @@ -23,7 +23,7 @@ #include "types.h" #include "score.h" -#ifdef RETRO +#ifdef __LIBRETRO__ #include #endif diff --git a/O2EM/sources/src/score.h b/src/score.h similarity index 100% rename from O2EM/sources/src/score.h rename to src/score.h diff --git a/O2EM/sources/src/system.c b/src/system.c similarity index 100% rename from O2EM/sources/src/system.c rename to src/system.c diff --git a/O2EM/sources/src/table.c b/src/table.c similarity index 100% rename from O2EM/sources/src/table.c rename to src/table.c diff --git a/O2EM/sources/src/table.h b/src/table.h similarity index 100% rename from O2EM/sources/src/table.h rename to src/table.h diff --git a/O2EM/sources/src/timefunc.c b/src/timefunc.c similarity index 94% rename from O2EM/sources/src/timefunc.c rename to src/timefunc.c index a0907ce..0f0f651 100755 --- a/O2EM/sources/src/timefunc.c +++ b/src/timefunc.c @@ -17,7 +17,7 @@ #include -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #endif @@ -29,7 +29,7 @@ #endif #include "timefunc.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #ifdef ALLEGRO_WINDOWS diff --git a/O2EM/sources/src/timefunc.h b/src/timefunc.h similarity index 100% rename from O2EM/sources/src/timefunc.h rename to src/timefunc.h diff --git a/O2EM/sources/src/types.h b/src/types.h similarity index 100% rename from O2EM/sources/src/types.h rename to src/types.h diff --git a/O2EM/sources/src/vdc.c b/src/vdc.c similarity index 94% rename from O2EM/sources/src/vdc.c rename to src/vdc.c index c49784a..fabe35e 100755 --- a/O2EM/sources/src/vdc.c +++ b/src/vdc.c @@ -28,7 +28,7 @@ #include "vpp.h" #include "vdc.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "libretro.h" @@ -154,7 +154,7 @@ static void create_cmap(void){ void grmode(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ set_color_depth(8); wsize = app_data.wsize; @@ -223,7 +223,7 @@ clearscr(); void set_textmode(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ set_palette(oldcol); set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); #endif @@ -232,7 +232,7 @@ void set_textmode(void){ void clearscr(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ acquire_screen(); clear(screen); release_screen(); @@ -337,9 +337,8 @@ static void draw_grid(void){ } -#ifdef RETRO +#ifdef __LIBRETRO__ -#include "libretro-o2em.h" extern unsigned short int mbmp[TEX_WIDTH * TEX_HEIGHT]; void retro_blit(){ @@ -381,7 +380,7 @@ void finish_display(void){ last=t; } if (curr) { -#ifndef RETRO +#ifndef __LIBRETRO__ text_mode(0); textprintf(bmp, font, 20 , 4, 7, "FPS: %3d",(int)((200.0*TICKSPERSEC)/curr+0.5)); #endif @@ -398,7 +397,7 @@ void finish_display(void){ for (y=0; y<10; y++) cached_lines[(y+cache_counter) % bmp->h] = 0; cache_counter = (cache_counter+10) % bmp->h; -#ifndef RETRO +#ifndef __LIBRETRO__ acquire_screen(); #endif @@ -406,7 +405,7 @@ void finish_display(void){ for (y=0; yw; x++) bmp->line[(y+2)*bmp->w +x] += 16; -#ifndef RETRO +#ifndef __LIBRETRO__ stretch_blit(bmp,screen,7,2+y,WNDW,1,0,(y+1)*wsize-1,WNDW*wsize,1); #else //TODO @@ -430,7 +429,7 @@ void finish_display(void){ } -#ifndef RETRO +#ifndef __LIBRETRO__ release_screen(); #else retro_blit(); @@ -629,7 +628,7 @@ void draw_quad(Byte ypos, Byte xpos, Byte cp0l, Byte cp0h, Byte cp1l, Byte cp1h, } void close_display(void) { -#ifndef RETRO +#ifndef __LIBRETRO__ free(vscreen); #endif free(col); @@ -641,7 +640,7 @@ void window_close_hook(void){ key_done=1; } static void txtmsg(int x, int y, int c, const char *s){ -#ifndef RETRO +#ifndef __LIBRETRO__ text_mode(-1); textout_centre(bmp, font, s, x+1 , y+1, 32); textout_centre(bmp, font, s, x , y, c); @@ -712,7 +711,7 @@ void display_msg(char *msg, int waits) init_sound_stream(); } void init_display(void) { -#ifndef RETRO +#ifndef __LIBRETRO__ get_palette(oldcol); #endif create_cmap(); @@ -723,13 +722,13 @@ void init_display(void) { fprintf(stderr,"Could not allocate memory for screen buffer.\n"); exit(EXIT_FAILURE); } -#ifndef RETRO +#ifndef __LIBRETRO__ vscreen = (Byte *) bmp->dat; #else vscreen = (Byte *) &bmp->line[0]; #endif -#ifndef RETRO +#ifndef __LIBRETRO__ clear(bmp); clear(bmpcache); #endif @@ -745,7 +744,7 @@ void init_display(void) { init_keyboard(); } -#ifndef RETRO +#ifndef __LIBRETRO__ set_window_close_button(TRUE); set_window_close_hook(window_close_hook); #endif @@ -815,7 +814,7 @@ static char hl[96][70]= "-savefile=file", " Load/Save State "," from/to file" }; -#ifndef RETRO +#ifndef __LIBRETRO__ text_mode(-1); textout(bmp, font, "O2EM v" O2EM_VERSION " Help", 26 , 16, 2); @@ -825,7 +824,7 @@ rect(bmp,20,12,315,228,6); line(bmp,20,35,315,35,6); for (cntt=0; cntt<16; cntt++) { -#ifndef RETRO +#ifndef __LIBRETRO__ textout(bmp, font, hl[cnt+cntt], 26, cnttt, 4); #endif cnttt += 12; @@ -843,7 +842,7 @@ for (cntt=0; cntt<16; cntt++) rectfill(bmp,25,36,306,227,0); for (cntt=0; cntt<16; cntt++) { -#ifndef RETRO +#ifndef __LIBRETRO__ textout(bmp, font, hl[cnt+cntt], 26, cnttt, 4); #endif @@ -859,7 +858,7 @@ for (cntt=0; cntt<16; cntt++) rectfill(bmp,25,36,306,227,0); for (cntt=0; cntt<16; cntt++) { -#ifndef RETRO +#ifndef __LIBRETRO__ textout(bmp, font, hl[cnt+cntt], 26, cnttt, 4); #endif cnttt += 12; diff --git a/O2EM/sources/src/vdc.h b/src/vdc.h similarity index 100% rename from O2EM/sources/src/vdc.h rename to src/vdc.h diff --git a/O2EM/sources/src/vmachine.c b/src/vmachine.c similarity index 95% rename from O2EM/sources/src/vmachine.c rename to src/vmachine.c index bc71648..222f37a 100755 --- a/O2EM/sources/src/vmachine.c +++ b/src/vmachine.c @@ -30,7 +30,7 @@ #include "voice.h" #include "vmachine.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "wrapalleg.h" @@ -123,7 +123,7 @@ void handle_vbl(void){ if (!app_data.debug) { -#ifndef RETRO +#ifndef __LIBRETRO__ handle_key(); #else update_joy(); @@ -131,7 +131,7 @@ void handle_vbl(void){ update_audio(); -#ifndef RETRO +#ifndef __LIBRETRO__ update_voice(); #else //TODO @@ -280,7 +280,7 @@ void init_system(void){ snapedlines[i][j][k]=0; if (app_data.stick[0] == 2 || app_data.stick[1] == 2) { -#ifndef RETRO +#ifndef __LIBRETRO__ i = install_joystick(JOY_TYPE_AUTODETECT); if (i || (num_joysticks<1)) { fprintf(stderr,"Error: no joystick detected\n"); @@ -347,7 +347,7 @@ Byte read_P2(void){ if (si<6) { for (i=0; i<8; i++) { km = key_map[si][i]; -#ifndef RETRO +#ifndef __LIBRETRO__ if ((key[km] && ((!joykeystab[km]) || (key_shifts & KB_CAPSLOCK_FLAG))) || (key2[km])) { so = i ^ 0x07; } @@ -476,7 +476,7 @@ Byte in_bus(void){ break; case 2: -#ifndef RETRO +#ifndef __LIBRETRO__ poll_joystick(); if (joy[sticknum].stick[0].axis[1].d1) d &= 0xFE; // joy_up if (joy[sticknum].stick[0].axis[0].d2) d &= 0xFD; // joy_right @@ -726,7 +726,7 @@ static void setvideomode(int t){ } -#ifdef RETRO +#ifdef __LIBRETRO__ #include #endif diff --git a/O2EM/sources/src/vmachine.h b/src/vmachine.h similarity index 100% rename from O2EM/sources/src/vmachine.h rename to src/vmachine.h diff --git a/O2EM/sources/src/voice.c b/src/voice.c similarity index 88% rename from O2EM/sources/src/voice.c rename to src/voice.c index 24689fd..3de9eea 100755 --- a/O2EM/sources/src/voice.c +++ b/src/voice.c @@ -20,7 +20,7 @@ #include "cpu.h" #include "voice.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #define SAMPLE signed short @@ -36,7 +36,7 @@ static unsigned long clk_voice_start=0; void load_voice_samples(char *path){ -#ifndef RETRO +#ifndef __LIBRETRO__ int bank, sam, i, ld=0; char name[MAXC]; SAMPLE *sp=NULL; @@ -86,7 +86,7 @@ void load_voice_samples(char *path){ void update_voice(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (!voice_ok) return; if (voice_st==2) { if (voice_get_position(voice_num) < 0){ @@ -112,7 +112,7 @@ void update_voice(void){ void trigger_voice(int addr){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (voice_ok){ if (voice_st) update_voice(); if ((voice_st==0) && (voice_bank>=0) && (voice_bank<9) && (addr>=0x80) && (addr<=0xff)){ @@ -126,7 +126,7 @@ void trigger_voice(int addr){ void set_voice_bank(int bank){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (!voice_ok) return; if ((bank>=0) && (bank<=8)) voice_bank = bank; #endif @@ -134,7 +134,7 @@ void set_voice_bank(int bank){ int get_voice_status(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (voice_ok){ update_voice(); if (voice_st) return 1; @@ -145,7 +145,7 @@ int get_voice_status(void){ void reset_voice(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (voice_ok) { voice_stop(voice_num); voice_bank=0; @@ -157,7 +157,7 @@ void reset_voice(void){ void mute_voice(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ if (voice_ok) { voice_stop(voice_num); } @@ -166,7 +166,7 @@ void mute_voice(void){ void close_voice(void){ -#ifndef RETRO +#ifndef __LIBRETRO__ reset_voice(); #endif voice_ok=0; diff --git a/O2EM/sources/src/voice.h b/src/voice.h similarity index 100% rename from O2EM/sources/src/voice.h rename to src/voice.h diff --git a/O2EM/sources/src/vpp.c b/src/vpp.c similarity index 94% rename from O2EM/sources/src/vpp.c rename to src/vpp.c index afe21ba..052fc6f 100755 --- a/O2EM/sources/src/vpp.c +++ b/src/vpp.c @@ -24,7 +24,7 @@ #include "vpp_cset.h" #include "vpp.h" -#ifndef RETRO +#ifndef __LIBRETRO__ #include "allegro.h" #else #include "wrapalleg.h" @@ -282,7 +282,7 @@ void vpp_finish_bmp(Byte *vmem, int offx, int offy, int w, int h, int totw, int for (y=0; yline[y]; #else pnt2 = (Byte *)&vppbmp->line[y*vppbmp->w]; @@ -358,7 +358,7 @@ static void vpp_draw_char(int x, int y, Byte ch, Byte c0, Byte c1, Byte ext, Byt m = (dw==2) ? 0x08 : 0x80; for (xx=0; xx<8; xx++) { -#ifndef RETRO +#ifndef __LIBRETRO__ vppbmp->line[y*10+yy][x*8+xx] = (k & m) ? c1 : c0; #else vppbmp->line[(y*10+yy)*vppbmp->w+(x*8+xx)] = (k & m) ? c1 : c0; @@ -374,7 +374,7 @@ static void vpp_draw_char(int x, int y, Byte ch, Byte c0, Byte c1, Byte ext, Byt static void vpp_update_screen(void){ int i,x,y,l,chr,attr,ext,c0,c1,dw,dh,hpar,vpar,lvd,lhd,ser_chr,ser_atr,ul,conc,box,swapcol; int tlum[8], m[8] = {0x01, 0x10, 0x04, 0x40, 0x02, 0x20, 0x08, 0x80}; -#ifndef RETRO +#ifndef __LIBRETRO__ clear(vppbmp); #endif for (i=0; i<8; i++) tlum[i] = (LumReg & m[i]) ? 0 : 8; @@ -463,7 +463,7 @@ static void vpp_update_screen(void){ if (vpp_r & 0x20) { for (y = vppbmp->h-1; y >= 10; y--) for (x = 0; x < vppbmp->w; x++) -#ifndef RETRO +#ifndef __LIBRETRO__ vppbmp->line[y][x] = vppbmp->line[(y-10)/2+10][x]; #else vppbmp->line[y*vppbmp->w +x] = vppbmp->line[((y-10)/2+10)*vppbmp->w +x]; ; @@ -492,7 +492,7 @@ void init_vpp(void){ fprintf(stderr,"Could not allocate memory for Videopac+ screen buffer.\n"); exit(EXIT_FAILURE); } -#ifndef RETRO +#ifndef __LIBRETRO__ clear(vppbmp); #endif memset(colplus,0,BMPW*BMPH); diff --git a/O2EM/sources/src/vpp.h b/src/vpp.h similarity index 100% rename from O2EM/sources/src/vpp.h rename to src/vpp.h diff --git a/O2EM/sources/src/vpp_cset.c b/src/vpp_cset.c similarity index 100% rename from O2EM/sources/src/vpp_cset.c rename to src/vpp_cset.c diff --git a/O2EM/sources/src/vpp_cset.h b/src/vpp_cset.h similarity index 100% rename from O2EM/sources/src/vpp_cset.h rename to src/vpp_cset.h