├── platforms
├── macos
│ ├── run.sh
│ ├── image.png
│ ├── iconfile.icns
│ ├── app.entitlements
│ ├── Makefile
│ ├── Info.plist
│ └── generate_icon.sh
├── libretro
│ ├── link.T
│ ├── jni
│ │ ├── Application.mk
│ │ └── Android.mk
│ ├── gearsystem.libretro
│ ├── gearsystem_libretro.info
│ └── Makefile.common
├── windows
│ ├── dependencies
│ │ ├── .gitignore
│ │ └── SDL2-2.30.6
│ │ │ ├── docs
│ │ │ ├── README-hg.md
│ │ │ ├── README-platforms.md
│ │ │ ├── README-wince.md
│ │ │ ├── README-git.md
│ │ │ ├── README-pandora.md
│ │ │ ├── README-psp.md
│ │ │ ├── release_checklist.md
│ │ │ ├── README-n3ds.md
│ │ │ ├── README-kmsbsd.md
│ │ │ ├── README-ngage.md
│ │ │ ├── README-vita.md
│ │ │ ├── README-ps2.md
│ │ │ ├── README-riscos.md
│ │ │ ├── README-porting.md
│ │ │ ├── README.md
│ │ │ ├── README-windows.md
│ │ │ ├── README-versions.md
│ │ │ ├── README-directfb.md
│ │ │ └── README-os2.md
│ │ │ ├── lib
│ │ │ ├── x64
│ │ │ │ ├── SDL2.dll
│ │ │ │ ├── SDL2.lib
│ │ │ │ ├── SDL2main.lib
│ │ │ │ └── SDL2test.lib
│ │ │ ├── x86
│ │ │ │ ├── SDL2.dll
│ │ │ │ ├── SDL2.lib
│ │ │ │ ├── SDL2main.lib
│ │ │ │ └── SDL2test.lib
│ │ │ └── arm64
│ │ │ │ ├── SDL2.dll
│ │ │ │ ├── SDL2.lib
│ │ │ │ ├── SDL2main.lib
│ │ │ │ └── SDL2test.lib
│ │ │ ├── include
│ │ │ ├── SDL_revision.h
│ │ │ ├── SDL_opengles2_gl2platform.h
│ │ │ ├── SDL_types.h
│ │ │ ├── SDL_name.h
│ │ │ ├── SDL_opengles.h
│ │ │ ├── close_code.h
│ │ │ ├── SDL_opengles2.h
│ │ │ ├── SDL_test_memory.h
│ │ │ ├── SDL_test_log.h
│ │ │ ├── SDL_test.h
│ │ │ ├── SDL_quit.h
│ │ │ ├── SDL_test_compare.h
│ │ │ ├── SDL_test_images.h
│ │ │ ├── SDL_misc.h
│ │ │ ├── SDL_power.h
│ │ │ └── SDL_guid.h
│ │ │ ├── README-SDL.txt
│ │ │ ├── BUGS.txt
│ │ │ ├── README.txt
│ │ │ ├── COPYING.txt
│ │ │ └── cmake
│ │ │ └── sdl2-config-version.cmake
│ ├── Gearsystem.rc
│ ├── iconfile.ico
│ ├── resource.h
│ ├── Gearsystem.manifest
│ └── Gearsystem.sln
├── flatpak
│ ├── icons
│ │ ├── 32x32.png
│ │ ├── 128x128.png
│ │ ├── 256x256.png
│ │ └── 512x512.png
│ ├── .gitignore
│ ├── io.github.drhelius.Gearsystem.desktop
│ ├── Makefile
│ └── io.github.drhelius.Gearsystem.yml
├── bsd
│ └── Makefile
├── linux
│ └── Makefile
├── desktop-shared
│ ├── backers.h
│ ├── Makefile.install
│ ├── gui_debug.h
│ ├── renderer.h
│ ├── gui_debug_memory.h
│ ├── application.h
│ ├── utils.h
│ ├── Makefile.common
│ ├── Makefile.sources
│ ├── nfd
│ │ └── nfd_sdl2.h
│ ├── gui_debug_constants.h
│ ├── imgui
│ │ └── imgui_impl_opengl2.h
│ ├── macos
│ │ └── fullscreen.mm
│ └── gui.h
├── audio-shared
│ └── sound_queue.h
└── README.txt
├── src
├── JumboDahjeeMemoryRule.h
├── audio
│ ├── emu2413
│ │ └── emu2413.h
│ ├── Sms_Oscs.h
│ ├── Stereo_Buffer.h
│ └── Sms_Apu.h
├── KoreanMSX8KB0300MemoryRule.h
├── YM2413.h
├── gearsystem.h
├── opcode_names.h
├── IOPorts.h
├── SG1000MemoryRule.h
├── RomOnlyMemoryRule.h
├── BootromMemoryRule.h
├── MSXMemoryRule.h
├── KoreanMemoryRule.h
├── JanggunMemoryRule.h
├── KoreanBFFCMemoryRule.h
├── KoreanFFFEMemoryRule.h
├── KoreanFFFFHiComMemoryRule.h
├── KoreanMSX32KB2000MemoryRule.h
├── KoreanSMS32KB2000MemoryRule.h
├── Multi4PAKAllActionMemoryRule.h
├── Korean0000XORFFMemoryRule.h
├── Korean2000XOR1FMemoryRule.h
├── KoreanMDFFF0MemoryRule.h
├── KoreanMDFFF5MemoryRule.h
├── KoreanFFF3FFFCMemoryRule.h
├── KoreanMSXSMS8000MemoryRule.h
├── CodemastersMemoryRule.h
├── SmsIOPorts.cpp
├── JumboDahjeeMemoryRule.cpp
├── SegaMemoryRule.h
├── VgmRecorder.h
├── GameGearIOPorts.cpp
├── MemoryRule.h
├── MemoryRule.cpp
├── log.h
├── RomOnlyMemoryRule.cpp
├── Memory_inline.h
├── SG1000MemoryRule.cpp
├── SixteenBitRegister.h
├── Eeprom93C46MemoryRule.h
├── KoreanMSX8KB0300MemoryRule.cpp
└── Input.h
├── .github
└── FUNDING.yml
├── backers.md
├── .devcontainer
├── Dockerfile
└── devcontainer.json
├── .gitignore
└── .vscode
├── c_cpp_properties.json
├── launch.json
└── settings.json
/platforms/macos/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd "${0%/*}"
3 | ./gearsystem
4 |
--------------------------------------------------------------------------------
/platforms/libretro/link.T:
--------------------------------------------------------------------------------
1 | {
2 | global: retro_*;
3 | local: *;
4 | };
5 |
6 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/.gitignore:
--------------------------------------------------------------------------------
1 | !*.dll
2 | !*.exe
3 | ![Rr]elease*/
4 | ![Bb]in
5 |
--------------------------------------------------------------------------------
/platforms/macos/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/macos/image.png
--------------------------------------------------------------------------------
/platforms/macos/iconfile.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/macos/iconfile.icns
--------------------------------------------------------------------------------
/platforms/libretro/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := c++_static
2 | APP_ABI := all
3 | NDK_TOOLCHAIN_VERSION := clang
4 |
--------------------------------------------------------------------------------
/platforms/windows/Gearsystem.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/Gearsystem.rc
--------------------------------------------------------------------------------
/platforms/windows/iconfile.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/iconfile.ico
--------------------------------------------------------------------------------
/platforms/flatpak/icons/32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/flatpak/icons/32x32.png
--------------------------------------------------------------------------------
/platforms/flatpak/.gitignore:
--------------------------------------------------------------------------------
1 | #Ignore any files created during the build of the Flatpak application
2 | .flatpak-builder/
3 |
--------------------------------------------------------------------------------
/platforms/flatpak/icons/128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/flatpak/icons/128x128.png
--------------------------------------------------------------------------------
/platforms/flatpak/icons/256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/flatpak/icons/256x256.png
--------------------------------------------------------------------------------
/platforms/flatpak/icons/512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/flatpak/icons/512x512.png
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-hg.md:
--------------------------------------------------------------------------------
1 | We are no longer hosted in Mercurial. Please see README-git.md for details.
2 |
3 | Thanks!
4 |
5 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2.dll
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2.dll
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2.dll
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2main.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2main.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2test.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x64/SDL2test.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2main.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2main.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2test.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/x86/SDL2test.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2main.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2main.lib
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2test.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/drhelius/Gearsystem/HEAD/platforms/windows/dependencies/SDL2-2.30.6/lib/arm64/SDL2test.lib
--------------------------------------------------------------------------------
/platforms/flatpak/io.github.drhelius.Gearsystem.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Gearsystem
3 | Comment=Emulator for SMS/GG/SG-1000 games
4 | Exec=gearsystem
5 | Type=Application
6 | Icon=io.github.drhelius.Gearsystem
7 | Categories=Game;Emulator;
8 |
--------------------------------------------------------------------------------
/platforms/bsd/Makefile:
--------------------------------------------------------------------------------
1 | include ../desktop-shared/Makefile.sources
2 |
3 | SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_gtk.cpp
4 | CPPFLAGS += `pkg-config --cflags gtk+-3.0`
5 | LDFLAGS += `pkg-config --libs gtk+-3.0`
6 |
7 | include ../desktop-shared/Makefile.common
8 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-platforms.md:
--------------------------------------------------------------------------------
1 | Platforms
2 | =========
3 |
4 | We maintain the list of supported platforms on our wiki now, and how to
5 | build and install SDL for those platforms:
6 |
7 | https://wiki.libsdl.org/Installation
8 |
9 |
--------------------------------------------------------------------------------
/platforms/linux/Makefile:
--------------------------------------------------------------------------------
1 | include ../desktop-shared/Makefile.sources
2 |
3 | SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_gtk.cpp
4 | CPPFLAGS += `pkg-config --cflags gtk+-3.0`
5 | LDFLAGS += `pkg-config --libs gtk+-3.0`
6 |
7 | include ../desktop-shared/Makefile.common
8 | include ../desktop-shared/Makefile.install
9 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-wince.md:
--------------------------------------------------------------------------------
1 | WinCE
2 | =====
3 |
4 | Windows CE is no longer supported by SDL.
5 |
6 | We have left the CE support in SDL 1.2 for those that must have it, and we
7 | have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
8 |
9 | --ryan.
10 |
11 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_revision.h:
--------------------------------------------------------------------------------
1 | /* Generated by updaterev.sh, do not edit */
2 | #ifdef SDL_VENDOR_INFO
3 | #define SDL_REVISION "SDL-release-2.30.6-0-gba2f78a00 (" SDL_VENDOR_INFO ")"
4 | #else
5 | #define SDL_REVISION "SDL-release-2.30.6-0-gba2f78a00"
6 | #endif
7 | #define SDL_REVISION_NUMBER 0
8 |
--------------------------------------------------------------------------------
/platforms/macos/app.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.cs.disable-library-validation
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/platforms/flatpak/Makefile:
--------------------------------------------------------------------------------
1 | include ../desktop-shared/Makefile.sources
2 |
3 | SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_portal.cpp
4 | CPPFLAGS += `pkg-config --cflags dbus-1`
5 | CPPFLAGS += -DPREVENT_ROM_FOLDER_USAGE
6 | LDFLAGS += `pkg-config --libs dbus-1`
7 |
8 | include ../desktop-shared/Makefile.common
9 | include ../desktop-shared/Makefile.install
10 |
--------------------------------------------------------------------------------
/platforms/libretro/gearsystem.libretro:
--------------------------------------------------------------------------------
1 | [Libretro]
2 | Type=Emulator
3 | Version=3.2.0
4 | Name=Gearsystem
5 | Module=gearsystem_libretro.so
6 | LibretroVersion=1
7 | Authors=Ignacio Sanchez Gines;
8 | License=GPL-3.0+;
9 |
10 | [Platform:GameGear]
11 | MimeType=application/x-gamegear-rom;
12 |
13 | [Platform:MasterSystem]
14 | MimeType=application/x-sms-rom;
15 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/backers.h:
--------------------------------------------------------------------------------
1 | #ifndef BACKERS_H
2 | #define BACKERS_H
3 |
4 | static const char * BACKERS_STR =
5 | " · Michael Mellor (dinglyburrow)"
6 | "\n · Francisco Javier Trujillo (fjtrujy)"
7 | "\n · Libretro / RetroArch team"
8 | "\n · Rupert Carmichael (carmiker)"
9 | "\n · Orange Kryptonite (OrangeKryptonite)"
10 | "\n · Danny Van den Heuve (Danny-VdH)"
11 | "\n · KPreston2900050"
12 | "\n · Nicholas Piegdon"
13 | "\n · Allan Curtis (Proudnerd2)";
14 |
15 | #endif /* BACKERS_H */
16 |
--------------------------------------------------------------------------------
/platforms/libretro/gearsystem_libretro.info:
--------------------------------------------------------------------------------
1 | display_name = "Sega - MS/GG/SG-1000 (Gearsystem)"
2 | authors = "Ignacio Sanchez"
3 | supported_extensions = "sms|gg|sg|mv|bin|rom"
4 | corename = "Gearsystem"
5 | manufacturer = "Sega"
6 | categories = "Emulator"
7 | systemname = "Sega 8-bit (MS/GG/SG-1000)"
8 | systemid = "master_system"
9 | database = "Sega - Game Gear|Sega - Master System - Mark III|Sega - SG-1000"
10 | license = "GPLv3"
11 | permissions = ""
12 | display_version = "3.2.0"
13 | supports_no_game = "false"
14 |
--------------------------------------------------------------------------------
/platforms/windows/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Gearsystem.rc
4 | //
5 | #define IDI_ICON1 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/README-SDL.txt:
--------------------------------------------------------------------------------
1 |
2 | Please distribute this file with the SDL runtime environment:
3 |
4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library
5 | designed to make it easy to write multi-media software, such as games
6 | and emulators.
7 |
8 | The Simple DirectMedia Layer library source code is available from:
9 | https://www.libsdl.org/
10 |
11 | This library is distributed under the terms of the zlib license:
12 | http://www.zlib.net/zlib_license.html
13 |
14 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/Makefile.install:
--------------------------------------------------------------------------------
1 | prefix ?= /usr/local
2 | exec_prefix ?= $(prefix)
3 | bindir ?= $(exec_prefix)/bin
4 |
5 | INSTALL ?= install
6 | INSTALL_PROGRAM ?= $(INSTALL)
7 | INSTALL_DATA ?= ${INSTALL} -m 644
8 |
9 | install: $(TARGET)
10 | $(PRE_INSTALL)
11 |
12 | $(NORMAL_INSTALL)
13 | $(INSTALL_PROGRAM) -D $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
14 |
15 | $(POST_INSTALL)
16 |
17 | uninstall:
18 | $(PRE_UNINSTALL)
19 |
20 | $(NORMAL_UNINSTALL)
21 | rm $(DESTDIR)$(bindir)/$(TARGET)
22 |
23 | $(POST_UNINSTALL)
24 |
--------------------------------------------------------------------------------
/platforms/windows/Gearsystem.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 | PerMonitorV2
7 |
8 |
9 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/BUGS.txt:
--------------------------------------------------------------------------------
1 |
2 | Bugs are now managed in the SDL issue tracker, here:
3 |
4 | https://github.com/libsdl-org/SDL/issues
5 |
6 | You may report bugs there, and search to see if a given issue has already
7 | been reported, discussed, and maybe even fixed.
8 |
9 |
10 | You may also find help at the SDL forums/mailing list:
11 |
12 | https://discourse.libsdl.org/
13 |
14 | Bug reports are welcome here, but we really appreciate if you use the issue
15 | tracker, as bugs discussed on the mailing list may be forgotten or missed.
16 |
17 |
--------------------------------------------------------------------------------
/src/JumboDahjeeMemoryRule.h:
--------------------------------------------------------------------------------
1 | #ifndef JUMBODAHJEE_MEMORY_RULE_H
2 | #define JUMBODAHJEE_MEMORY_RULE_H
3 |
4 | #include "MemoryRule.h"
5 |
6 | class JumboDahjeeMemoryRule : public MemoryRule
7 | {
8 | public:
9 | JumboDahjeeMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
10 | virtual ~JumboDahjeeMemoryRule();
11 | virtual u8 PerformRead(u16 address);
12 | virtual void PerformWrite(u16 address, u8 value);
13 | virtual void Reset();
14 | virtual u8* GetPage(int index);
15 | virtual int GetBank(int index);
16 |
17 | private:
18 | u8* m_pCartRAM;
19 | };
20 |
21 | #endif /* JUMBODAHJEE_MEMORY_RULE_H */
22 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: drhelius
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/backers.md:
--------------------------------------------------------------------------------
1 | # Gearsystem sponsorship
2 |
3 | - [Become a backer or sponsor on GitHub](https://github.com/sponsors/drhelius).
4 |
5 | ## Special Thanks To
6 |
7 | - [Michael Mellor](https://github.com/dinglyburrow)
8 | - [Francisco Javier Trujillo](https://github.com/fjtrujy)
9 | - [Orange Kryptonite](https://github.com/OrangeKryptonite)
10 | - [Danny Van den Heuvel](https://github.com/Danny-VdH)
11 | - [Rupert Carmichael](https://github.com/carmiker)
12 | - [Libretro / RetroArch team](https://github.com/libretro)
13 | - [Nicholas Piegdon](https://github.com/npiegdon)
14 | - [TomChapple](https://github.com/TomChapple)
15 | - [Desmoquattro](https://github.com/Desmo5574)
16 | - [Allan Curtis](https://github.com/Proudnerd2)
17 |
--------------------------------------------------------------------------------
/src/audio/emu2413/emu2413.h:
--------------------------------------------------------------------------------
1 | /*
2 | **
3 | ** File: ym2413.c - software implementation of YM2413
4 | ** FM sound generator type OPLL
5 | **
6 | ** Copyright (C) 2002 Jarek Burczynski
7 | **
8 | ** Version 1.0
9 | **
10 | */
11 |
12 | #ifndef _H_YM2413_
13 | #define _H_YM2413_
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | extern void YM2413Init(void);
20 | extern void YM2413ResetChip(void);
21 | extern int YM2413Update(void);
22 | extern void YM2413Write(unsigned int a, unsigned int v);
23 | extern unsigned int YM2413Read(void);
24 | extern unsigned char *YM2413GetContextPtr(void);
25 | extern unsigned int YM2413GetContextSize(void);
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif /*_H_YM2413_*/
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/README.txt:
--------------------------------------------------------------------------------
1 |
2 | Simple DirectMedia Layer
3 |
4 | (SDL)
5 |
6 | Version 2.0
7 |
8 | ---
9 | https://www.libsdl.org/
10 |
11 | Simple DirectMedia Layer is a cross-platform development library designed
12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics
13 | hardware via OpenGL and Direct3D. It is used by video playback software,
14 | emulators, and popular games including Valve's award winning catalog
15 | and many Humble Bundle games.
16 |
17 | More extensive documentation is available in the docs directory, starting
18 | with README.md
19 |
20 | Enjoy!
21 | Sam Lantinga (slouken@libsdl.org)
22 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-git.md:
--------------------------------------------------------------------------------
1 | git
2 | =========
3 |
4 | The latest development version of SDL is available via git.
5 | Git allows you to get up-to-the-minute fixes and enhancements;
6 | as a developer works on a source tree, you can use "git" to mirror that
7 | source tree instead of waiting for an official release. Please look
8 | at the Git website ( https://git-scm.com/ ) for more
9 | information on using git, where you can also download software for
10 | macOS, Windows, and Unix systems.
11 |
12 | git clone https://github.com/libsdl-org/SDL
13 |
14 | If you are building SDL via configure, you will need to run autogen.sh
15 | before running configure.
16 |
17 | There is a web interface to the Git repository at:
18 | http://github.com/libsdl-org/SDL/
19 |
20 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_opengles2_gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /*
5 | ** Copyright 2017-2020 The Khronos Group Inc.
6 | ** SPDX-License-Identifier: Apache-2.0
7 | */
8 |
9 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
10 | *
11 | * Adopters may modify khrplatform.h and this file to suit their platform.
12 | * Please contribute modifications back to Khronos as pull requests on the
13 | * public github repository:
14 | * https://github.com/KhronosGroup/OpenGL-Registry
15 | */
16 |
17 | /*#include */
18 |
19 | #ifndef GL_APICALL
20 | #define GL_APICALL KHRONOS_APICALL
21 | #endif
22 |
23 | #ifndef GL_APIENTRY
24 | #define GL_APIENTRY KHRONOS_APIENTRY
25 | #endif
26 |
27 | #endif /* __gl2platform_h_ */
28 |
--------------------------------------------------------------------------------
/platforms/macos/Makefile:
--------------------------------------------------------------------------------
1 | include ../desktop-shared/Makefile.sources
2 |
3 | SOURCES_MM += $(DESKTOP_SRC_DIR)/nfd/nfd_cocoa.mm
4 | SOURCES_MM += $(DESKTOP_SRC_DIR)/macos/fullscreen.mm
5 | OBJECTS += $(SOURCES_MM:.mm=.o)
6 | LDFLAGS += -framework AppKit -framework UniformTypeIdentifiers
7 |
8 | include ../desktop-shared/Makefile.common
9 |
10 | APP_NAME=Gearsystem
11 |
12 | bundle:
13 | rm -rf $(APP_NAME).app
14 | mkdir -p $(APP_NAME).app/Contents/{MacOS,Resources,Frameworks}
15 | sed -e "s/@version@/$(GIT_VERSION)/g" Info.plist > $(APP_NAME).app/Contents/Info.plist
16 | cp iconfile.icns $(APP_NAME).app/Contents/Resources/
17 | cp $(TARGET) $(APP_NAME).app/Contents/MacOS/
18 | cp run.sh $(APP_NAME).app/Contents/MacOS/
19 | cp ../gamecontrollerdb.txt $(APP_NAME).app/Contents/MacOS/
20 |
21 | dist: clean all bundle
22 | @echo Success!!
23 |
--------------------------------------------------------------------------------
/src/KoreanMSX8KB0300MemoryRule.h:
--------------------------------------------------------------------------------
1 | #ifndef KOREAN_MSX_8KB_0300_MEMORY_RULE_H
2 | #define KOREAN_MSX_8KB_0300_MEMORY_RULE_H
3 |
4 | #include "MemoryRule.h"
5 |
6 | class KoreanMSX8KB0300MemoryRule : public MemoryRule
7 | {
8 | public:
9 | KoreanMSX8KB0300MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
10 | virtual ~KoreanMSX8KB0300MemoryRule();
11 | virtual u8 PerformRead(u16 address);
12 | virtual void PerformWrite(u16 address, u8 value);
13 | virtual void Reset();
14 | virtual u8* GetPage(int index);
15 | virtual int GetBank(int index);
16 | virtual bool Has8kBanks();
17 | virtual void SaveState(std::ostream& stream);
18 | virtual void LoadState(std::istream& stream);
19 |
20 | private:
21 | int m_iPage[6];
22 | int m_iPageAddress[6];
23 | };
24 |
25 | #endif // KOREAN_MSX_8KB_0300_MEMORY_RULE_H
26 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-pandora.md:
--------------------------------------------------------------------------------
1 | Pandora
2 | =====================================================================
3 |
4 | ( http://openpandora.org/ )
5 | - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
6 | support to work on the pandora under the framebuffer. This driver do not have
7 | input support for now, so if you use it you will have to add your own control code.
8 | The video driver name is "pandora" so if you have problem running it from
9 | the framebuffer, try to set the following variable before starting your application :
10 | "export SDL_VIDEODRIVER=pandora"
11 |
12 | - OpenGL ES support was added to the x11 driver, so it's working like the normal
13 | x11 driver one with OpenGLX support, with SDL input event's etc..
14 |
15 |
16 | David Carré (Cpasjuste)
17 | cpasjuste@gmail.com
18 |
--------------------------------------------------------------------------------
/.devcontainer/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:focal
2 |
3 | ENV LANG="C.UTF-8"
4 |
5 | # Install basic build tools
6 | RUN apt-get update \
7 | && apt-get upgrade -y \
8 | && DEBIAN_FRONTEND=noninteractive apt-get install -y \
9 | vim \
10 | make \
11 | cmake \
12 | unzip \
13 | zip \
14 | xxd \
15 | build-essential \
16 | gdb \
17 | clang \
18 | lldb \
19 | libsdl2-dev \
20 | libgtk-3-dev \
21 | && rm -rf /var/lib/apt/lists/* \
22 | && apt-get autoremove -y && apt-get clean -y
23 |
24 | # Default to zsh shell
25 | ENV SHELL=/usr/bin/zsh \
26 | DOCKER_BUILDKIT=1
27 |
28 | # Mount for docker-in-docker
29 | VOLUME [ "/var/lib/docker" ]
30 |
31 | # Fire Docker/Moby script if needed
32 | ENTRYPOINT [ "/usr/local/share/docker-init.sh", "/usr/local/share/ssh-init.sh"]
33 | CMD [ "sleep", "infinity" ]
34 |
--------------------------------------------------------------------------------
/platforms/libretro/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | ROOT_DIR := $(LOCAL_PATH)/../../..
4 | CORE_DIR := $(ROOT_DIR)/platforms/libretro
5 | SOURCE_DIR := $(ROOT_DIR)/src
6 | INCLUDES := -I$(CORE_DIR)
7 |
8 | include $(CORE_DIR)/Makefile.common
9 |
10 | COREFLAGS := -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DGEARSYSTEM_DISABLE_DISASSEMBLER -DGEARSYSTEM_DISABLE_VGMRECORDER $(INCLUDES)
11 |
12 | GIT_VERSION ?= " $(shell git describe --abbrev=7 --dirty --always --tags || echo unknown)"
13 | ifneq ($(GIT_VERSION)," unknown")
14 | COREFLAGS += -DEMULATOR_BUILD=\"$(GIT_VERSION)\"
15 | endif
16 |
17 | include $(CLEAR_VARS)
18 | LOCAL_MODULE := retro
19 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
20 | LOCAL_CFLAGS := $(COREFLAGS)
21 | LOCAL_CXXFLAGS := $(COREFLAGS)
22 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T
23 | LOCAL_LDLIBS := -llog
24 | include $(BUILD_SHARED_LIBRARY)
25 |
--------------------------------------------------------------------------------
/src/YM2413.h:
--------------------------------------------------------------------------------
1 | #ifndef YM2413_H
2 | #define YM2413_H
3 |
4 | #include "definitions.h"
5 | #include "log.h"
6 | #include "audio/emu2413/emu2413.h"
7 |
8 | class YM2413
9 | {
10 |
11 | public:
12 | YM2413();
13 | ~YM2413();
14 |
15 | void Init(int clockRate);
16 | void Reset(int clockRate);
17 | void Write(u8 port, u8 value);
18 | u8 Read();
19 | void Tick(unsigned int clockCycles);
20 | int EndFrame(s16* pSampleBuffer);
21 | void Enable(bool bEnabled);
22 | void SaveState(std::ostream& stream);
23 | void LoadState(std::istream& stream);
24 |
25 | private:
26 | void Sync();
27 |
28 | private:
29 | int m_iCycleCounter;
30 | int m_iSampleCounter;
31 | int m_iCyclesPerSample;
32 | s16* m_pBuffer;
33 | int m_iBufferIndex;
34 | int m_ElapsedCycles;
35 | int m_iClockRate;
36 | u8 m_RegisterF2;
37 | s16 m_CurrentSample;
38 | bool m_bEnabled;
39 | };
40 |
41 | #endif /* YM2413_H */
42 |
--------------------------------------------------------------------------------
/src/audio/Sms_Oscs.h:
--------------------------------------------------------------------------------
1 | // Private oscillators used by Sms_Apu
2 |
3 | // Sms_Snd_Emu 0.1.4
4 | #ifndef SMS_OSCS_H
5 | #define SMS_OSCS_H
6 |
7 | #include "Blip_Buffer.h"
8 |
9 | struct Sms_Osc
10 | {
11 | Blip_Buffer* outputs [4]; // NULL, right, left, center
12 | Blip_Buffer* output;
13 | int output_select;
14 |
15 | int delay;
16 | int last_amp;
17 | int volume;
18 |
19 | Sms_Osc();
20 | void reset();
21 | };
22 |
23 | struct Sms_Square : Sms_Osc
24 | {
25 | int period;
26 | int phase;
27 |
28 | typedef Blip_Synth Synth;
29 | const Synth* synth;
30 |
31 | void reset();
32 | void run( blip_time_t, blip_time_t );
33 | };
34 |
35 | struct Sms_Noise : Sms_Osc
36 | {
37 | const int* period;
38 | unsigned shifter;
39 | unsigned feedback;
40 | bool ti;
41 |
42 | typedef Blip_Synth Synth;
43 | Synth synth;
44 |
45 | void reset(bool ti_chip);
46 | void run( blip_time_t, blip_time_t );
47 | };
48 |
49 | #endif
--------------------------------------------------------------------------------
/platforms/macos/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleExecutable
6 | run.sh
7 | CFBundleIdentifier
8 | com.drhelius.Gearsystem
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundleName
12 | Gearsystem
13 | CFBundlePackageType
14 | APPL
15 | CFBundleIconFile
16 | iconfile
17 | NSHighResolutionC\apable
18 | True
19 | CFBundleVersion
20 | @version@
21 | CFBundleShortVersionString
22 | @version@
23 | LSApplicationCategoryType
24 | public.app-category.arcade-games
25 |
26 |
27 |
--------------------------------------------------------------------------------
/platforms/macos/generate_icon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | input_filepath="image.png"
4 | output_iconset_name="iconfile.iconset"
5 | mkdir $output_iconset_name
6 |
7 | sips -z 16 16 $input_filepath --out "${output_iconset_name}/icon_16x16.png"
8 | sips -z 32 32 $input_filepath --out "${output_iconset_name}/icon_16x16@2x.png"
9 | sips -z 32 32 $input_filepath --out "${output_iconset_name}/icon_32x32.png"
10 | sips -z 64 64 $input_filepath --out "${output_iconset_name}/icon_32x32@2x.png"
11 | sips -z 128 128 $input_filepath --out "${output_iconset_name}/icon_128x128.png"
12 | sips -z 256 256 $input_filepath --out "${output_iconset_name}/icon_128x128@2x.png"
13 | sips -z 256 256 $input_filepath --out "${output_iconset_name}/icon_256x256.png"
14 | sips -z 512 512 $input_filepath --out "${output_iconset_name}/icon_256x256@2x.png"
15 | sips -z 512 512 $input_filepath --out "${output_iconset_name}/icon_512x512.png"
16 |
17 | iconutil -c icns $output_iconset_name
18 |
19 | rm -R $output_iconset_name
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/COPYING.txt:
--------------------------------------------------------------------------------
1 |
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2020 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 |
21 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-psp.md:
--------------------------------------------------------------------------------
1 | PSP
2 | ======
3 | SDL2 port for the Sony PSP contributed by:
4 | - Captian Lex
5 | - Francisco Javier Trujillo Mata
6 | - Wouter Wijsman
7 |
8 |
9 | Credit to
10 | Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
11 | Geecko for his PSP GU lib "Glib2d"
12 |
13 | ## Building
14 | To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
15 | ```bash
16 | cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
17 | cmake --build build
18 | cmake --install build
19 | ```
20 |
21 |
22 | ## Getting PSP Dev
23 | [Installing PSP Dev](https://github.com/pspdev/pspdev)
24 |
25 | ## Running on PPSSPP Emulator
26 | [PPSSPP](https://github.com/hrydgard/ppsspp)
27 |
28 | [Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
29 |
30 |
31 | ## Compiling a HelloWorld
32 | [PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
33 |
34 | ## To Do
35 | - PSP Screen Keyboard
36 | - Dialogs
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac files
2 | *.DS_Store
3 | *.dylib
4 | *.app/
5 |
6 | # Visual Studio files
7 | .vs/
8 | ipch/
9 | [Oo]bj
10 | [Bb]in
11 | *.[Cc]ache
12 | *.obj
13 | *.o
14 | *.dll
15 | *.exe
16 | *.exp
17 | *.pdb
18 | *.user
19 | *.aps
20 | *.pch
21 | *.sdf
22 | *.opensdf
23 | *.vspscc
24 | *_i.c
25 | *_p.c
26 | *.ncb
27 | *.suo
28 | *.tlb
29 | *.tlh
30 | *.bak
31 | *.ilk
32 | *.log
33 | *.zip
34 | *[Dd]ebug*/
35 | *.sbr
36 | *.app
37 | Thumbs.db
38 | *[Rr]elease*/
39 | *[Pp]rofile*/
40 | [Tt]est[Rr]esults/
41 | _UpgradeReport_Files/
42 | _ReSharper.*/
43 | desktop.ini
44 |
45 | # Misc files
46 | *.ini
47 | *.cfg
48 | *.gg
49 | *.sms
50 | *.bin
51 | *.zip
52 | *.gearsystem
53 | *.so
54 | *.sav
55 | *.tmp
56 | *.state*
57 |
58 | # Qt Ignores
59 | moc_*.cpp
60 | qt-Debug.mk
61 | qt-Release.mk
62 | ui_*.h
63 | .qmake.stash
64 | qrc_*.cpp
65 | Gearsystem.pro.user.*
66 |
67 | #Xcode
68 | *.xcuserstate
69 | xcuserdata/
70 | *.xcexplist
71 | *.xcsettings
72 | *.xccheckout
73 |
74 | #binaries
75 | platforms/**/gearsystem
76 |
77 | #Switch
78 | *.a
79 | *.d
80 |
81 | #Android
82 | platforms/libretro/libs/
83 |
84 | #JetBrains
85 | .idea
86 |
--------------------------------------------------------------------------------
/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "compilerPath": "/usr/bin/gcc",
6 | "cStandard": "c99",
7 | "cppStandard": "c++11",
8 | "intelliSenseMode": "linux-gcc-x64",
9 | "includePath": [
10 | "${workspaceFolder}/**",
11 | "/usr/include/SDL2"
12 | ],
13 | "browse": {
14 | "path": ["${workspaceFolder}"]
15 | }
16 | },
17 | {
18 | "name": "Mac",
19 | "compilerPath": "/usr/bin/clang",
20 | "cStandard": "c99",
21 | "cppStandard": "c++11",
22 | "intelliSenseMode": "macos-clang-arm64",
23 | "includePath": [
24 | "${workspaceFolder}/**",
25 | "/opt/homebrew/include/SDL2"
26 | ],
27 | "macFrameworkPath": ["/System/Library/Frameworks", "/Library/Frameworks"],
28 | "browse": {
29 | "path": ["${workspaceFolder}"]
30 | }
31 | }
32 | ],
33 | "version": 4,
34 | "enableConfigurationSquiggles": true
35 | }
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_types.h
24 | *
25 | * \deprecated
26 | */
27 |
28 | /* DEPRECATED */
29 | #include "SDL_stdinc.h"
30 |
--------------------------------------------------------------------------------
/src/gearsystem.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef GEARSYSTEM_H
21 | #define GEARSYSTEM_H
22 |
23 | #include "common.h"
24 | #include "definitions.h"
25 | #include "log.h"
26 | #include "GearsystemCore.h"
27 | #include "Memory.h"
28 | #include "Processor.h"
29 | #include "Cartridge.h"
30 | #include "Audio.h"
31 | #include "Video.h"
32 | #include "SixteenBitRegister.h"
33 | #include "MemoryRule.h"
34 |
35 | #endif /* GEARSYSTEM_H */
36 |
37 |
--------------------------------------------------------------------------------
/src/opcode_names.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef OPCODE_NAMES_H
21 | #define OPCODE_NAMES_H
22 |
23 | struct stOPCodeInfo
24 | {
25 | const char* name;
26 | int size;
27 | int type;
28 | };
29 |
30 | #include "opcodexx_names.h"
31 | #include "opcodecb_names.h"
32 | #include "opcodeed_names.h"
33 | #include "opcodedd_names.h"
34 | #include "opcodefd_names.h"
35 | #include "opcodeddcb_names.h"
36 | #include "opcodefdcb_names.h"
37 |
38 | #endif /* OPCODE_NAMES_H */
39 |
40 |
--------------------------------------------------------------------------------
/src/IOPorts.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef IOPORTS_H
21 | #define IOPORTS_H
22 |
23 | #include "definitions.h"
24 |
25 | class IOPorts
26 | {
27 | public:
28 | IOPorts() { };
29 | virtual ~IOPorts() { };
30 | virtual void Reset() = 0;
31 | virtual u8 DoInput(u8 port) = 0;
32 | virtual void DoOutput(u8 port, u8 value) = 0;
33 | virtual void SaveState(std::ostream& stream) = 0;
34 | virtual void LoadState(std::istream& stream) = 0;
35 | };
36 |
37 | #endif /* IOPORTS_H */
38 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_name.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDLname_h_
23 | #define SDLname_h_
24 |
25 | #if defined(__STDC__) || defined(__cplusplus)
26 | #define NeedFunctionPrototypes 1
27 | #endif
28 |
29 | #define SDL_NAME(X) SDL_##X
30 |
31 | #endif /* SDLname_h_ */
32 |
33 | /* vi: set ts=4 sw=4 expandtab: */
34 |
--------------------------------------------------------------------------------
/src/SG1000MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef SG1000MEMORYRULE_H
21 | #define SG1000MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class SG1000MemoryRule : public MemoryRule
26 | {
27 | public:
28 | SG1000MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~SG1000MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | };
36 |
37 | #endif /* SG1000MEMORYRULE_H */
38 |
--------------------------------------------------------------------------------
/src/RomOnlyMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef ROMONLYMORYRULE_H
21 | #define ROMONLYMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class RomOnlyMemoryRule : public MemoryRule
26 | {
27 | public:
28 | RomOnlyMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~RomOnlyMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | };
36 |
37 | #endif /* ROMONLYMORYRULE_H */
38 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": "Build and debug",
6 | "type": "cppdbg",
7 | "request": "launch",
8 | "linux": {
9 | "program": "${workspaceFolder}/platforms/linux/gearsystem",
10 | "cwd": "${workspaceFolder}/platforms/linux",
11 | "MIMode": "gdb"
12 | },
13 | "osx": {
14 | "program": "${workspaceFolder}/platforms/macos/gearsystem",
15 | "cwd": "${workspaceFolder}/platforms/macos",
16 | "MIMode": "lldb"
17 | },
18 | "args": [],
19 | "stopAtEntry": false,
20 | "environment": [],
21 | "externalConsole": false,
22 | "preLaunchTask": "Build (DEBUG)",
23 | "setupCommands": [
24 | {
25 | "description": "Enable pretty-printing for gdb",
26 | "text": "-enable-pretty-printing",
27 | "ignoreFailures": true
28 | },
29 | {
30 | "description": "Set Disassembly Flavor to Intel",
31 | "text": "-gdb-set disassembly-flavor intel",
32 | "ignoreFailures": true
33 | }
34 | ]
35 | }
36 | ]
37 | }
--------------------------------------------------------------------------------
/platforms/windows/Gearsystem.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gearsystem", "Gearsystem.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|ARM64 = Debug|ARM64
11 | Debug|x64 = Debug|x64
12 | Release|ARM64 = Release|ARM64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|ARM64.ActiveCfg = Debug|ARM64
17 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|ARM64.Build.0 = Debug|ARM64
18 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64
19 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64
20 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|ARM64.ActiveCfg = Release|ARM64
21 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|ARM64.Build.0 = Release|ARM64
22 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64
23 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/release_checklist.md:
--------------------------------------------------------------------------------
1 | # Release checklist
2 |
3 | When changing the version, run `build-scripts/update-version.sh X Y Z`,
4 | where `X Y Z` are the major version, minor version, and patch level. So
5 | `2 28 1` means "change the version to 2.28.1". This script does much of the
6 | mechanical work.
7 |
8 |
9 | ## New feature release
10 |
11 | * Update `WhatsNew.txt`
12 |
13 | * Bump version number to 2.EVEN.0:
14 |
15 | * `./build-scripts/update-version.sh 2 EVEN 0`
16 |
17 | * Do the release
18 |
19 | * Update the website file include/header.inc.php to reflect the new version
20 |
21 | ## New bugfix release
22 |
23 | * Check that no new API/ABI was added
24 |
25 | * If it was, do a new feature release (see above) instead
26 |
27 | * Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is even)
28 |
29 | * `./build-scripts/update-version.sh 2 Y Z+1`
30 |
31 | * Do the release
32 |
33 | * Update the website file include/header.inc.php to reflect the new version
34 |
35 | ## After a feature release
36 |
37 | * Create a branch like `release-2.24.x`
38 |
39 | * Bump version number to 2.ODD.0 for next development branch
40 |
41 | * `./build-scripts/update-version.sh 2 ODD 0`
42 |
43 | ## New development prerelease
44 |
45 | * Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is odd)
46 |
47 | * `./build-scripts/update-version.sh 2 Y Z+1`
48 |
49 | * Do the release
50 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "build": {
3 | "dockerfile": "./Dockerfile",
4 | "context": "."
5 | },
6 | "features": {
7 | "ghcr.io/devcontainers/features/common-utils:2": {
8 | "username": "codespace",
9 | "userUid": "1000",
10 | "userGid": "1000"
11 | },
12 | "ghcr.io/devcontainers/features/desktop-lite:1": {}
13 | },
14 | "forwardPorts": [6080],
15 | "portsAttributes": {
16 | "6080": {
17 | "label": "desktop"
18 | }
19 | },
20 | "remoteUser": "codespace",
21 | "containerUser": "codespace",
22 | "customizations": {
23 | // Configure properties specific to VS Code.
24 | "vscode": {
25 | // Set *default* container specific settings.json values on container create.
26 | "settings": {
27 | "editor.wordWrap": "on",
28 | "editor.renderWhitespace": "all",
29 | "workbench.colorTheme": "Monokai"
30 | },
31 | // Add the IDs of extensions you want installed when the container is created.
32 | "extensions": [
33 | "GitHub.vscode-pull-request-github",
34 | "github.vscode-github-actions",
35 | "GitHub.copilot",
36 | "GitHub.copilot-chat",
37 | "ms-vscode.cpptools-extension-pack",
38 | "ms-vscode.hexeditor"
39 | ]
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_opengles.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifdef __IPHONEOS__
30 | #include
31 | #include
32 | #else
33 | #include
34 | #include
35 | #endif
36 |
37 | #ifndef APIENTRY
38 | #define APIENTRY
39 | #endif
40 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/gui_debug.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef GUI_DEBUG_H
21 | #define GUI_DEBUG_H
22 |
23 | #ifdef GUI_DEBUG_IMPORT
24 | #define EXTERN
25 | #else
26 | #define EXTERN extern
27 | #endif
28 |
29 | EXTERN void gui_debug_windows(void);
30 | EXTERN void gui_debug_reset(void);
31 | EXTERN void gui_debug_reset_symbols(void);
32 | EXTERN void gui_debug_load_symbols_file(const char* path);
33 | EXTERN void gui_debug_toggle_breakpoint(void);
34 | EXTERN void gui_debug_reset_breakpoints_cpu(void);
35 | EXTERN void gui_debug_reset_breakpoints_mem(void);
36 | EXTERN void gui_debug_runtocursor(void);
37 | EXTERN void gui_debug_go_back(void);
38 |
39 | #undef GUI_DEBUG_IMPORT
40 | #undef EXTERN
41 | #endif /* GUI_DEBUG_H */
--------------------------------------------------------------------------------
/src/BootromMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef BOOTROMMEMORYRULE_H
21 | #define BOOTROMMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class BootromMemoryRule : public MemoryRule
26 | {
27 | public:
28 | BootromMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~BootromMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 |
36 | private:
37 | int m_iMapperSlot[3];
38 | int m_iMapperSlotAddress[3];
39 | u8* m_pBootrom;
40 | u8* m_pBootromBanks;
41 | int m_iBankMax;
42 | };
43 |
44 | #endif /* BOOTROMMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/MSXMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef MSXMEMORYRULE_H
21 | #define MSXMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class MSXMemoryRule : public MemoryRule
26 | {
27 | public:
28 | MSXMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~MSXMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[4];
40 | int m_iMapperSlotAddress[4];
41 | };
42 |
43 | #endif /* MSXMEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/src/KoreanMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANMEMORYRULE_H
21 | #define KOREANMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanMemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot2;
40 | int m_iMapperSlot2Address;
41 | };
42 |
43 | #endif /* KOREANMEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-n3ds.md:
--------------------------------------------------------------------------------
1 | # Nintendo 3DS
2 |
3 | SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
4 |
5 | - [Pierre Wendling](https://github.com/FtZPetruska)
6 |
7 | Credits to:
8 |
9 | - The awesome people who ported SDL to other homebrew platforms.
10 | - The Devkitpro team for making all the tools necessary to achieve this.
11 |
12 | ## Building
13 |
14 | To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
15 |
16 | ```bash
17 | cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
18 | cmake --build build
19 | cmake --install build
20 | ```
21 |
22 | ## Notes
23 |
24 | - Currently only software rendering is supported.
25 | - SDL2main should be used to ensure ROMFS is enabled.
26 | - By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
27 | - `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
28 | - The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
29 |
--------------------------------------------------------------------------------
/src/JanggunMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef JANGGUNMEMORYRULE_H
21 | #define JANGGUNMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class JanggunMemoryRule : public MemoryRule
26 | {
27 | public:
28 | JanggunMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~JanggunMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[4];
40 | int m_iMapperSlotAddress[4];
41 | bool m_bReverseFlags[4];
42 | };
43 |
44 | #endif /* JANGGUNMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/KoreanBFFCMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANBFFCMEMORYRULE_H
21 | #define KOREANBFFCMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanBFFCMemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanBFFCMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanBFFCMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | };
43 |
44 | #endif /* KOREANBFFCMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/KoreanFFFEMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANFFFEMEMORYRULE_H
21 | #define KOREANFFFEMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanFFFEMemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanFFFEMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanFFFEMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | };
43 |
44 | #endif /* KOREANFFFEMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/KoreanFFFFHiComMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANFFFFHICOMMEMORYRULE_H
21 | #define KOREANFFFFHICOMMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanFFFFHiComMemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanFFFFHiComMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanFFFFHiComMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[3];
40 | int m_iMapperSlotAddress[3];
41 | };
42 |
43 | #endif /* KOREANFFFFHICOMMEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-kmsbsd.md:
--------------------------------------------------------------------------------
1 | KMSDRM on *BSD
2 | ==================================================
3 |
4 | KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
5 |
6 | WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
7 |
8 | OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
9 |
10 |
11 | SDL2 WSCONS input backend features
12 | ===================================================
13 | 1. It is keymap-aware; it will work properly with different keymaps.
14 | 2. It has mouse support.
15 | 3. Accent input is supported.
16 | 4. Compose keys are supported.
17 | 5. AltGr and Meta Shift keys work as intended.
18 |
19 | Partially working or no input on OpenBSD/NetBSD.
20 | ==================================================
21 |
22 | The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
23 |
24 | Partially working or no input on FreeBSD.
25 | ==================================================
26 |
27 | The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
28 |
--------------------------------------------------------------------------------
/src/KoreanMSX32KB2000MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANMSX32KB2000MEMORYRULE_H
21 | #define KOREANMSX32KB2000MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanMSX32KB2000MemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanMSX32KB2000MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanMSX32KB2000MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[3];
40 | int m_iMapperSlotAddress[3];
41 | };
42 |
43 | #endif /* KOREANMSX32KB2000MEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/src/KoreanSMS32KB2000MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANSMS32KB2000MEMORYRULE_H
21 | #define KOREANSMS32KB2000MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanSMS32KB2000MemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanSMS32KB2000MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanSMS32KB2000MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[3];
40 | int m_iMapperSlotAddress[3];
41 | };
42 |
43 | #endif /* KOREANSMS32KB2000MEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/src/Multi4PAKAllActionMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef MULTI4PAKALLACTIONMEMORYRULE_H
21 | #define MULTI4PAKALLACTIONMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class Multi4PAKAllActionMemoryRule : public MemoryRule
26 | {
27 | public:
28 | Multi4PAKAllActionMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~Multi4PAKAllActionMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual void SaveState(std::ostream& stream);
36 | virtual void LoadState(std::istream& stream);
37 |
38 | private:
39 | int m_iMapperSlot[3];
40 | int m_iMapperSlotAddress[3];
41 | };
42 |
43 | #endif /* MULTI4PAKALLACTIONMEMORYRULE_H */
44 |
--------------------------------------------------------------------------------
/src/Korean0000XORFFMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREAN0000XORFFMEMORYRULE_H
21 | #define KOREAN0000XORFFMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class Korean0000XORFFMemoryRule : public MemoryRule
26 | {
27 | public:
28 | Korean0000XORFFMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~Korean0000XORFFMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | };
43 |
44 | #endif /* KOREAN0000XORFFMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/Korean2000XOR1FMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREAN2000XOR1FMEMORYRULE_H
21 | #define KOREAN2000XOR1FMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class Korean2000XOR1FMemoryRule : public MemoryRule
26 | {
27 | public:
28 | Korean2000XOR1FMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~Korean2000XOR1FMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | };
43 |
44 | #endif /* KOREAN2000XOR1FMEMORYRULE_H */
45 |
--------------------------------------------------------------------------------
/src/KoreanMDFFF0MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANMDFFF0MEMORYRULE_H
21 | #define KOREANMDFFF0MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanMDFFF0MemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanMDFFF0MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanMDFFF0MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | int m_iRegister[3];
43 | };
44 |
45 | #endif /* KOREANMDFFF0MEMORYRULE_H */
46 |
--------------------------------------------------------------------------------
/src/KoreanMDFFF5MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANMDFFF5MEMORYRULE_H
21 | #define KOREANMDFFF5MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanMDFFF5MemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanMDFFF5MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanMDFFF5MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | int m_iRegister;
43 | };
44 |
45 | #endif /* KOREANMDFFF5MEMORYRULE_H */
46 |
--------------------------------------------------------------------------------
/src/KoreanFFF3FFFCMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANFFF3FFFCMEMORYRULE_H
21 | #define KOREANFFF3FFFCMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanFFF3FFFCMemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanFFF3FFFCMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanFFF3FFFCMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | int m_iRegister[2];
43 | };
44 |
45 | #endif /* KOREANFFF3FFFCMEMORYRULE_H */
--------------------------------------------------------------------------------
/src/KoreanMSXSMS8000MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef KOREANMSXSMS8000MEMORYRULE_H
21 | #define KOREANMSXSMS8000MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class KoreanMSXSMS8000MemoryRule : public MemoryRule
26 | {
27 | public:
28 | KoreanMSXSMS8000MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~KoreanMSXSMS8000MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetPage(int index);
34 | virtual int GetBank(int index);
35 | virtual bool Has8kBanks();
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iPage[6];
41 | int m_iPageAddress[6];
42 | u8 m_Register;
43 | };
44 |
45 | #endif /* KOREANMSXSMS8000MEMORYRULE_H */
46 |
--------------------------------------------------------------------------------
/src/CodemastersMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef CODEMASTERSMEMORYRULE_H
21 | #define CODEMASTERSMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class CodemastersMemoryRule : public MemoryRule
26 | {
27 | public:
28 | CodemastersMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~CodemastersMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual u8* GetRamBanks();
34 | virtual u8* GetPage(int index);
35 | virtual int GetBank(int index);
36 | virtual void SaveState(std::ostream& stream);
37 | virtual void LoadState(std::istream& stream);
38 |
39 | private:
40 | int m_iMapperSlot[3];
41 | int m_iMapperSlotAddress[3];
42 | u8* m_pCartRAM;
43 | bool m_bRAMBankActive;
44 | };
45 |
46 | #endif /* CODEMASTERSMEMORYRULE_H */
47 |
--------------------------------------------------------------------------------
/src/SmsIOPorts.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #include "SmsIOPorts.h"
21 |
22 | SmsIOPorts::SmsIOPorts(Audio* pAudio, Video* pVideo, Input* pInput, Cartridge* pCartridge, Memory* pMemory, Processor* pProcessor)
23 | {
24 | m_pAudio = pAudio;
25 | m_pVideo = pVideo;
26 | m_pInput = pInput;
27 | m_pCartridge = pCartridge;
28 | m_pMemory = pMemory;
29 | m_pProcessor = pProcessor;
30 | Reset();
31 | }
32 |
33 | SmsIOPorts::~SmsIOPorts()
34 | {
35 | }
36 |
37 | void SmsIOPorts::Reset()
38 | {
39 | m_Port3F = 0xFF;
40 | }
41 |
42 | void SmsIOPorts::SaveState(std::ostream& stream)
43 | {
44 | using namespace std;
45 |
46 | stream.write(reinterpret_cast (&m_Port3F), sizeof(m_Port3F));
47 | }
48 |
49 | void SmsIOPorts::LoadState(std::istream& stream)
50 | {
51 | using namespace std;
52 |
53 | stream.read(reinterpret_cast (&m_Port3F), sizeof(m_Port3F));
54 | }
55 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/close_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file close_code.h
24 | *
25 | * This file reverses the effects of begin_code.h and should be included
26 | * after you finish any function and structure declarations in your headers
27 | */
28 |
29 | #ifndef SDL_begin_code_h
30 | #error close_code.h included without matching begin_code.h
31 | #endif
32 | #undef SDL_begin_code_h
33 |
34 | /* Reset structure packing at previous byte alignment */
35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
36 | #ifdef __BORLANDC__
37 | #pragma nopackwarning
38 | #endif
39 | #pragma pack(pop)
40 | #endif /* Compiler needs structure packing set */
41 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-ngage.md:
--------------------------------------------------------------------------------
1 | Nokia N-Gage
2 | ============
3 |
4 | SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
5 | (Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
6 |
7 | Compiling
8 | ---------
9 |
10 | SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
11 | The library is included in the
12 | [toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
13 | sub-module.
14 |
15 | A complete example project based on SDL2 can be found in the GitHub
16 | account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
17 |
18 | Current level of implementation
19 | -------------------------------
20 |
21 | The video driver currently provides full screen video support with
22 | keyboard input.
23 |
24 | At the moment only the software renderer works.
25 |
26 | Audio is not yet implemented.
27 |
28 | Acknowledgements
29 | ----------------
30 |
31 | Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
32 | valuable insight into Symbian programming. Without the SDL 1.2 port
33 | which was specially developed for CDoom (Doom for the Nokia 9210), this
34 | adaptation would not have been possible.
35 |
36 | I would like to thank my friends
37 | [Razvan](https://twitter.com/bewarerazvan) and [Dan
38 | Whelan](https://danwhelan.ie/), for their continuous support. Without
39 | you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
40 | have lost my patience long ago.
41 |
42 | Last but not least, I would like to thank the development team of
43 | [EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
44 | patience and support in troubleshooting helped me a lot.
45 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/renderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef RENDERER_H
21 | #define RENDERER_H
22 |
23 | #ifdef RENDERER_IMPORT
24 | #define EXTERN
25 | #else
26 | #define EXTERN extern
27 | #endif
28 |
29 | #define FRAME_BUFFER_SCALE 4
30 | #define SYSTEM_TEXTURE_WIDTH 512
31 | #define SYSTEM_TEXTURE_HEIGHT 512
32 | #define FRAME_BUFFER_WIDTH (SYSTEM_TEXTURE_WIDTH * FRAME_BUFFER_SCALE)
33 | #define FRAME_BUFFER_HEIGHT (SYSTEM_TEXTURE_HEIGHT * FRAME_BUFFER_SCALE)
34 |
35 | EXTERN uint32_t renderer_emu_texture;
36 | EXTERN uint32_t renderer_emu_debug_vram_background;
37 | EXTERN uint32_t renderer_emu_debug_vram_tiles;
38 | EXTERN uint32_t renderer_emu_debug_vram_sprites[64];
39 | EXTERN const char* renderer_opengl_version;
40 |
41 | EXTERN bool renderer_init(void);
42 | EXTERN void renderer_destroy(void);
43 | EXTERN void renderer_begin_render(void);
44 | EXTERN void renderer_render(void);
45 | EXTERN void renderer_end_render(void);
46 |
47 | #undef RENDERER_IMPORT
48 | #undef EXTERN
49 | #endif /* RENDERER_H */
50 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_opengles2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles2.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
30 |
31 | #ifdef __IPHONEOS__
32 | #include
33 | #include
34 | #else
35 | #include
36 | #include
37 | #include
38 | #endif
39 |
40 | #else /* _MSC_VER */
41 |
42 | /* OpenGL ES2 headers for Visual Studio */
43 | #include "SDL_opengles2_khrplatform.h"
44 | #include "SDL_opengles2_gl2platform.h"
45 | #include "SDL_opengles2_gl2.h"
46 | #include "SDL_opengles2_gl2ext.h"
47 |
48 | #endif /* _MSC_VER */
49 |
50 | #ifndef APIENTRY
51 | #define APIENTRY GL_APIENTRY
52 | #endif
53 |
--------------------------------------------------------------------------------
/src/JumboDahjeeMemoryRule.cpp:
--------------------------------------------------------------------------------
1 | #include "JumboDahjeeMemoryRule.h"
2 | #include "Memory.h"
3 | #include "Cartridge.h"
4 |
5 | JumboDahjeeMemoryRule::JumboDahjeeMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput)
6 | : MemoryRule(pMemory, pCartridge, pInput)
7 | {
8 | m_pCartRAM = new u8[0x2000];
9 | Reset();
10 | }
11 |
12 | JumboDahjeeMemoryRule::~JumboDahjeeMemoryRule()
13 | {
14 | SafeDeleteArray(m_pCartRAM);
15 | }
16 |
17 | u8 JumboDahjeeMemoryRule::PerformRead(u16 address)
18 | {
19 | if (address >= 0x2000 && address < 0x4000)
20 | return m_pCartRAM[address - 0x2000];
21 | else
22 | {
23 | if (address >= 0xC000)
24 | address = 0xC000 + (address & 0x3FF);
25 |
26 | return m_pMemory->Retrieve(address);
27 | }
28 | }
29 |
30 | void JumboDahjeeMemoryRule::PerformWrite(u16 address, u8 value)
31 | {
32 | if (address < 0x2000)
33 | {
34 | Debug("--> ** Attempting to write on ROM address $%X %X", address, value);
35 | }
36 | else if (address < 0x4000)
37 | {
38 | m_pCartRAM[address - 0x2000] = value;
39 | }
40 | else if (address < 0xC000)
41 | {
42 | Debug("--> ** Attempting to write on ROM address $%X %X", address, value);
43 | }
44 | else
45 | {
46 | address = 0xC000 + (address & 0x3FF);
47 | m_pMemory->Load(address, value);
48 | }
49 | }
50 |
51 | void JumboDahjeeMemoryRule::Reset()
52 | {
53 | for (int i = 0; i < 0x2000; i++)
54 | m_pCartRAM[i] = 0;
55 | }
56 |
57 | u8* JumboDahjeeMemoryRule::GetPage(int index)
58 | {
59 | if ((index >= 0) && (index < 3))
60 | return m_pMemory->GetMemoryMap() + (0x4000 * index);
61 | else
62 | return NULL;
63 | }
64 |
65 | int JumboDahjeeMemoryRule::GetBank(int index)
66 | {
67 | if ((index >= 0) && (index < 3))
68 | return index;
69 | else
70 | return 0;
71 | }
72 |
--------------------------------------------------------------------------------
/src/SegaMemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef SEGAMEMORYRULE_H
21 | #define SEGAMEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class SegaMemoryRule : public MemoryRule
26 | {
27 | public:
28 | SegaMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~SegaMemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual void SaveRam(std::ostream &file);
34 | virtual bool LoadRam(std::istream &file, s32 fileSize);
35 | virtual bool PersistedRAM();
36 | virtual size_t GetRamSize();
37 | virtual u8* GetRamBanks();
38 | virtual int GetRamBank();
39 | virtual u8* GetPage(int index);
40 | virtual int GetBank(int index);
41 | virtual void SaveState(std::ostream& stream);
42 | virtual void LoadState(std::istream& stream);
43 |
44 | private:
45 | int m_iMapperSlot[3];
46 | int m_iMapperSlotAddress[3];
47 | u8* m_pRAMBanks;
48 | u16 m_RAMBankStartAddress;
49 | bool m_bRAMEnabled;
50 | int m_iPersistRAM;
51 | };
52 |
53 | #endif /* SEGAMEMORYRULE_H */
54 |
--------------------------------------------------------------------------------
/src/audio/Stereo_Buffer.h:
--------------------------------------------------------------------------------
1 |
2 | // Simple stereo Blip_Buffer for sound emulators whose oscillators output
3 | // either on the left only, center, or right only.
4 |
5 | // Blip_Buffer 0.3.0. Copyright (C) 2003-2004 Shay Green. GNU GPL license.
6 |
7 | #ifndef STEREO_BUFFER_H
8 | #define STEREO_BUFFER_H
9 |
10 | #include "Blip_Buffer.h"
11 |
12 | class Stereo_Buffer {
13 | public:
14 | Stereo_Buffer();
15 | ~Stereo_Buffer();
16 |
17 | // Same as in Blip_Buffer (see Blip_Buffer.h)
18 | bool set_sample_rate( long, int msec = 250 );
19 | void clock_rate( long );
20 | void bass_freq( int );
21 | void clear();
22 |
23 | // Buffers to output synthesis to
24 | Blip_Buffer* left();
25 | Blip_Buffer* center();
26 | Blip_Buffer* right();
27 |
28 | // Same as in Blip_Buffer. For more efficient operation, pass false
29 | // for was_stereo if the left and right buffers had nothing added
30 | // to them for this frame.
31 | void end_frame( blip_time_t, bool was_stereo = true );
32 |
33 | // Output is stereo with channels interleved, left before right. Counts
34 | // are in samples, *not* pairs.
35 | long samples_avail() const;
36 | long read_samples( blip_sample_t*, long );
37 |
38 | private:
39 | // noncopyable
40 | Stereo_Buffer( const Stereo_Buffer& );
41 | Stereo_Buffer& operator = ( const Stereo_Buffer& );
42 |
43 | enum { buf_count = 3 };
44 | Blip_Buffer bufs [buf_count];
45 | bool stereo_added;
46 | bool was_stereo;
47 |
48 | void mix_stereo( blip_sample_t*, long );
49 | void mix_mono( blip_sample_t*, long );
50 | };
51 |
52 | inline Blip_Buffer* Stereo_Buffer::left() {
53 | return &bufs [1];
54 | }
55 |
56 | inline Blip_Buffer* Stereo_Buffer::center() {
57 | return &bufs [0];
58 | }
59 |
60 | inline Blip_Buffer* Stereo_Buffer::right() {
61 | return &bufs [2];
62 | }
63 |
64 | inline long Stereo_Buffer::samples_avail() const {
65 | return bufs [0].samples_avail();
66 | }
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-vita.md:
--------------------------------------------------------------------------------
1 | PS Vita
2 | =======
3 | SDL port for the Sony Playstation Vita and Sony Playstation TV
4 |
5 | Credit to
6 | * xerpi, cpasjuste and rsn8887 for initial (vita2d) port
7 | * vitasdk/dolcesdk devs
8 | * CBPS discord (Namely Graphene and SonicMastr)
9 |
10 | Building
11 | --------
12 | To build for the PSVita, make sure you have vitasdk and cmake installed and run:
13 | ```
14 | cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
15 | cmake --build build
16 | cmake --install build
17 | ```
18 |
19 |
20 | Notes
21 | -----
22 | * gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
23 | These renderers support 720p and 1080i resolutions. These can be specified with:
24 | `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
25 | * Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
26 | They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
27 | anytime before video subsystem initialization.
28 | * gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
29 | * By default SDL emits mouse events for touch events on every touchscreen.
30 | Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
31 | Individual touchscreens can be disabled with:
32 | `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
33 | * Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
34 |
--------------------------------------------------------------------------------
/src/VgmRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef VGM_RECORDER_H
21 | #define VGM_RECORDER_H
22 |
23 | #include "definitions.h"
24 | #include
25 | #include
26 | #include
27 |
28 | class VgmRecorder
29 | {
30 | public:
31 | VgmRecorder();
32 | ~VgmRecorder();
33 |
34 | void Start(const char* file_path, int clock_rate, bool is_pal, bool has_ym2413);
35 | void Stop();
36 | bool IsRecording() const { return m_bRecording; }
37 |
38 | void WritePSG(u8 data);
39 | void WriteGGStereo(u8 data);
40 | void WriteYM2413(u8 port, u8 data);
41 | void UpdateTiming(int elapsed_samples);
42 |
43 | private:
44 | void WriteCommand(u8 command);
45 | void WriteCommand(u8 command, u8 data);
46 | void WriteCommand(u8 command, u8 data1, u8 data2);
47 | void WriteWait(int samples);
48 | void FlushPendingWait();
49 |
50 | private:
51 | bool m_bRecording;
52 | std::string m_FilePath;
53 | std::vector m_CommandBuffer;
54 | int m_PendingWait;
55 | int m_TotalSamples;
56 | int m_ClockRate;
57 | bool m_bPAL;
58 | bool m_bHasYM2413;
59 | u8 m_YM2413Register;
60 | };
61 |
62 | #endif /* VGM_RECORDER_H */
63 |
--------------------------------------------------------------------------------
/src/GameGearIOPorts.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #include "GameGearIOPorts.h"
21 |
22 | GameGearIOPorts::GameGearIOPorts(Audio* pAudio, Video* pVideo, Input* pInput, Cartridge* pCartridge, Memory* pMemory)
23 | {
24 | m_pAudio = pAudio;
25 | m_pVideo = pVideo;
26 | m_pInput = pInput;
27 | m_pCartridge = pCartridge;
28 | m_pMemory = pMemory;
29 | Reset();
30 | }
31 |
32 | GameGearIOPorts::~GameGearIOPorts()
33 | {
34 | }
35 |
36 | void GameGearIOPorts::Reset()
37 | {
38 | m_Port3F = 0xFF;
39 | m_Ports[0] = 0xC0;
40 | m_Ports[1] = 0x7F;
41 | m_Ports[2] = 0xFF;
42 | m_Ports[3] = 0x00;
43 | m_Ports[4] = 0xFF;
44 | m_Ports[5] = 0x00;
45 | }
46 |
47 | void GameGearIOPorts::SaveState(std::ostream& stream)
48 | {
49 | using namespace std;
50 |
51 | stream.write(reinterpret_cast (&m_Port3F), sizeof(m_Port3F));
52 | stream.write(reinterpret_cast (m_Ports), sizeof(m_Ports));
53 | }
54 |
55 | void GameGearIOPorts::LoadState(std::istream& stream)
56 | {
57 | using namespace std;
58 |
59 | stream.read(reinterpret_cast (&m_Port3F), sizeof(m_Port3F));
60 | stream.read(reinterpret_cast (m_Ports), sizeof(m_Ports));
61 | }
62 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-ps2.md:
--------------------------------------------------------------------------------
1 | PS2
2 | ======
3 | SDL2 port for the Sony Playstation 2 contributed by:
4 | - Francisco Javier Trujillo Mata
5 |
6 |
7 | Credit to
8 | - The guys that ported SDL to PSP & Vita because I'm taking them as reference.
9 | - David G. F. for helping me with several issues and tests.
10 |
11 | ## Building
12 | To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
13 | ```bash
14 | cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
15 | cmake --build build
16 | cmake --install build
17 | ```
18 |
19 | ## Hints
20 | The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
21 | If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
22 |
23 | ## Notes
24 | If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
25 | So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
26 | It could be something similar as:
27 | ```c
28 | .....
29 |
30 | SDL_PS2_SKIP_IOP_RESET();
31 |
32 | int main(int argc, char *argv[])
33 | {
34 | .....
35 | ```
36 | For a release binary is recommendable to reset the IOP always.
37 |
38 | Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
39 |
40 | ## Getting PS2 Dev
41 | [Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
42 |
43 | ## Running on PCSX2 Emulator
44 | [PCSX2](https://github.com/PCSX2/pcsx2)
45 |
46 | [More PCSX2 information](https://pcsx2.net/)
47 |
48 | ## To Do
49 | - PS2 Screen Keyboard
50 | - Dialogs
51 | - Others
52 |
--------------------------------------------------------------------------------
/src/MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef MEMORYRULE_H
21 | #define MEMORYRULE_H
22 |
23 | #include "definitions.h"
24 |
25 | class Memory;
26 | class Cartridge;
27 | class Input;
28 |
29 | class MemoryRule
30 | {
31 | public:
32 | MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
33 | virtual ~MemoryRule();
34 | virtual u8 PerformRead(u16 address) = 0;
35 | virtual void PerformWrite(u16 address, u8 value) = 0;
36 | virtual void Reset() = 0;
37 | virtual void SaveRam(std::ostream &file);
38 | virtual bool LoadRam(std::istream &file, s32 fileSize);
39 | virtual void SetRamChangedCallback(RamChangedCallback callback);
40 | virtual bool PersistedRAM();
41 | virtual size_t GetRamSize();
42 | virtual u8* GetRamBanks();
43 | virtual int GetRamBank();
44 | virtual u8* GetPage(int index);
45 | virtual int GetBank(int index);
46 | virtual bool Has8kBanks();
47 | virtual void SaveState(std::ostream& stream);
48 | virtual void LoadState(std::istream& stream);
49 |
50 | protected:
51 | Memory* m_pMemory;
52 | Cartridge* m_pCartridge;
53 | Input* m_pInput;
54 | RamChangedCallback m_pRamChangedCallback;
55 | };
56 |
57 | #endif /* MEMORYRULE_H */
58 |
--------------------------------------------------------------------------------
/src/MemoryRule.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #include "MemoryRule.h"
21 |
22 | MemoryRule::MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput)
23 | {
24 | m_pMemory = pMemory;
25 | m_pCartridge = pCartridge;
26 | m_pInput = pInput;
27 | }
28 |
29 | MemoryRule::~MemoryRule()
30 | {
31 | }
32 |
33 | void MemoryRule::SaveRam(std::ostream&)
34 | {
35 | }
36 |
37 | bool MemoryRule::LoadRam(std::istream&, s32)
38 | {
39 | return false;
40 | }
41 |
42 | void MemoryRule::SetRamChangedCallback(RamChangedCallback callback)
43 | {
44 | m_pRamChangedCallback = callback;
45 | }
46 |
47 | bool MemoryRule::PersistedRAM()
48 | {
49 | return false;
50 | }
51 |
52 | size_t MemoryRule::GetRamSize()
53 | {
54 | return 0;
55 | }
56 |
57 | u8* MemoryRule::GetRamBanks()
58 | {
59 | return NULL;
60 | }
61 |
62 | int MemoryRule::GetRamBank()
63 | {
64 | return 0;
65 | }
66 |
67 | u8* MemoryRule::GetPage(int)
68 | {
69 | return NULL;
70 | }
71 |
72 | int MemoryRule::GetBank(int)
73 | {
74 | return 0;
75 | }
76 |
77 | bool MemoryRule::Has8kBanks()
78 | {
79 | return false;
80 | }
81 |
82 | void MemoryRule::SaveState(std::ostream&)
83 | {
84 | }
85 |
86 | void MemoryRule::LoadState(std::istream&)
87 | {
88 | }
89 |
--------------------------------------------------------------------------------
/src/log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef LOG_H
21 | #define LOG_H
22 |
23 | #include
24 | #include
25 | #include "definitions.h"
26 |
27 | #if defined(__LIBRETRO__)
28 | #include "libretro.h"
29 | extern retro_log_printf_t log_cb;
30 | #endif
31 |
32 | #if defined(DEBUG_GEARSYSTEM)
33 | #if defined(__ANDROID__)
34 | #include
35 | #define printf(...) __android_log_print(ANDROID_LOG_DEBUG, GG_TITLE, __VA_ARGS__);
36 | #endif
37 | #define Debug(msg, ...) (Log_func(msg, ##__VA_ARGS__))
38 | #else
39 | #define Debug(msg, ...)
40 | #endif
41 |
42 | #define Log(msg, ...) (Log_func(msg, ##__VA_ARGS__))
43 |
44 | inline void Log_func(const char* const msg, ...)
45 | {
46 | char buffer[512];
47 | va_list args;
48 | va_start(args, msg);
49 | vsnprintf(buffer, 512, msg, args);
50 | va_end(args);
51 |
52 | #if defined(__LIBRETRO__)
53 | if (log_cb)
54 | {
55 | log_cb(RETRO_LOG_INFO, "%s\n", buffer);
56 | return;
57 | }
58 | #endif
59 |
60 | #if defined(DEBUG_GEARSYSTEM)
61 | static int count = 1;
62 | printf("%d: %s\n", count, buffer);
63 | count++;
64 | #else
65 | printf("%s\n", buffer);
66 | #endif
67 |
68 | fflush(stdout);
69 | }
70 |
71 | #endif /* LOG_H */
72 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-riscos.md:
--------------------------------------------------------------------------------
1 | RISC OS
2 | =======
3 |
4 | Requirements:
5 |
6 | * RISC OS 3.5 or later.
7 | * [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
8 | * [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
9 | * [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
10 |
11 |
12 | Compiling:
13 | ----------
14 |
15 | Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
16 |
17 | The following commands can be used to build SDL2 for RISC OS using autoconf:
18 |
19 | ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
20 | make
21 | make install
22 |
23 | The following commands can be used to build SDL2 for RISC OS using CMake:
24 |
25 | cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
26 | cmake --build build-riscos
27 | cmake --build build-riscos --target install
28 |
29 |
30 | Current level of implementation
31 | -------------------------------
32 |
33 | The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
34 |
35 | The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
36 |
37 | The audio, loadso, thread and timer APIs are currently provided by UnixLib.
38 |
39 | GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
40 |
41 | The joystick, locale and power APIs are not yet implemented.
42 |
--------------------------------------------------------------------------------
/platforms/audio-shared/sound_queue.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef SOUND_QUEUE_H
21 | #define SOUND_QUEUE_H
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | class SoundQueue
28 | {
29 | public:
30 | SoundQueue();
31 | ~SoundQueue();
32 | bool Start(int sample_rate, int channel_count, int buffer_size = 2048, int buffer_count = 3);
33 | void Stop();
34 | void Write(int16_t* samples, int count, bool sync);
35 | int GetSampleCount();
36 | int16_t* GetCurrentlyPlaying();
37 | bool IsOpen();
38 |
39 | private:
40 | int16_t* volatile m_buffers;
41 | SDL_sem* volatile m_free_sem;
42 | int16_t* volatile m_currently_playing;
43 | int volatile m_read_buffer;
44 | int m_write_buffer;
45 | int m_write_position;
46 | bool m_sound_open;
47 | bool m_sync_output;
48 | int m_buffer_size;
49 | int m_buffer_count;
50 |
51 | private:
52 | int16_t* Buffer(int index);
53 | void FillBuffer(uint8_t* buffer, int count);
54 | bool IsRunningInWSL();
55 | static void FillBufferCallback(void* user_data, uint8_t* buffer, int count);
56 | };
57 |
58 | inline int16_t* SoundQueue::Buffer(int index)
59 | {
60 | assert(index < m_buffer_count);
61 | return m_buffers + (index * m_buffer_size);
62 | }
63 |
64 | #endif /* SOUND_QUEUE_H */
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_test_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_memory.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_memory_h_
31 | #define SDL_test_memory_h_
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 |
40 | /**
41 | * \brief Start tracking SDL memory allocations
42 | *
43 | * \note This should be called before any other SDL functions for complete tracking coverage
44 | */
45 | int SDLTest_TrackAllocations(void);
46 |
47 | /**
48 | * \brief Print a log of any outstanding allocations
49 | *
50 | * \note This can be called after SDL_Quit()
51 | */
52 | void SDLTest_LogAllocations(void);
53 |
54 |
55 | /* Ends C function definitions when using C++ */
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 | #include "close_code.h"
60 |
61 | #endif /* SDL_test_memory_h_ */
62 |
63 | /* vi: set ts=4 sw=4 expandtab: */
64 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/gui_debug_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef GUI_DEBUG_MEMORY_H
21 | #define GUI_DEBUG_MEMORY_H
22 |
23 | #ifdef GUI_DEBUG_MEMORY_IMPORT
24 | #define EXTERN
25 | #else
26 | #define EXTERN extern
27 | #endif
28 |
29 | enum Memory_Editor_Tabs
30 | {
31 | MEMORY_EDITOR_FIXED_1K = 0,
32 | MEMORY_EDITOR_ROM0_SEGA,
33 | MEMORY_EDITOR_ROM0,
34 | MEMORY_EDITOR_ROM1,
35 | MEMORY_EDITOR_ROM2_CODEMASTERS,
36 | MEMORY_EDITOR_EXT_RAM,
37 | MEMORY_EDITOR_ROM2,
38 | MEMORY_EDITOR_RAM,
39 | MEMORY_EDITOR_VRAM,
40 | MEMORY_EDITOR_CRAM,
41 | MEMORY_EDITOR_ROM0_8K,
42 | MEMORY_EDITOR_ROM1_8K,
43 | MEMORY_EDITOR_ROM2_8K,
44 | MEMORY_EDITOR_ROM3_8K,
45 | MEMORY_EDITOR_ROM4_8K,
46 | MEMORY_EDITOR_ROM5_8K,
47 | MEMORY_EDITOR_MAX
48 | };
49 |
50 | EXTERN void gui_debug_memory_init(void);
51 | EXTERN void gui_debug_memory_reset(void);
52 | EXTERN void gui_debug_window_memory(void);
53 | EXTERN void gui_debug_memory_search_window(void);
54 | EXTERN void gui_debug_memory_watches_window(void);
55 | EXTERN void gui_debug_memory_step_frame(void);
56 | EXTERN void gui_debug_memory_copy(void);
57 | EXTERN void gui_debug_memory_paste(void);
58 | EXTERN void gui_debug_memory_select_all(void);
59 | EXTERN void gui_debug_memory_goto(int editor, int address);
60 | EXTERN void gui_debug_memory_save_dump(const char* file_path, bool binary);
61 |
62 | #undef GUI_DEBUG_MEMORY_IMPORT
63 | #undef EXTERN
64 | #endif /* GUI_DEBUG_MEMORY_H */
--------------------------------------------------------------------------------
/src/RomOnlyMemoryRule.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #include "RomOnlyMemoryRule.h"
21 | #include "Memory.h"
22 | #include "Cartridge.h"
23 |
24 | RomOnlyMemoryRule::RomOnlyMemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput) : MemoryRule(pMemory, pCartridge, pInput)
25 | {
26 | Reset();
27 | }
28 |
29 | RomOnlyMemoryRule::~RomOnlyMemoryRule()
30 | {
31 | }
32 |
33 | u8 RomOnlyMemoryRule::PerformRead(u16 address)
34 | {
35 | return m_pMemory->Retrieve(address);
36 | }
37 |
38 | void RomOnlyMemoryRule::PerformWrite(u16 address, u8 value)
39 | {
40 | if (address < 0xC000)
41 | {
42 | // ROM page 0, 1 and 2
43 | Debug("--> ** Attempting to write on ROM address $%X %X", address, value);
44 | }
45 | else if (address < 0xE000)
46 | {
47 | // RAM
48 | m_pMemory->Load(address, value);
49 | m_pMemory->Load(address + 0x2000, value);
50 | }
51 | else
52 | {
53 | // RAM (mirror)
54 | m_pMemory->Load(address, value);
55 | m_pMemory->Load(address - 0x2000, value);
56 | }
57 | }
58 |
59 | void RomOnlyMemoryRule::Reset()
60 | {
61 | }
62 |
63 | u8* RomOnlyMemoryRule::GetPage(int index)
64 | {
65 | if ((index >= 0) && (index < 3))
66 | return m_pMemory->GetMemoryMap() + (0x4000 * index);
67 | else
68 | return NULL;
69 | }
70 |
71 | int RomOnlyMemoryRule::GetBank(int index)
72 | {
73 | if ((index >= 0) && (index < 3))
74 | return index;
75 | else
76 | return 0;
77 | }
78 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_test_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_log.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | /*
31 | *
32 | * Wrapper to log in the TEST category
33 | *
34 | */
35 |
36 | #ifndef SDL_test_log_h_
37 | #define SDL_test_log_h_
38 |
39 | #include "begin_code.h"
40 | /* Set up for C function definitions, even when using C++ */
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | /**
46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority.
47 | *
48 | * \param fmt Message to be logged
49 | */
50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
51 |
52 | /**
53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
54 | *
55 | * \param fmt Message to be logged
56 | */
57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
58 |
59 | /* Ends C function definitions when using C++ */
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 | #include "close_code.h"
64 |
65 | #endif /* SDL_test_log_h_ */
66 |
67 | /* vi: set ts=4 sw=4 expandtab: */
68 |
--------------------------------------------------------------------------------
/src/audio/Sms_Apu.h:
--------------------------------------------------------------------------------
1 | // Sega Master System SN76489 PSG sound chip emulator
2 |
3 | // Sms_Snd_Emu 0.1.4
4 | #ifndef SMS_APU_H
5 | #define SMS_APU_H
6 |
7 | #include "Sms_Oscs.h"
8 |
9 | class Sms_Apu {
10 | public:
11 | // Set overall volume of all oscillators, where 1.0 is full volume
12 | void volume( double );
13 |
14 | // Set treble equalization
15 | void treble_eq( const blip_eq_t& );
16 |
17 | // Outputs can be assigned to a single buffer for mono output, or to three
18 | // buffers for stereo output (using Stereo_Buffer to do the mixing).
19 |
20 | // Assign all oscillator outputs to specified buffer(s). If buffer
21 | // is NULL, silences all oscillators.
22 | void output( Blip_Buffer* mono );
23 | void output( Blip_Buffer* center, Blip_Buffer* left, Blip_Buffer* right );
24 |
25 | // Assign single oscillator output to buffer(s). Valid indicies are 0 to 3,
26 | // which refer to Square 1, Square 2, Square 3, and Noise. If buffer is NULL,
27 | // silences oscillator.
28 | enum { osc_count = 4 };
29 | void osc_output( int index, Blip_Buffer* mono );
30 | void osc_output( int index, Blip_Buffer* center, Blip_Buffer* left, Blip_Buffer* right );
31 |
32 | // Reset oscillators and internal state
33 | void reset( bool ti_chip );
34 |
35 | // Write GameGear left/right assignment byte
36 | void write_ggstereo( blip_time_t, int );
37 |
38 | // Write to data port
39 | void write_data( blip_time_t, int );
40 |
41 | // Run all oscillators up to specified time, end current frame, then
42 | // start a new frame at time 0.
43 | void end_frame( blip_time_t );
44 |
45 | public:
46 | Sms_Apu();
47 | ~Sms_Apu();
48 | private:
49 | // noncopyable
50 | Sms_Apu( const Sms_Apu& );
51 | Sms_Apu& operator = ( const Sms_Apu& );
52 |
53 | Sms_Osc* oscs [osc_count];
54 | Sms_Square squares [3];
55 | Sms_Square::Synth square_synth; // used by squares
56 | blip_time_t last_time;
57 | int latch;
58 | Sms_Noise noise;
59 | unsigned noise_feedback;
60 | unsigned looped_feedback;
61 | unsigned int ggstereo_save;
62 |
63 | void run_until( blip_time_t );
64 | };
65 |
66 | inline void Sms_Apu::output( Blip_Buffer* b ) { output( b, b, b ); }
67 |
68 | inline void Sms_Apu::osc_output( int i, Blip_Buffer* b ) { osc_output( i, b, b, b ); }
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/application.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef APPLICATION_H
21 | #define APPLICATION_H
22 |
23 | #include
24 |
25 | #ifdef APPLICATION_IMPORT
26 | #define EXTERN
27 | #else
28 | #define EXTERN extern
29 | #endif
30 |
31 | #define GAMEPAD_VBTN_AXIS_BASE 1000
32 | #define GAMEPAD_VBTN_AXIS_THRESHOLD 3000
33 | #define GAMEPAD_VBTN_L2 (GAMEPAD_VBTN_AXIS_BASE + SDL_CONTROLLER_AXIS_TRIGGERLEFT)
34 | #define GAMEPAD_VBTN_R2 (GAMEPAD_VBTN_AXIS_BASE + SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
35 |
36 | EXTERN SDL_Window* application_sdl_window;
37 | EXTERN SDL_GameController* application_gamepad[2];
38 | EXTERN int application_added_gamepad_mappings;
39 | EXTERN int application_updated_gamepad_mappings;
40 | EXTERN float application_display_scale;
41 | EXTERN SDL_version application_sdl_build_version;
42 | EXTERN SDL_version application_sdl_link_version;
43 | EXTERN bool application_show_menu;
44 |
45 | EXTERN int application_init(const char* rom_file, const char* symbol_file, bool force_fullscreen, bool force_windowed);
46 | EXTERN void application_destroy(void);
47 | EXTERN void application_mainloop(void);
48 | EXTERN void application_trigger_quit(void);
49 | EXTERN void application_trigger_fullscreen(bool fullscreen);
50 | EXTERN void application_trigger_fit_to_content(int width, int height);
51 | EXTERN void application_update_title_with_rom(const char* rom);
52 | EXTERN void application_assign_gamepad(int slot, int device_index);
53 |
54 | #undef APPLICATION_IMPORT
55 | #undef EXTERN
56 | #endif /* APPLICATION_H */
57 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_test.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | #ifndef SDL_test_h_
31 | #define SDL_test_h_
32 |
33 | #include "SDL.h"
34 | #include "SDL_test_assert.h"
35 | #include "SDL_test_common.h"
36 | #include "SDL_test_compare.h"
37 | #include "SDL_test_crc32.h"
38 | #include "SDL_test_font.h"
39 | #include "SDL_test_fuzzer.h"
40 | #include "SDL_test_harness.h"
41 | #include "SDL_test_images.h"
42 | #include "SDL_test_log.h"
43 | #include "SDL_test_md5.h"
44 | #include "SDL_test_memory.h"
45 | #include "SDL_test_random.h"
46 |
47 | #include "begin_code.h"
48 | /* Set up for C function definitions, even when using C++ */
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 |
53 | /* Global definitions */
54 |
55 | /*
56 | * Note: Maximum size of SDLTest log message is less than SDL's limit
57 | * to ensure we can fit additional information such as the timestamp.
58 | */
59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
60 |
61 | /* Ends C function definitions when using C++ */
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 | #include "close_code.h"
66 |
67 | #endif /* SDL_test_h_ */
68 |
69 | /* vi: set ts=4 sw=4 expandtab: */
70 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-porting.md:
--------------------------------------------------------------------------------
1 | Porting
2 | =======
3 |
4 | * Porting To A New Platform
5 |
6 | The first thing you have to do when porting to a new platform, is look at
7 | include/SDL_platform.h and create an entry there for your operating system.
8 | The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
9 | Ideally SDL_platform.h will be able to auto-detect the system it's building
10 | on based on C preprocessor symbols.
11 |
12 | There are two basic ways of building SDL at the moment:
13 |
14 | 1. The "UNIX" way: ./configure; make; make install
15 |
16 | If you have a GNUish system, then you might try this. Edit configure.ac,
17 | take a look at the large section labelled:
18 |
19 | "Set up the configuration based on the host platform!"
20 |
21 | Add a section for your platform, and then re-run autogen.sh and build!
22 |
23 | 2. Using an IDE:
24 |
25 | If you're using an IDE or other non-configure build system, you'll probably
26 | want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
27 | add a section for your platform, and create a custom SDL_config_{platform}.h,
28 | based on SDL_config_minimal.h and SDL_config.h.in
29 |
30 | Add the top level include directory to the header search path, and then add
31 | the following sources to the project:
32 |
33 | src/*.c
34 | src/atomic/*.c
35 | src/audio/*.c
36 | src/cpuinfo/*.c
37 | src/events/*.c
38 | src/file/*.c
39 | src/haptic/*.c
40 | src/joystick/*.c
41 | src/power/*.c
42 | src/render/*.c
43 | src/render/software/*.c
44 | src/stdlib/*.c
45 | src/thread/*.c
46 | src/timer/*.c
47 | src/video/*.c
48 | src/audio/disk/*.c
49 | src/audio/dummy/*.c
50 | src/filesystem/dummy/*.c
51 | src/video/dummy/*.c
52 | src/haptic/dummy/*.c
53 | src/joystick/dummy/*.c
54 | src/main/dummy/*.c
55 | src/thread/generic/*.c
56 | src/timer/dummy/*.c
57 | src/loadso/dummy/*.c
58 |
59 |
60 | Once you have a working library without any drivers, you can go back to each
61 | of the major subsystems and start implementing drivers for your platform.
62 |
63 | If you have any questions, don't hesitate to ask on the SDL mailing list:
64 | http://www.libsdl.org/mailing-list.php
65 |
66 | Enjoy!
67 | Sam Lantinga (slouken@libsdl.org)
68 |
69 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_quit.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_quit.h
24 | *
25 | * Include file for SDL quit event handling.
26 | */
27 |
28 | #ifndef SDL_quit_h_
29 | #define SDL_quit_h_
30 |
31 | #include "SDL_stdinc.h"
32 | #include "SDL_error.h"
33 |
34 | /**
35 | * \file SDL_quit.h
36 | *
37 | * An ::SDL_QUIT event is generated when the user tries to close the application
38 | * window. If it is ignored or filtered out, the window will remain open.
39 | * If it is not ignored or filtered, it is queued normally and the window
40 | * is allowed to close. When the window is closed, screen updates will
41 | * complete, but have no effect.
42 | *
43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
44 | * and SIGTERM (system termination request), if handlers do not already
45 | * exist, that generate ::SDL_QUIT events as well. There is no way
46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal
47 | * handler in your application will override the default generation of
48 | * quit events for that signal.
49 | *
50 | * \sa SDL_Quit()
51 | */
52 |
53 | /* There are no functions directly affecting the quit event */
54 |
55 | #define SDL_QuitRequested() \
56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
57 |
58 | #endif /* SDL_quit_h_ */
59 |
--------------------------------------------------------------------------------
/src/Memory_inline.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef MEMORY_INLINE_H
21 | #define MEMORY_INLINE_H
22 |
23 | inline u8 Memory::Read(u16 address)
24 | {
25 | #ifndef GEARSYSTEM_DISABLE_DISASSEMBLER
26 | CheckBreakpoints(address, false);
27 | #endif
28 |
29 | if (m_MediaSlot == m_DesiredMediaSlot)
30 | return m_pCurrentMemoryRule->PerformRead(address);
31 |
32 | if (m_MediaSlot == BiosSlot)
33 | return m_pBootromMemoryRule->PerformRead(address);
34 |
35 | if (address < 0xC000)
36 | return 0xFF;
37 | else
38 | return m_pBootromMemoryRule->PerformRead(address);
39 | }
40 |
41 | inline void Memory::Write(u16 address, u8 value)
42 | {
43 | #ifndef GEARSYSTEM_DISABLE_DISASSEMBLER
44 | CheckBreakpoints(address, true);
45 | #endif
46 |
47 | if (m_MediaSlot == m_DesiredMediaSlot)
48 | m_pCurrentMemoryRule->PerformWrite(address, value);
49 | else if (m_MediaSlot == BiosSlot)
50 | m_pBootromMemoryRule->PerformWrite(address, value);
51 | else if (address >= 0xC000)
52 | m_pBootromMemoryRule->PerformWrite(address, value);
53 | }
54 |
55 | inline u8 Memory::Retrieve(u16 address)
56 | {
57 | return m_pMap[address];
58 | }
59 |
60 | inline void Memory::Load(u16 address, u8 value)
61 | {
62 | m_pMap[address] = value;
63 | }
64 |
65 | inline Memory::stDisassembleRecord** Memory::GetDisassembledMemoryMap()
66 | {
67 | return m_pDisassembledMap;
68 | }
69 |
70 | inline Memory::stDisassembleRecord** Memory::GetDisassembledROMMemoryMap()
71 | {
72 | return m_pDisassembledROMMap;
73 | }
74 |
75 | #endif /* MEMORY_INLINE_H */
76 |
77 |
--------------------------------------------------------------------------------
/platforms/libretro/Makefile.common:
--------------------------------------------------------------------------------
1 | SOURCES_C := $(SOURCE_DIR)/audio/emu2413/emu2413.c \
2 | $(SOURCE_DIR)/miniz/miniz.c
3 |
4 | SOURCES_CXX := $(CORE_DIR)/libretro.cpp \
5 | $(SOURCE_DIR)/Audio.cpp \
6 | $(SOURCE_DIR)/Cartridge.cpp \
7 | $(SOURCE_DIR)/CodemastersMemoryRule.cpp \
8 | $(SOURCE_DIR)/GameGearIOPorts.cpp \
9 | $(SOURCE_DIR)/GearsystemCore.cpp \
10 | $(SOURCE_DIR)/Input.cpp \
11 | $(SOURCE_DIR)/KoreanMemoryRule.cpp \
12 | $(SOURCE_DIR)/KoreanMSXSMS8000MemoryRule.cpp \
13 | $(SOURCE_DIR)/KoreanSMS32KB2000MemoryRule.cpp \
14 | $(SOURCE_DIR)/KoreanMSX32KB2000MemoryRule.cpp \
15 | $(SOURCE_DIR)/Korean2000XOR1FMemoryRule.cpp \
16 | $(SOURCE_DIR)/KoreanMSX8KB0300MemoryRule.cpp \
17 | $(SOURCE_DIR)/Korean0000XORFFMemoryRule.cpp \
18 | $(SOURCE_DIR)/KoreanFFFFHiComMemoryRule.cpp \
19 | $(SOURCE_DIR)/KoreanFFFEMemoryRule.cpp \
20 | $(SOURCE_DIR)/KoreanBFFCMemoryRule.cpp \
21 | $(SOURCE_DIR)/KoreanFFF3FFFCMemoryRule.cpp \
22 | $(SOURCE_DIR)/KoreanMDFFF5MemoryRule.cpp \
23 | $(SOURCE_DIR)/KoreanMDFFF0MemoryRule.cpp \
24 | $(SOURCE_DIR)/Multi4PAKAllActionMemoryRule.cpp \
25 | $(SOURCE_DIR)/JumboDahjeeMemoryRule.cpp \
26 | $(SOURCE_DIR)/Eeprom93C46MemoryRule.cpp \
27 | $(SOURCE_DIR)/Memory.cpp \
28 | $(SOURCE_DIR)/MemoryRule.cpp \
29 | $(SOURCE_DIR)/MSXMemoryRule.cpp \
30 | $(SOURCE_DIR)/opcodes.cpp \
31 | $(SOURCE_DIR)/opcodes_cb.cpp \
32 | $(SOURCE_DIR)/opcodes_ed.cpp \
33 | $(SOURCE_DIR)/Processor.cpp \
34 | $(SOURCE_DIR)/RomOnlyMemoryRule.cpp \
35 | $(SOURCE_DIR)/SegaMemoryRule.cpp \
36 | $(SOURCE_DIR)/SG1000MemoryRule.cpp \
37 | $(SOURCE_DIR)/SmsIOPorts.cpp \
38 | $(SOURCE_DIR)/Video.cpp \
39 | $(SOURCE_DIR)/BootromMemoryRule.cpp \
40 | $(SOURCE_DIR)/JanggunMemoryRule.cpp \
41 | $(SOURCE_DIR)/YM2413.cpp \
42 | $(SOURCE_DIR)/VgmRecorder.cpp \
43 | $(SOURCE_DIR)/audio/Blip_Buffer.cpp \
44 | $(SOURCE_DIR)/audio/Sms_Apu.cpp \
45 | $(SOURCE_DIR)/audio/Stereo_Buffer.cpp \
46 |
--------------------------------------------------------------------------------
/src/SG1000MemoryRule.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #include "SG1000MemoryRule.h"
21 | #include "Memory.h"
22 | #include "Cartridge.h"
23 |
24 | SG1000MemoryRule::SG1000MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput) : MemoryRule(pMemory, pCartridge, pInput)
25 | {
26 | Reset();
27 | }
28 |
29 | SG1000MemoryRule::~SG1000MemoryRule()
30 | {
31 | }
32 |
33 | u8 SG1000MemoryRule::PerformRead(u16 address)
34 | {
35 | if (!m_pCartridge->HasRAMWithoutBattery() && (address >= 0x4000) && (address < 0x8000))
36 | {
37 | return m_pMemory->Retrieve(address - 0x4000);
38 | }
39 |
40 | return m_pMemory->Retrieve(address);
41 | }
42 |
43 | void SG1000MemoryRule::PerformWrite(u16 address, u8 value)
44 | {
45 | if (address < 0x3000)
46 | {
47 | // ROM
48 | Debug("--> ** Attempting to write on ROM address $%X %X", address, value);
49 | }
50 | else if (address < 0x4000)
51 | {
52 | // May contain some RAM
53 | m_pMemory->Load(address, value);
54 | }
55 | else if (address < 0x8000)
56 | {
57 | // ROM
58 | Debug("--> ** Attempting to write on ROM address $%X %X", address, value);
59 | }
60 | else
61 | {
62 | // RAM
63 | m_pMemory->Load(address, value);
64 | }
65 | }
66 |
67 | void SG1000MemoryRule::Reset()
68 | {
69 | }
70 |
71 | u8* SG1000MemoryRule::GetPage(int index)
72 | {
73 | if ((index >= 0) && (index < 3))
74 | return m_pMemory->GetMemoryMap() + (0x4000 * index);
75 | else
76 | return NULL;
77 | }
78 |
79 | int SG1000MemoryRule::GetBank(int index)
80 | {
81 | if ((index >= 0) && (index < 3))
82 | return index;
83 | else
84 | return 0;
85 | }
86 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_test_compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_compare.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | /*
31 |
32 | Defines comparison functions (i.e. for surfaces).
33 |
34 | */
35 |
36 | #ifndef SDL_test_compare_h_
37 | #define SDL_test_compare_h_
38 |
39 | #include "SDL.h"
40 |
41 | #include "SDL_test_images.h"
42 |
43 | #include "begin_code.h"
44 | /* Set up for C function definitions, even when using C++ */
45 | #ifdef __cplusplus
46 | extern "C" {
47 | #endif
48 |
49 | /**
50 | * \brief Compares a surface and with reference image data for equality
51 | *
52 | * \param surface Surface used in comparison
53 | * \param referenceSurface Test Surface used in comparison
54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
55 | *
56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
57 | */
58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
59 |
60 |
61 | /* Ends C function definitions when using C++ */
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 | #include "close_code.h"
66 |
67 | #endif /* SDL_test_compare_h_ */
68 |
69 | /* vi: set ts=4 sw=4 expandtab: */
70 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README.md:
--------------------------------------------------------------------------------
1 | # Simple DirectMedia Layer
2 |
3 | https://www.libsdl.org/
4 |
5 | Simple DirectMedia Layer is a cross-platform development library designed
6 | to provide low level access to audio, keyboard, mouse, joystick, and graphics
7 | hardware via OpenGL and Direct3D. It is used by video playback software,
8 | emulators, and popular games including Valve's award winning catalog
9 | and many Humble Bundle games.
10 |
11 | SDL officially supports Windows, macOS, Linux, iOS, and Android.
12 | Support for other platforms may be found in the source code.
13 |
14 | SDL is written in C, works natively with C++, and there are bindings
15 | available for several other languages, including C# and Python.
16 |
17 | This library is distributed under the zlib license, which can be found
18 | in the file "LICENSE.txt".
19 |
20 | The best way to learn how to use SDL is to check out the header files in
21 | the "include" subdirectory and the programs in the "test" subdirectory.
22 | The header files and test programs are well commented and always up to date.
23 |
24 | More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
25 |
26 | - [Android](README-android.md)
27 | - [CMake](README-cmake.md)
28 | - [DirectFB](README-directfb.md)
29 | - [DynAPI](README-dynapi.md)
30 | - [Emscripten](README-emscripten.md)
31 | - [GDK](README-gdk.md)
32 | - [Gesture](README-gesture.md)
33 | - [Git](README-git.md)
34 | - [iOS](README-ios.md)
35 | - [Linux](README-linux.md)
36 | - [macOS](README-macos.md)
37 | - [OS/2](README-os2.md)
38 | - [Native Client](README-nacl.md)
39 | - [Pandora](README-pandora.md)
40 | - [Supported Platforms](README-platforms.md)
41 | - [Porting information](README-porting.md)
42 | - [PSP](README-psp.md)
43 | - [PS2](README-ps2.md)
44 | - [Raspberry Pi](README-raspberrypi.md)
45 | - [Touch](README-touch.md)
46 | - [Versions](README-versions.md)
47 | - [WinCE](README-wince.md)
48 | - [Windows](README-windows.md)
49 | - [WinRT](README-winrt.md)
50 | - [PSVita](README-vita.md)
51 | - [Nokia N-Gage](README-ngage.md)
52 |
53 | If you need help with the library, or just want to discuss SDL related
54 | issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
55 | which can be used as a web forum or a mailing list, at your preference.
56 |
57 | If you want to report bugs or contribute patches, please submit them to
58 | [our bug tracker](https://github.com/libsdl-org/SDL/issues)
59 |
60 | Enjoy!
61 |
62 |
63 | Sam Lantinga
64 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_test_images.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_test_images.h
24 | *
25 | * Include file for SDL test framework.
26 | *
27 | * This code is a part of the SDL2_test library, not the main SDL library.
28 | */
29 |
30 | /*
31 |
32 | Defines some images for tests.
33 |
34 | */
35 |
36 | #ifndef SDL_test_images_h_
37 | #define SDL_test_images_h_
38 |
39 | #include "SDL.h"
40 |
41 | #include "begin_code.h"
42 | /* Set up for C function definitions, even when using C++ */
43 | #ifdef __cplusplus
44 | extern "C" {
45 | #endif
46 |
47 | /**
48 | *Type for test images.
49 | */
50 | typedef struct SDLTest_SurfaceImage_s {
51 | int width;
52 | int height;
53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
54 | const char *pixel_data;
55 | } SDLTest_SurfaceImage_t;
56 |
57 | /* Test images */
58 | SDL_Surface *SDLTest_ImageBlit(void);
59 | SDL_Surface *SDLTest_ImageBlitColor(void);
60 | SDL_Surface *SDLTest_ImageBlitAlpha(void);
61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
62 | SDL_Surface *SDLTest_ImageBlitBlend(void);
63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void);
64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void);
65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void);
66 | SDL_Surface *SDLTest_ImageFace(void);
67 | SDL_Surface *SDLTest_ImagePrimitives(void);
68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
69 |
70 | /* Ends C function definitions when using C++ */
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 | #include "close_code.h"
75 |
76 | #endif /* SDL_test_images_h_ */
77 |
78 | /* vi: set ts=4 sw=4 expandtab: */
79 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef UTILS_H
21 | #define UTILS_H
22 |
23 | #include
24 | #if defined(_WIN32)
25 | #include
26 | #elif defined(__APPLE__)
27 | #include
28 | #include
29 | #elif defined(__linux__)
30 | #include
31 | #include
32 | #endif
33 |
34 | #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
35 | #define BYTE_TO_BINARY_PATTERN_SPACED "%c%c%c%c %c%c%c%c"
36 | #define BYTE_TO_BINARY_PATTERN_ALL_SPACED "%c %c %c %c %c %c %c %c"
37 | #define BYTE_TO_BINARY(byte) \
38 | (byte & 0x80 ? '1' : '0'), \
39 | (byte & 0x40 ? '1' : '0'), \
40 | (byte & 0x20 ? '1' : '0'), \
41 | (byte & 0x10 ? '1' : '0'), \
42 | (byte & 0x08 ? '1' : '0'), \
43 | (byte & 0x04 ? '1' : '0'), \
44 | (byte & 0x02 ? '1' : '0'), \
45 | (byte & 0x01 ? '1' : '0')
46 |
47 | static inline void get_executable_path(char* path, size_t size)
48 | {
49 | #if defined(_WIN32)
50 | DWORD len = GetModuleFileNameA(NULL, path, (DWORD)size);
51 | if (len > 0 && len < size) {
52 | char* last_slash = strrchr(path, '\\');
53 | if (last_slash) *last_slash = '\0';
54 | } else {
55 | path[0] = '\0';
56 | }
57 | #elif defined(__APPLE__)
58 | uint32_t bufsize = (uint32_t)size;
59 | if (_NSGetExecutablePath(path, &bufsize) == 0) {
60 | char* dir = dirname(path);
61 | strncpy(path, dir, size);
62 | path[size-1] = '\0';
63 | } else {
64 | path[0] = '\0';
65 | }
66 | #elif defined(__linux__)
67 | ssize_t len = readlink("/proc/self/exe", path, size-1);
68 | if (len != -1) {
69 | path[len] = '\0';
70 | char* last_slash = strrchr(path, '/');
71 | if (last_slash) *last_slash = '\0';
72 | } else {
73 | path[0] = '\0';
74 | }
75 | #else
76 | (void)(size);
77 | path[0] = '\0';
78 | #endif
79 | }
80 |
81 | #endif /* UTILS_H */
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "**/*.o": true,
4 | "**/*.so": true,
5 | "**/*.tmp": true,
6 | "**/gearsystem": true,
7 | "**/binary_to_compressed_c": true
8 | },
9 | "cmake.configureOnOpen": false,
10 | "files.associations": {
11 | "array": "cpp",
12 | "atomic": "cpp",
13 | "bit": "cpp",
14 | "*.tcc": "cpp",
15 | "cctype": "cpp",
16 | "chrono": "cpp",
17 | "clocale": "cpp",
18 | "cmath": "cpp",
19 | "compare": "cpp",
20 | "concepts": "cpp",
21 | "condition_variable": "cpp",
22 | "cstdarg": "cpp",
23 | "cstddef": "cpp",
24 | "cstdint": "cpp",
25 | "cstdio": "cpp",
26 | "cstdlib": "cpp",
27 | "ctime": "cpp",
28 | "cwchar": "cpp",
29 | "cwctype": "cpp",
30 | "deque": "cpp",
31 | "list": "cpp",
32 | "map": "cpp",
33 | "string": "cpp",
34 | "unordered_map": "cpp",
35 | "vector": "cpp",
36 | "exception": "cpp",
37 | "algorithm": "cpp",
38 | "functional": "cpp",
39 | "iterator": "cpp",
40 | "memory": "cpp",
41 | "memory_resource": "cpp",
42 | "numeric": "cpp",
43 | "random": "cpp",
44 | "ratio": "cpp",
45 | "string_view": "cpp",
46 | "system_error": "cpp",
47 | "tuple": "cpp",
48 | "type_traits": "cpp",
49 | "utility": "cpp",
50 | "fstream": "cpp",
51 | "initializer_list": "cpp",
52 | "iomanip": "cpp",
53 | "iosfwd": "cpp",
54 | "iostream": "cpp",
55 | "istream": "cpp",
56 | "limits": "cpp",
57 | "mutex": "cpp",
58 | "new": "cpp",
59 | "numbers": "cpp",
60 | "ostream": "cpp",
61 | "semaphore": "cpp",
62 | "sstream": "cpp",
63 | "stdexcept": "cpp",
64 | "stop_token": "cpp",
65 | "streambuf": "cpp",
66 | "thread": "cpp",
67 | "cinttypes": "cpp",
68 | "typeinfo": "cpp",
69 | "optional": "cpp",
70 | "*.def": "cpp",
71 | "variant": "cpp",
72 | "__bit_reference": "cpp",
73 | "__node_handle": "cpp",
74 | "bitset": "cpp",
75 | "locale": "cpp",
76 | "__hash_table": "cpp",
77 | "__locale": "cpp",
78 | "__split_buffer": "cpp",
79 | "__threading_support": "cpp",
80 | "__verbose_abort": "cpp",
81 | "complex": "cpp",
82 | "cstring": "cpp",
83 | "execution": "cpp",
84 | "ios": "cpp",
85 | "print": "cpp",
86 | "queue": "cpp",
87 | "stack": "cpp"
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/cmake/sdl2-config-version.cmake:
--------------------------------------------------------------------------------
1 | # based on the files generated by CMake's write_basic_package_version_file
2 |
3 | # SDL2 CMake version configuration file:
4 | # This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC
5 |
6 | if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h")
7 | message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL2-devel-2.x.y-VC")
8 | return()
9 | endif()
10 |
11 | file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h" _sdl_version_h)
12 | string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
13 | set(_sdl_major "${CMAKE_MATCH_1}")
14 | string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
15 | set(_sdl_minor "${CMAKE_MATCH_1}")
16 | string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_version_h}")
17 | set(_sdl_patch "${CMAKE_MATCH_1}")
18 | if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
19 | set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
20 | else()
21 | message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
22 | return()
23 | endif()
24 |
25 | if(PACKAGE_FIND_VERSION_RANGE)
26 | # Package version must be in the requested version range
27 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
28 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
29 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
30 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
31 | else()
32 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
33 | endif()
34 | else()
35 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
36 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
37 | else()
38 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
39 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
40 | set(PACKAGE_VERSION_EXACT TRUE)
41 | endif()
42 | endif()
43 | endif()
44 |
45 | # if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail.
46 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
47 | set(PACKAGE_VERSION_UNSUITABLE TRUE)
48 | endif()
49 |
50 | # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
51 | if(NOT (CMAKE_SIZEOF_VOID_P STREQUAL "8" OR CMAKE_SIZEOF_VOID_P STREQUAL "4"))
52 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (32+64bit)")
53 | set(PACKAGE_VERSION_UNSUITABLE TRUE)
54 | endif()
55 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/Makefile.common:
--------------------------------------------------------------------------------
1 | define HEADER
2 | ____ _
3 | / ___| ___ __ _ _ __ ___ _ _ ___| |_ ___ _ __ ___
4 | | | _ / _ \/ _` | '__/ __| | | / __| __/ _ \ '_ ` _ \
5 | | |_| | __/ (_| | | \__ \ |_| \__ \ || __/ | | | | |
6 | \____|\___|\__,_|_| |___/\__, |___/\__\___|_| |_| |_|
7 | |___/
8 |
9 | ** Building for $(PLATFORM) platform **
10 | ** Git version: $(GIT_VERSION) **
11 | ** Profile: $(BUILD_CONFIG) **
12 |
13 | endef
14 | export HEADER
15 |
16 | TARGET_NAME = gearsystem
17 | GIT_VERSION := $(shell git describe --abbrev=7 --dirty --always --tags)
18 | UNAME_S := $(shell uname -s)
19 | PLATFORM = "undefined"
20 |
21 | OBJECTS += $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o)
22 |
23 | USE_CLANG ?= 0
24 | ifeq ($(USE_CLANG), 1)
25 | CXX = clang++
26 | CC = clang
27 | else
28 | CXX = g++
29 | CC = gcc
30 | endif
31 |
32 | CPPFLAGS += -I../ -I../../
33 | CPPFLAGS += -Wall -Wextra -Wformat -DEMULATOR_BUILD=\"$(GIT_VERSION)\"
34 | CXXFLAGS += -std=c++11
35 | CFLAGS += -std=c99
36 |
37 | DEBUG ?= 0
38 | ifeq ($(DEBUG), 1)
39 | BUILD_CONFIG = Debug
40 | CPPFLAGS += -DDEBUG -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls
41 | else
42 | BUILD_CONFIG = Release
43 | CPPFLAGS += -DNDEBUG -O3 -flto=auto
44 | LDFLAGS += -O3 -flto=auto
45 | endif
46 |
47 | SANITIZE ?= 0
48 | ifeq ($(SANITIZE), 1)
49 | CPPFLAGS += -fsanitize=address,undefined -fno-sanitize-recover=all
50 | LDFLAGS += -fsanitize=address,undefined
51 | endif
52 |
53 | ifeq ($(UNAME_S), Linux)
54 | PLATFORM = "Linux"
55 | LDFLAGS += -lGL -ldl `sdl2-config --libs`
56 | CPPFLAGS += `sdl2-config --cflags`
57 | TARGET := $(TARGET_NAME)
58 | else ifeq ($(UNAME_S), Darwin)
59 | PLATFORM = "macOS"
60 | LDFLAGS += -framework OpenGL `sdl2-config --static-libs`
61 | CPPFLAGS += `sdl2-config --cflags`
62 | CPPFLAGS += -I/opt/local/include
63 | TARGET := $(TARGET_NAME)
64 | else
65 | PLATFORM = "Generic Unix-like/BSD"
66 | LDFLAGS += -lGL `sdl2-config --libs`
67 | CXXFLAGS += -std=gnu++11
68 | CPPFLAGS += `sdl2-config --cflags`
69 | TARGET := $(TARGET_NAME)
70 | endif
71 |
72 | all: header $(TARGET)
73 | @echo Build completed: $(TARGET_NAME) \($(BUILD_CONFIG)\) - $(GIT_VERSION) - $(PLATFORM)
74 |
75 | $(TARGET): $(OBJECTS)
76 | $(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
77 |
78 | %.o: %.mm
79 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
80 |
81 | %.o: %.cpp
82 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
83 |
84 | %.o: %.c
85 | $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
86 |
87 | clean:
88 | rm -f $(OBJECTS) $(TARGET)
89 |
90 | header:
91 | @echo "$$HEADER"
--------------------------------------------------------------------------------
/platforms/desktop-shared/Makefile.sources:
--------------------------------------------------------------------------------
1 | SRC_DIR = ../../src
2 | DESKTOP_SRC_DIR=../desktop-shared
3 | AUDIO_SRC_DIR=../audio-shared
4 |
5 | SOURCES_C := \
6 | $(SRC_DIR)/audio/emu2413/emu2413.c \
7 | $(SRC_DIR)/miniz/miniz.c \
8 |
9 | SOURCES_CXX := \
10 | $(DESKTOP_SRC_DIR)/main.cpp \
11 | $(DESKTOP_SRC_DIR)/emu.cpp \
12 | $(DESKTOP_SRC_DIR)/gui.cpp \
13 | $(DESKTOP_SRC_DIR)/gui_debug.cpp \
14 | $(DESKTOP_SRC_DIR)/gui_debug_memory.cpp \
15 | $(DESKTOP_SRC_DIR)/gui_debug_memeditor.cpp \
16 | $(DESKTOP_SRC_DIR)/application.cpp \
17 | $(DESKTOP_SRC_DIR)/config.cpp \
18 | $(DESKTOP_SRC_DIR)/renderer.cpp \
19 | $(DESKTOP_SRC_DIR)/imgui/imgui_impl_sdl2.cpp \
20 | $(DESKTOP_SRC_DIR)/imgui/imgui_impl_opengl2.cpp \
21 | $(DESKTOP_SRC_DIR)/imgui/imgui.cpp \
22 | $(DESKTOP_SRC_DIR)/imgui/imgui_draw.cpp \
23 | $(DESKTOP_SRC_DIR)/imgui/imgui_tables.cpp \
24 | $(DESKTOP_SRC_DIR)/imgui/imgui_widgets.cpp \
25 | $(AUDIO_SRC_DIR)/sound_queue.cpp \
26 | $(SRC_DIR)/Audio.cpp \
27 | $(SRC_DIR)/Cartridge.cpp \
28 | $(SRC_DIR)/CodemastersMemoryRule.cpp \
29 | $(SRC_DIR)/GameGearIOPorts.cpp \
30 | $(SRC_DIR)/GearsystemCore.cpp \
31 | $(SRC_DIR)/Input.cpp \
32 | $(SRC_DIR)/KoreanMemoryRule.cpp \
33 | $(SRC_DIR)/KoreanMSXSMS8000MemoryRule.cpp \
34 | $(SRC_DIR)/KoreanSMS32KB2000MemoryRule.cpp \
35 | $(SRC_DIR)/KoreanMSX32KB2000MemoryRule.cpp \
36 | $(SRC_DIR)/Korean2000XOR1FMemoryRule.cpp \
37 | $(SRC_DIR)/KoreanMSX8KB0300MemoryRule.cpp \
38 | $(SRC_DIR)/Korean0000XORFFMemoryRule.cpp \
39 | $(SRC_DIR)/KoreanFFFFHiComMemoryRule.cpp \
40 | $(SRC_DIR)/KoreanFFFEMemoryRule.cpp \
41 | $(SRC_DIR)/KoreanBFFCMemoryRule.cpp \
42 | $(SRC_DIR)/KoreanFFF3FFFCMemoryRule.cpp \
43 | $(SRC_DIR)/KoreanMDFFF5MemoryRule.cpp \
44 | $(SRC_DIR)/KoreanMDFFF0MemoryRule.cpp \
45 | $(SRC_DIR)/Multi4PAKAllActionMemoryRule.cpp \
46 | $(SRC_DIR)/JumboDahjeeMemoryRule.cpp \
47 | $(SRC_DIR)/Eeprom93C46MemoryRule.cpp \
48 | $(SRC_DIR)/Memory.cpp \
49 | $(SRC_DIR)/MemoryRule.cpp \
50 | $(SRC_DIR)/MSXMemoryRule.cpp \
51 | $(SRC_DIR)/opcodes.cpp \
52 | $(SRC_DIR)/opcodes_cb.cpp \
53 | $(SRC_DIR)/opcodes_ed.cpp \
54 | $(SRC_DIR)/Processor.cpp \
55 | $(SRC_DIR)/RomOnlyMemoryRule.cpp \
56 | $(SRC_DIR)/SegaMemoryRule.cpp \
57 | $(SRC_DIR)/SG1000MemoryRule.cpp \
58 | $(SRC_DIR)/SmsIOPorts.cpp \
59 | $(SRC_DIR)/Video.cpp \
60 | $(SRC_DIR)/BootromMemoryRule.cpp \
61 | $(SRC_DIR)/JanggunMemoryRule.cpp \
62 | $(SRC_DIR)/YM2413.cpp \
63 | $(SRC_DIR)/VgmRecorder.cpp \
64 | $(SRC_DIR)/audio/Blip_Buffer.cpp \
65 | $(SRC_DIR)/audio/Sms_Apu.cpp \
66 | $(SRC_DIR)/audio/Stereo_Buffer.cpp \
67 |
--------------------------------------------------------------------------------
/src/SixteenBitRegister.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef SIXTEENBITREGISTER_H
21 | #define SIXTEENBITREGISTER_H
22 |
23 | #include "definitions.h"
24 |
25 | class SixteenBitRegister
26 | {
27 | public:
28 | SixteenBitRegister() { }
29 | void SetLow(u8 low);
30 | u8 GetLow() const;
31 | void SetHigh(u8 high);
32 | u8 GetHigh() const;
33 | u8* GetHighRegister();
34 | u8* GetLowRegister();
35 | void SetValue(u16 value);
36 | u16 GetValue() const;
37 | void Increment();
38 | void Decrement();
39 |
40 | private:
41 | union sixteenBit
42 | {
43 | u16 v;
44 | struct
45 | {
46 | #ifdef IS_LITTLE_ENDIAN
47 | uint8_t low;
48 | uint8_t high;
49 | #else
50 | uint8_t high;
51 | uint8_t low;
52 | #endif
53 | };
54 | } m_Value;
55 | };
56 |
57 |
58 | inline void SixteenBitRegister::SetLow(u8 low)
59 | {
60 | m_Value.low = low;
61 | }
62 |
63 | inline u8 SixteenBitRegister::GetLow() const
64 | {
65 | return m_Value.low;
66 | }
67 |
68 | inline void SixteenBitRegister::SetHigh(u8 high)
69 | {
70 | m_Value.high = high;
71 | }
72 |
73 | inline u8 SixteenBitRegister::GetHigh() const
74 | {
75 | return m_Value.high;
76 | }
77 |
78 | inline u8* SixteenBitRegister::GetHighRegister()
79 | {
80 | return &m_Value.high;
81 | }
82 |
83 | inline u8* SixteenBitRegister::GetLowRegister()
84 | {
85 | return &m_Value.low;
86 | }
87 |
88 | inline void SixteenBitRegister::SetValue(u16 value)
89 | {
90 | m_Value.v = value;
91 | }
92 |
93 | inline u16 SixteenBitRegister::GetValue() const
94 | {
95 | return m_Value.v;
96 | }
97 |
98 | inline void SixteenBitRegister::Increment()
99 | {
100 | m_Value.v++;
101 | }
102 |
103 | inline void SixteenBitRegister::Decrement()
104 | {
105 | m_Value.v--;
106 | }
107 |
108 | #endif /* SIXTEENBITREGISTER_H */
109 |
110 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-windows.md:
--------------------------------------------------------------------------------
1 | # Windows
2 |
3 | ## LLVM and Intel C++ compiler support
4 |
5 | SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
6 | compiler, but you'll have to manually add the "-msse3" command line option
7 | to at least the SDL_audiocvt.c source file, and possibly others. This may
8 | not be necessary if you build SDL with CMake instead of the included Visual
9 | Studio solution.
10 |
11 | Details are here: https://github.com/libsdl-org/SDL/issues/5186
12 |
13 |
14 | ## OpenGL ES 2.x support
15 |
16 | SDL has support for OpenGL ES 2.x under Windows via two alternative
17 | implementations.
18 |
19 | The most straightforward method consists in running your app in a system with
20 | a graphic card paired with a relatively recent (as of November of 2013) driver
21 | which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
22 | to ship said extension on Windows currently include nVidia and Intel.
23 |
24 | The other method involves using the
25 | [ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
26 | context is requested and no WGL_EXT_create_context_es2_profile extension is
27 | found, SDL will try to load the libEGL.dll library provided by ANGLE.
28 |
29 | To obtain the ANGLE binaries, you can either compile from source from
30 | https://chromium.googlesource.com/angle/angle or copy the relevant binaries
31 | from a recent Chrome/Chromium install for Windows. The files you need are:
32 |
33 | - libEGL.dll
34 | - libGLESv2.dll
35 | - d3dcompiler_46.dll (supports Windows Vista or later, better shader
36 | compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
37 |
38 | If you compile ANGLE from source, you can configure it so it does not need the
39 | d3dcompiler_* DLL at all (for details on this, see their documentation).
40 | However, by default SDL will try to preload the d3dcompiler_46.dll to
41 | comply with ANGLE's requirements. If you wish SDL to preload
42 | d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
43 | can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
44 | details).
45 |
46 | Known Bugs:
47 |
48 | - SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
49 | that there's a bug in the library which prevents the window contents from
50 | refreshing if this is set to anything other than the default value.
51 |
52 | ## Vulkan Surface Support
53 |
54 | Support for creating Vulkan surfaces is configured on by default. To disable
55 | it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
56 | must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
57 | use Vulkan graphics in your application.
58 |
59 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/nfd/nfd_sdl2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Native File Dialog Extended
3 | Repository: https://github.com/btzy/nativefiledialog-extended
4 | License: Zlib
5 | Authors: Bernard Teo
6 |
7 | This header contains a function to convert an SDL window handle to a native window handle for
8 | passing to NFDe.
9 |
10 | This is meant to be used with SDL2, but if there are incompatibilities with future SDL versions,
11 | we can conditionally compile based on SDL_MAJOR_VERSION.
12 | */
13 |
14 | #ifndef _NFD_SDL2_H
15 | #define _NFD_SDL2_H
16 |
17 | #include
18 | #include
19 | #include
20 | #include "nfd.h"
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #define NFD_INLINE inline
25 | #else
26 | #define NFD_INLINE static inline
27 | #endif // __cplusplus
28 |
29 | /**
30 | * Converts an SDL window handle to a native window handle that can be passed to NFDe.
31 | * @param sdlWindow The SDL window handle.
32 | * @param[out] nativeWindow The output native window handle, populated if and only if this function
33 | * returns true.
34 | * @return Either true to indicate success, or false to indicate failure. If false is returned,
35 | * you can call SDL_GetError() for more information. However, it is intended that users ignore the
36 | * error and simply pass a value-initialized nfdwindowhandle_t to NFDe if this function fails. */
37 | NFD_INLINE bool NFD_GetNativeWindowFromSDLWindow(SDL_Window* sdlWindow,
38 | nfdwindowhandle_t* nativeWindow) {
39 | SDL_SysWMinfo info;
40 | SDL_VERSION(&info.version);
41 | if (!SDL_GetWindowWMInfo(sdlWindow, &info)) {
42 | return false;
43 | }
44 | switch (info.subsystem) {
45 | #if defined(SDL_VIDEO_DRIVER_WINDOWS)
46 | case SDL_SYSWM_WINDOWS:
47 | nativeWindow->type = NFD_WINDOW_HANDLE_TYPE_WINDOWS;
48 | nativeWindow->handle = (void*)info.info.win.window;
49 | return true;
50 | #endif
51 | #if defined(SDL_VIDEO_DRIVER_COCOA)
52 | case SDL_SYSWM_COCOA:
53 | nativeWindow->type = NFD_WINDOW_HANDLE_TYPE_COCOA;
54 | nativeWindow->handle = (void*)info.info.cocoa.window;
55 | return true;
56 | #endif
57 | #if defined(SDL_VIDEO_DRIVER_X11)
58 | case SDL_SYSWM_X11:
59 | nativeWindow->type = NFD_WINDOW_HANDLE_TYPE_X11;
60 | nativeWindow->handle = (void*)info.info.x11.window;
61 | return true;
62 | #endif
63 | default:
64 | // Silence the warning in case we are not using a supported backend.
65 | (void)nativeWindow;
66 | SDL_SetError("Unsupported native window type.");
67 | return false;
68 | }
69 | }
70 |
71 | #undef NFD_INLINE
72 | #ifdef __cplusplus
73 | }
74 | #endif // __cplusplus
75 |
76 | #endif // _NFD_SDL2_H
--------------------------------------------------------------------------------
/platforms/desktop-shared/gui_debug_constants.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef GUI_DEBUG_CONSTANTS_H
21 | #define GUI_DEBUG_CONSTANTS_H
22 |
23 | #include "imgui/imgui.h"
24 |
25 | static const ImVec4 cyan = ImVec4(0.10f, 0.90f, 0.90f, 1.0f);
26 | static const ImVec4 dark_cyan = ImVec4(0.00f, 0.30f, 0.30f, 1.0f);
27 | static const ImVec4 magenta = ImVec4(1.00f, 0.50f, 0.96f, 1.0f);
28 | static const ImVec4 dark_magenta = ImVec4(0.30f, 0.18f, 0.27f, 1.0f);
29 | static const ImVec4 yellow = ImVec4(1.00f, 0.90f, 0.05f, 1.0f);
30 | static const ImVec4 dark_yellow = ImVec4(0.30f, 0.25f, 0.00f, 1.0f);
31 | static const ImVec4 orange = ImVec4(0.99f, 0.59f, 0.12f, 1.0f);
32 | static const ImVec4 dark_orange = ImVec4(0.30f, 0.20f, 0.03f, 1.0f);
33 | static const ImVec4 red = ImVec4(0.98f, 0.15f, 0.45f, 1.0f);
34 | static const ImVec4 dark_red = ImVec4(0.30f, 0.04f, 0.16f, 1.0f);
35 | static const ImVec4 green = ImVec4(0.10f, 0.90f, 0.10f, 1.0f);
36 | static const ImVec4 dark_green = ImVec4(0.03f, 0.20f, 0.02f, 1.0f);
37 | static const ImVec4 violet = ImVec4(0.68f, 0.51f, 1.00f, 1.0f);
38 | static const ImVec4 dark_violet = ImVec4(0.24f, 0.15f, 0.30f, 1.0f);
39 | static const ImVec4 blue = ImVec4(0.20f, 0.40f, 1.00f, 1.0f);
40 | static const ImVec4 dark_blue = ImVec4(0.07f, 0.10f, 0.30f, 1.0f);
41 | static const ImVec4 white = ImVec4(1.00f, 1.00f, 1.00f, 1.0f);
42 | static const ImVec4 gray = ImVec4(0.50f, 0.50f, 0.50f, 1.0f);
43 | static const ImVec4 mid_gray = ImVec4(0.40f, 0.40f, 0.40f, 1.0f);
44 | static const ImVec4 dark_gray = ImVec4(0.10f, 0.10f, 0.10f, 1.0f);
45 | static const ImVec4 black = ImVec4(0.00f, 0.00f, 0.00f, 1.0f);
46 |
47 | static const int gui_debug_symbols_count = 9;
48 |
49 | static const char* const gui_debug_symbols[gui_debug_symbols_count] = {
50 | "00:0000 RST_00",
51 | "00:0008 RST_08",
52 | "00:0010 RST_10",
53 | "00:0018 RST_18",
54 | "00:0020 RST_20",
55 | "00:0028 RST_28",
56 | "00:0030 RST_30",
57 | "00:0038 RST_38",
58 | "00:0066 NMI_Interrupt"
59 | };
60 |
61 | #endif /* GUI_DEBUG_CONSTANTS_H */
--------------------------------------------------------------------------------
/platforms/desktop-shared/imgui/imgui_impl_opengl2.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Renderer Backend for OpenGL2 (legacy OpenGL, fixed pipeline)
2 | // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
3 |
4 | // Implemented features:
5 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!
6 | // [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).
7 | // [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
8 | // Missing features or Issues:
9 | // [ ] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
10 |
11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
13 | // Learn about Dear ImGui:
14 | // - FAQ https://dearimgui.com/faq
15 | // - Getting Started https://dearimgui.com/getting-started
16 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
17 | // - Introduction, links and more at the top of imgui.cpp
18 |
19 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
20 | // **Prefer using the code in imgui_impl_opengl3.cpp**
21 | // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
22 | // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
23 | // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
24 | // confuse your GPU driver.
25 | // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
26 |
27 | #pragma once
28 | #include "imgui.h" // IMGUI_IMPL_API
29 | #ifndef IMGUI_DISABLE
30 |
31 | // Follow "Getting Started" link and check examples/ folder to learn about using backends!
32 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
33 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
34 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
35 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);
36 |
37 | // Called by Init/NewFrame/Shutdown
38 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects();
39 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects();
40 |
41 | // (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = NULL to handle this manually.
42 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex);
43 |
44 | #endif // #ifndef IMGUI_DISABLE
45 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-versions.md:
--------------------------------------------------------------------------------
1 | # Versioning
2 |
3 | ## Since 2.23.0
4 |
5 | SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
6 | and older versions of the Linux kernel:
7 |
8 | * The major version (first part) increases when backwards compatibility
9 | is broken, which will happen infrequently.
10 |
11 | * If the minor version (second part) is divisible by 2
12 | (for example 2.24.x, 2.26.x), this indicates a version of SDL that
13 | is believed to be stable and suitable for production use.
14 |
15 | * In stable releases, the patchlevel or micro version (third part)
16 | indicates bugfix releases. Bugfix releases should not add or
17 | remove ABI, so the ".0" release (for example 2.24.0) should be
18 | forwards-compatible with all the bugfix releases from the
19 | same cycle (for example 2.24.1).
20 |
21 | * The minor version increases when new API or ABI is added, or when
22 | other significant changes are made. Newer minor versions are
23 | backwards-compatible, but not fully forwards-compatible.
24 | For example, programs built against SDL 2.24.x should work fine
25 | with SDL 2.26.x, but programs built against SDL 2.26.x will not
26 | necessarily work with 2.24.x.
27 |
28 | * If the minor version (second part) is not divisible by 2
29 | (for example 2.23.x, 2.25.x), this indicates a development prerelease
30 | of SDL that is not suitable for stable software distributions.
31 | Use with caution.
32 |
33 | * The patchlevel or micro version (third part) increases with
34 | each prerelease.
35 |
36 | * Each prerelease might add new API and/or ABI.
37 |
38 | * Prereleases are backwards-compatible with older stable branches.
39 | For example, 2.25.x will be backwards-compatible with 2.24.x.
40 |
41 | * Prereleases are not guaranteed to be backwards-compatible with
42 | each other. For example, new API or ABI added in 2.25.1
43 | might be removed or changed in 2.25.2.
44 | If this would be a problem for you, please do not use prereleases.
45 |
46 | * Only upgrade to a prerelease if you can guarantee that you will
47 | promptly upgrade to the stable release that follows it.
48 | For example, do not upgrade to 2.23.x unless you will be able to
49 | upgrade to 2.24.0 when it becomes available.
50 |
51 | * Software distributions that have a freeze policy (in particular Linux
52 | distributions with a release cycle, such as Debian and Fedora)
53 | should usually only package stable releases, and not prereleases.
54 |
55 | ## Before 2.23.0
56 |
57 | Older versions of SDL followed a similar policy, but instead of the
58 | odd/even rule applying to the minor version, it applied to the patchlevel
59 | (micro version, third part). For example, 2.0.22 was a stable release
60 | and 2.0.21 was a prerelease.
61 |
--------------------------------------------------------------------------------
/platforms/flatpak/io.github.drhelius.Gearsystem.yml:
--------------------------------------------------------------------------------
1 | id: io.github.drhelius.Gearsystem
2 | runtime: org.freedesktop.Platform
3 | runtime-version: '23.08'
4 | sdk: org.freedesktop.Sdk
5 | command: gearsystem
6 | finish-args:
7 | - --share=ipc
8 | - --socket=x11
9 | - --device=dri
10 | - --socket=pulseaudio
11 | - --device=all # Allows for controller input
12 | modules:
13 | - name: glu
14 | buildsystem: meson
15 | sources:
16 | - type: archive
17 | url: https://archive.mesa3d.org/glu/glu-9.0.3.tar.xz
18 | sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f
19 | - name: SDL2
20 | buildsystem: autotools
21 | config-opts:
22 | - --disable-static
23 | sources:
24 | - type: archive
25 | url: https://github.com/libsdl-org/SDL/releases/download/release-2.30.0/SDL2-2.30.0.tar.gz
26 | sha256: 36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0
27 | cleanup:
28 | - /bin/sdl2-config
29 | - /include
30 | - /lib/libSDL2.la
31 | - /lib/libSDL2main.a
32 | - /lib/libSDL2main.la
33 | - /lib/libSDL2_test.a
34 | - /lib/libSDL2_test.la
35 | - /lib/cmake
36 | - /share/aclocal
37 | - /lib/pkgconfig
38 | - name: gearsystem
39 | buildsystem: simple
40 | build-commands:
41 | - make
42 | - make install prefix="$FLATPAK_DEST"
43 | - install -Dm644 io.github.drhelius.Gearsystem.desktop -t /app/share/applications
44 | - install -Dm644 icons/32x32.png /app/share/icons/hicolor/32x32/apps/io.github.drhelius.Gearsystem.png
45 | - install -Dm644 icons/128x128.png /app/share/icons/hicolor/128x128/apps/io.github.drhelius.Gearsystem.png
46 | - install -Dm644 icons/256x256.png /app/share/icons/hicolor/256x256/apps/io.github.drhelius.Gearsystem.png
47 | - install -Dm644 icons/512x512.png /app/share/icons/hicolor/512x512/apps/io.github.drhelius.Gearsystem.png
48 | - install -Dm644 io.github.drhelius.Gearsystem.metainfo.xml -t /app/share/metainfo
49 | subdir: platforms/flatpak
50 | sources:
51 | # This source allows for that Flatpak to be built from the current commit.
52 | # This is not suitable for releases, but is useful for development builds.
53 | # Ideally a tag/commit or archive would be preferred, but a stable
54 | # instance does not exist until this is merged into a main branch and
55 | # released. An example of what this would look like is shown below and is
56 | # expected to be altered after a release of Gearsystem.
57 | - type: dir
58 | path: ../..
59 | # - type: git
60 | # url: https://github.com/drhelius/Gearsystem
61 | # tag: 3.5.0 # WARNING: Does not not contain `platforms/flatpak`!
62 | # commit: 8f817df87a46938c9da9aa9a15441b897a9d5726
63 | - type: file
64 | path: io.github.drhelius.Gearsystem.desktop
65 | - type: file
66 | path: io.github.drhelius.Gearsystem.metainfo.xml
67 | - type: dir
68 | path: icons
69 | dest: icons
70 |
--------------------------------------------------------------------------------
/src/Eeprom93C46MemoryRule.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef EEPROM93C46MEMORYRULE_H
21 | #define EEPROM93C46MEMORYRULE_H
22 |
23 | #include "MemoryRule.h"
24 |
25 | class Eeprom93C46MemoryRule : public MemoryRule
26 | {
27 | public:
28 | Eeprom93C46MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput);
29 | virtual ~Eeprom93C46MemoryRule();
30 | virtual u8 PerformRead(u16 address);
31 | virtual void PerformWrite(u16 address, u8 value);
32 | virtual void Reset();
33 | virtual void SaveRam(std::ostream &file);
34 | virtual bool LoadRam(std::istream &file, s32 fileSize);
35 | virtual bool PersistedRAM();
36 | virtual size_t GetRamSize();
37 | virtual u8* GetRamBanks();
38 | virtual u8* GetPage(int index);
39 | virtual int GetBank(int index);
40 | virtual void SaveState(std::ostream& stream);
41 | virtual void LoadState(std::istream& stream);
42 |
43 | private:
44 | // EEPROM 93C46 definitions
45 | static const int EEPROM_93C46_LINE_DATA_IN = 0x01;
46 | static const int EEPROM_93C46_LINE_CLOCK = 0x02;
47 | static const int EEPROM_93C46_LINE_CS = 0x04;
48 | static const int EEPROM_93C46_LINE_DATA_OUT = 0x08;
49 | static const int EEPROM_93C46_LINE_DATA_OUT_POS = 3;
50 |
51 | static const int EEPROM_93C46_INIT_NORMAL = 0;
52 | static const int EEPROM_93C46_INIT_ALL = 1;
53 |
54 | static const int EEPROM_93C46_DATA_SIZE = 128;
55 |
56 | static const int EEPROM_93C46_STATUS_START = 0;
57 | static const int EEPROM_93C46_STATUS_OPCODE = 1;
58 | static const int EEPROM_93C46_STATUS_READING = 2;
59 | static const int EEPROM_93C46_STATUS_WRITING = 3;
60 |
61 | struct EEPROM93C46
62 | {
63 | u8 Enabled;
64 | u8 Lines;
65 | u8 Status;
66 | u8 ReadOnly;
67 | u8 Position;
68 | u16 Opcode;
69 | u16 Latch;
70 | u16 Data[EEPROM_93C46_DATA_SIZE / 2];
71 | };
72 |
73 | void EEPROM_93c46_Init(int init);
74 | void EEPROM_93c46_Clear();
75 | void EEPROM_93c46_Control(u8 value);
76 | void EEPROM_93c46_SetLines(u8 lines);
77 | u8 EEPROM_93c46_Read();
78 | void EEPROM_93c46_DirectWrite(int addr, u8 data);
79 | u8 EEPROM_93c46_DirectRead(int addr);
80 |
81 | private:
82 | int m_iMapperSlot[3];
83 | int m_iMapperSlotAddress[3];
84 | EEPROM93C46 m_EEPROM;
85 | };
86 |
87 | #endif /* EEPROM93C46MEMORYRULE_H */
88 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_misc.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_misc.h
24 | *
25 | * \brief Include file for SDL API functions that don't fit elsewhere.
26 | */
27 |
28 | #ifndef SDL_misc_h_
29 | #define SDL_misc_h_
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 |
35 | /* Set up for C function definitions, even when using C++ */
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | /**
41 | * Open a URL/URI in the browser or other appropriate external application.
42 | *
43 | * Open a URL in a separate, system-provided application. How this works will
44 | * vary wildly depending on the platform. This will likely launch what makes
45 | * sense to handle a specific URL's protocol (a web browser for `http://`,
46 | * etc), but it might also be able to launch file managers for directories and
47 | * other things.
48 | *
49 | * What happens when you open a URL varies wildly as well: your game window
50 | * may lose focus (and may or may not lose focus if your game was fullscreen
51 | * or grabbing input at the time). On mobile devices, your app will likely
52 | * move to the background or your process might be paused. Any given platform
53 | * may or may not handle a given URL.
54 | *
55 | * If this is unimplemented (or simply unavailable) for a platform, this will
56 | * fail with an error. A successful result does not mean the URL loaded, just
57 | * that we launched _something_ to handle it (or at least believe we did).
58 | *
59 | * All this to say: this function can be useful, but you should definitely
60 | * test it on every platform you target.
61 | *
62 | * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for
63 | * local files, if supported.
64 | * \returns 0 on success, or -1 on error; call SDL_GetError() for more
65 | * information.
66 | *
67 | * \since This function is available since SDL 2.0.14.
68 | */
69 | extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
70 |
71 | /* Ends C function definitions when using C++ */
72 | #ifdef __cplusplus
73 | }
74 | #endif
75 | #include "close_code.h"
76 |
77 | #endif /* SDL_misc_h_ */
78 |
79 | /* vi: set ts=4 sw=4 expandtab: */
80 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-directfb.md:
--------------------------------------------------------------------------------
1 | DirectFB
2 | ========
3 |
4 | Supports:
5 |
6 | - Hardware YUV overlays
7 | - OpenGL - software only
8 | - 2D/3D accelerations (depends on directfb driver)
9 | - multiple displays
10 | - windows
11 |
12 | What you need:
13 |
14 | * DirectFB 1.0.1, 1.2.x, 1.3.0
15 | * Kernel-Framebuffer support: required: vesafb, radeonfb ....
16 | * Mesa 7.0.x - optional for OpenGL
17 |
18 | The `/etc/directfbrc` file should contain the following lines to make
19 | your joystick work and avoid crashes:
20 |
21 | ```
22 | disable-module=joystick
23 | disable-module=cle266
24 | disable-module=cyber5k
25 | no-linux-input-grab
26 | ```
27 |
28 | To disable to use x11 backend when DISPLAY variable is found use
29 |
30 | ```
31 | export SDL_DIRECTFB_X11_CHECK=0
32 | ```
33 |
34 | To disable the use of linux input devices, i.e. multimice/multikeyboard support,
35 | use
36 |
37 | ```
38 | export SDL_DIRECTFB_LINUX_INPUT=0
39 | ```
40 |
41 | To use hardware accelerated YUV-overlays for YUV-textures, use:
42 |
43 | ```
44 | export SDL_DIRECTFB_YUV_DIRECT=1
45 | ```
46 |
47 | This is disabled by default. It will only support one
48 | YUV texture, namely the first. Every other YUV texture will be
49 | rendered in software.
50 |
51 | In addition, you may use (directfb-1.2.x)
52 |
53 | ```
54 | export SDL_DIRECTFB_YUV_UNDERLAY=1
55 | ```
56 |
57 | to make the YUV texture an underlay. This will make the cursor to
58 | be shown.
59 |
60 | Simple Window Manager
61 | =====================
62 |
63 | The driver has support for a very, very basic window manager you may
64 | want to use when running with `wm=default`. Use
65 |
66 | ```
67 | export SDL_DIRECTFB_WM=1
68 | ```
69 |
70 | to enable basic window borders. In order to have the window title rendered,
71 | you need to have the following font installed:
72 |
73 | ```
74 | /usr/share/fonts/truetype/freefont/FreeSans.ttf
75 | ```
76 |
77 | OpenGL Support
78 | ==============
79 |
80 | The following instructions will give you *software* OpenGL. However this
81 | works at least on all directfb supported platforms.
82 |
83 | As of this writing 20100802 you need to pull Mesa from git and do the following:
84 |
85 | ```
86 | git clone git://anongit.freedesktop.org/git/mesa/mesa
87 | cd mesa
88 | git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
89 | ```
90 |
91 | Edit `configs/linux-directfb` so that the Directories-section looks like this:
92 |
93 | ```
94 | # Directories
95 | SRC_DIRS = mesa glu
96 | GLU_DIRS = sgi
97 | DRIVER_DIRS = directfb
98 | PROGRAM_DIRS =
99 | ```
100 |
101 | Then do the following:
102 |
103 | ```
104 | make linux-directfb
105 | make
106 |
107 | echo Installing - please enter sudo pw.
108 |
109 | sudo make install INSTALL_DIR=/usr/local/dfb_GL
110 | cd src/mesa/drivers/directfb
111 | make
112 | sudo make install INSTALL_DIR=/usr/local/dfb_GL
113 | ```
114 |
115 | To run the SDL - testprograms:
116 |
117 | ```
118 | export SDL_VIDEODRIVER=directfb
119 | export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
120 | export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
121 |
122 | ./testgl
123 | ```
124 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/macos/fullscreen.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #import
21 | #include
22 |
23 | // Simple bridge for C++ callback
24 | @interface FullscreenObserver : NSObject
25 | @property (nonatomic, copy) void (^onEnterFullscreen)(void);
26 | @property (nonatomic, copy) void (^onExitFullscreen)(void);
27 | @end
28 |
29 | @implementation FullscreenObserver
30 |
31 | - (instancetype)initWithWindow:(NSWindow *)window
32 | {
33 | self = [super init];
34 | if (self)
35 | {
36 | [[NSNotificationCenter defaultCenter] addObserver:self
37 | selector:@selector(windowWillEnterFullScreen:)
38 | name:NSWindowWillEnterFullScreenNotification
39 | object:window];
40 |
41 | [[NSNotificationCenter defaultCenter] addObserver:self
42 | selector:@selector(windowWillExitFullScreen:)
43 | name:NSWindowWillExitFullScreenNotification
44 | object:window];
45 | }
46 | return self;
47 | }
48 |
49 | - (void)windowWillEnterFullScreen:(NSNotification *)notification
50 | {
51 | if (self.onEnterFullscreen) self.onEnterFullscreen();
52 | }
53 |
54 | - (void)windowWillExitFullScreen:(NSNotification *)notification
55 | {
56 | if (self.onExitFullscreen) self.onExitFullscreen();
57 | }
58 |
59 | - (void)dealloc
60 | {
61 | [[NSNotificationCenter defaultCenter] removeObserver:self];
62 | [super dealloc];
63 | }
64 |
65 | @end
66 |
67 | // C bridge
68 | extern "C" void* macos_install_fullscreen_observer(void* nswindow,
69 | void(*enter_cb)(),
70 | void(*exit_cb)())
71 | {
72 | FullscreenObserver* obs = [[FullscreenObserver alloc] initWithWindow:(__bridge NSWindow*)nswindow];
73 | if (enter_cb) obs.onEnterFullscreen = ^{ enter_cb(); };
74 | if (exit_cb) obs.onExitFullscreen = ^{ exit_cb(); };
75 | return (void*)obs;
76 | }
77 |
78 | extern "C" void macos_set_native_fullscreen(void* nswindow, bool enter)
79 | {
80 | NSWindow* win = (__bridge NSWindow*)nswindow;
81 | BOOL isFullScreen = ([win styleMask] & NSWindowStyleMaskFullScreen) != 0;
82 | if (enter && !isFullScreen)
83 | {
84 | [win toggleFullScreen:nil];
85 | }
86 | else if (!enter && isFullScreen)
87 | {
88 | [win toggleFullScreen:nil];
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/KoreanMSX8KB0300MemoryRule.cpp:
--------------------------------------------------------------------------------
1 | #include "KoreanMSX8KB0300MemoryRule.h"
2 | #include "Memory.h"
3 | #include "Cartridge.h"
4 |
5 | KoreanMSX8KB0300MemoryRule::KoreanMSX8KB0300MemoryRule(Memory* pMemory, Cartridge* pCartridge, Input* pInput)
6 | : MemoryRule(pMemory, pCartridge, pInput)
7 | {
8 | Reset();
9 | }
10 |
11 | KoreanMSX8KB0300MemoryRule::~KoreanMSX8KB0300MemoryRule()
12 | {
13 | }
14 |
15 | u8 KoreanMSX8KB0300MemoryRule::PerformRead(u16 address)
16 | {
17 | if (address < 0xC000)
18 | {
19 | int slot = (address >> 13) & 0x07;
20 | if (slot > 5)
21 | {
22 | Debug("--> ** Invalid slot %d", slot);
23 | return 0xFF;
24 | }
25 | return m_pCartridge->GetROM()[m_iPageAddress[slot] + (address & 0x1FFF)];
26 | }
27 | else
28 | {
29 | // RAM + RAM mirror
30 | return m_pMemory->Retrieve(address);
31 | }
32 | }
33 |
34 | void KoreanMSX8KB0300MemoryRule::PerformWrite(u16 address, u8 value)
35 | {
36 | u16 address_assumed = address & 0xFF00;
37 | int bank = value & (m_pCartridge->GetROMBankCount8k() - 1);
38 |
39 | switch (address_assumed)
40 | {
41 | case 0x0000:
42 | m_iPage[4] = bank;
43 | m_iPageAddress[4] = 0x2000 * bank;
44 | return;
45 | case 0x0100:
46 | m_iPage[2] = bank;
47 | m_iPageAddress[2] = 0x2000 * (value & (m_pCartridge->GetROMBankCount8k() - 1));
48 | return;
49 | case 0x0200:
50 | m_iPage[1] = bank;
51 | m_iPage[5] = m_iPage[1];
52 | m_iPageAddress[1] = 0x2000 * bank;
53 | m_iPageAddress[5] = m_iPageAddress[1];
54 | return;
55 | case 0x0300:
56 | m_iPage[3] = bank;
57 | m_iPageAddress[3] = 0x2000 * bank;;
58 | return;
59 | default:
60 | break;
61 | }
62 |
63 | if (address >= 0xC000)
64 | {
65 | if (address < 0xE000)
66 | {
67 | // RAM
68 | m_pMemory->Load(address, value);
69 | m_pMemory->Load(address + 0x2000, value);
70 | }
71 | else
72 | {
73 | // RAM (mirror)
74 | m_pMemory->Load(address, value);
75 | m_pMemory->Load(address - 0x2000, value);
76 | }
77 | }
78 | }
79 |
80 | void KoreanMSX8KB0300MemoryRule::Reset()
81 | {
82 | for (int i = 0; i < 6; i++)
83 | {
84 | m_iPage[i] = i;
85 | m_iPageAddress[i] = 0x2000 * m_iPage[i];
86 | }
87 | }
88 |
89 | u8* KoreanMSX8KB0300MemoryRule::GetPage(int index)
90 | {
91 | return m_pCartridge->GetROM() + m_iPageAddress[index];
92 | }
93 |
94 | int KoreanMSX8KB0300MemoryRule::GetBank(int index)
95 | {
96 | return m_iPage[index];
97 | }
98 |
99 | bool KoreanMSX8KB0300MemoryRule::Has8kBanks()
100 | {
101 | return true;
102 | }
103 |
104 | void KoreanMSX8KB0300MemoryRule::SaveState(std::ostream& stream)
105 | {
106 | stream.write(reinterpret_cast (m_iPageAddress), sizeof(m_iPageAddress));
107 | stream.write(reinterpret_cast (m_iPage), sizeof(m_iPage));
108 | }
109 |
110 | void KoreanMSX8KB0300MemoryRule::LoadState(std::istream& stream)
111 | {
112 | using namespace std;
113 |
114 | stream.read(reinterpret_cast (m_iPageAddress), sizeof(m_iPageAddress));
115 | stream.read(reinterpret_cast (m_iPage), sizeof(m_iPage));
116 | }
117 |
--------------------------------------------------------------------------------
/platforms/desktop-shared/gui.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef GUI_H
21 | #define GUI_H
22 |
23 | #include "imgui/imgui.h"
24 | #include
25 | #include "config.h"
26 |
27 | enum gui_ShortCutEvent
28 | {
29 | gui_ShortCutEventFirst = -1,
30 | gui_ShortcutOpenROM,
31 | gui_ShortcutReset,
32 | gui_ShortcutPause,
33 | gui_ShortcutFFWD,
34 | gui_ShortcutSaveState,
35 | gui_ShortcutLoadState,
36 | gui_ShortcutScreenshot,
37 | gui_ShortcutDebugStep,
38 | gui_ShortcutDebugContinue,
39 | gui_ShortcutDebugNextFrame,
40 | gui_ShortcutDebugBreakpoint,
41 | gui_ShortcutDebugRuntocursor,
42 | gui_ShortcutDebugGoBack,
43 | gui_ShortcutDebugCopy,
44 | gui_ShortcutDebugPaste,
45 | gui_ShortcutShowMainMenu,
46 | gui_ShortcutQuit,
47 | gui_ShortCutEventMax
48 | };
49 |
50 | #ifdef GUI_IMPORT
51 | #define EXTERN
52 | #else
53 | #define EXTERN extern
54 | #endif
55 |
56 | struct gui_HotkeyMapping
57 | {
58 | int shortcut;
59 | int config_index;
60 | bool allow_repeat;
61 | };
62 |
63 | #define GUI_HOTKEY_MAP_COUNT 14
64 |
65 | const gui_HotkeyMapping gui_hotkey_map[GUI_HOTKEY_MAP_COUNT] = {
66 | {gui_ShortcutOpenROM, config_HotkeyIndex_OpenROM, false},
67 | {gui_ShortcutReset, config_HotkeyIndex_Reset, false},
68 | {gui_ShortcutPause, config_HotkeyIndex_Pause, false},
69 | {gui_ShortcutFFWD, config_HotkeyIndex_FFWD, false},
70 | {gui_ShortcutSaveState, config_HotkeyIndex_SaveState, false},
71 | {gui_ShortcutLoadState, config_HotkeyIndex_LoadState, false},
72 | {gui_ShortcutScreenshot, config_HotkeyIndex_Screenshot, false},
73 | {gui_ShortcutShowMainMenu, config_HotkeyIndex_ShowMainMenu, false},
74 | {gui_ShortcutDebugStep, config_HotkeyIndex_DebugStep, true},
75 | {gui_ShortcutDebugContinue, config_HotkeyIndex_DebugContinue, true},
76 | {gui_ShortcutDebugNextFrame, config_HotkeyIndex_DebugNextFrame, true},
77 | {gui_ShortcutDebugRuntocursor, config_HotkeyIndex_DebugRunToCursor, false},
78 | {gui_ShortcutDebugBreakpoint, config_HotkeyIndex_DebugBreakpoint, false},
79 | {gui_ShortcutDebugGoBack, config_HotkeyIndex_DebugGoBack, false},
80 | };
81 |
82 | EXTERN bool gui_in_use;
83 | EXTERN bool gui_main_window_hovered;
84 | EXTERN bool gui_main_menu_hovered;
85 | EXTERN ImFont* gui_default_font;
86 | EXTERN ImFont* gui_roboto_font;
87 | EXTERN config_Hotkey* gui_configured_hotkey;
88 |
89 | EXTERN bool gui_init(void);
90 | EXTERN void gui_destroy(void);
91 | EXTERN void gui_render(void);
92 | EXTERN void gui_shortcut(gui_ShortCutEvent event);
93 | EXTERN void gui_load_rom(const char* path);
94 | EXTERN void gui_set_status_message(const char* message, u32 milliseconds);
95 |
96 | #undef GUI_IMPORT
97 | #undef EXTERN
98 | #endif /* GUI_H */
99 |
--------------------------------------------------------------------------------
/src/Input.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Gearsystem - Sega Master System / Game Gear Emulator
3 | * Copyright (C) 2013 Ignacio Sanchez
4 |
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 |
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see http://www.gnu.org/licenses/
17 | *
18 | */
19 |
20 | #ifndef INPUT_H
21 | #define INPUT_H
22 |
23 | #include "definitions.h"
24 |
25 | class Memory;
26 | class Processor;
27 | class Video;
28 |
29 | class Input
30 | {
31 | public:
32 | struct stPhaser
33 | {
34 | int x;
35 | int y;
36 | };
37 |
38 | struct stPaddle
39 | {
40 | float x;
41 | u8 reg;
42 | bool flip;
43 | };
44 |
45 | public:
46 | Input(Processor* pProcessor, Video* pVideo);
47 | void Init();
48 | void Reset(bool bGameGear);
49 | void KeyPressed(GS_Joypads joypad, GS_Keys key);
50 | void KeyReleased(GS_Joypads joypad, GS_Keys key);
51 | void EnablePhaser(bool enable);
52 | void SetPhaser(int x, int y);
53 | void SetPhaserOffset(int x, int y);
54 | stPhaser* GetPhaser();
55 | bool IsPhaserEnabled();
56 | void EnablePaddle(bool enable);
57 | void SetPaddle(float x);
58 | bool IsPaddleEnabled();
59 | u8 GetPortDC();
60 | u8 GetPortDD();
61 | u8 GetPort00();
62 | u8 GetGlassesRegistry();
63 | void SetGlassesRegistry(u8 value);
64 | void SaveState(std::ostream& stream);
65 | void LoadState(std::istream& stream);
66 |
67 | private:
68 | Processor* m_pProccesor;
69 | Video* m_pVideo;
70 | u8 m_Joypad1;
71 | u8 m_Joypad2;
72 | u8 m_GlassesRegistry;
73 | bool m_bGameGear;
74 | bool m_bPhaser;
75 | stPhaser m_Phaser;
76 | stPhaser m_PhaserOffset;
77 | bool m_bPaddle;
78 | stPaddle m_Paddle;
79 | };
80 |
81 | #include "Video.h"
82 |
83 | inline u8 Input::GetPortDC()
84 | {
85 | if (m_bPhaser && !m_bGameGear)
86 | {
87 | return IsSetBit(m_Joypad1, Key_1) ? 0xFF : 0xEF;
88 | }
89 | else if (m_bPaddle && !m_bGameGear)
90 | {
91 | m_Paddle.flip ^= 0x01;
92 | u8 paddle_bits = (m_Paddle.flip == 0x00) ? m_Paddle.reg : (m_Paddle.reg >> 4);
93 | return (m_Joypad1 & 0x10) + (paddle_bits & 0x0F) + ((m_Joypad2 << 6) & 0xC0) + (m_Paddle.flip << 5);
94 | }
95 | else
96 | {
97 | return (m_Joypad1 & 0x3F) + ((m_Joypad2 << 6) & 0xC0);
98 | }
99 | }
100 |
101 | inline u8 Input::GetPortDD()
102 | {
103 | if (m_bPhaser && !m_bGameGear)
104 | {
105 | u8 dd = ((m_Joypad2 >> 2) & 0x0F) | 0xF0;
106 |
107 | if (m_pVideo->IsPhaserDetected())
108 | dd = UnsetBit(dd, 6);
109 |
110 | return dd;
111 | }
112 | else
113 | {
114 | return ((m_Joypad2 >> 2) & 0x0F) | 0xF0;
115 | }
116 | }
117 |
118 | inline u8 Input::GetPort00()
119 | {
120 | return (IsSetBit(m_Joypad1, Key_Start) ? 0x80 : 0) & 0x80;
121 | }
122 |
123 | #endif /* INPUT_H */
124 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/docs/README-os2.md:
--------------------------------------------------------------------------------
1 | Simple DirectMedia Layer 2 for OS/2 & eComStation
2 | ================================================================================
3 | SDL port for OS/2, authored by Andrey Vasilkin , 2016
4 |
5 |
6 | OpenGL not supported by this port.
7 |
8 | Additional optional environment variables:
9 |
10 | SDL_AUDIO_SHARE
11 | Values: 0 or 1, default is 0
12 | Initializes the device as shareable or exclusively acquired.
13 |
14 | SDL_VIDEODRIVER
15 | Values: DIVE or VMAN, default is DIVE
16 | Use video subsystem: Direct interface video extensions (DIVE) or
17 | Video Manager (VMAN).
18 |
19 | You may significantly increase video output speed with OS4 kernel and patched
20 | files vman.dll and dive.dll or with latest versions of ACPI support and video
21 | driver Panorama.
22 |
23 | Latest versions of OS/4 kernel:
24 | http://gus.biysk.ru/os4/
25 | (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
26 |
27 | Patched files vman.dll and dive.dll:
28 | http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
29 |
30 |
31 | Compiling:
32 | ----------
33 |
34 | Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
35 | https://github.com/open-watcom/ and https://open-watcom.github.io
36 | WATCOM environment variable must to be set to the Open Watcom install
37 | directory. To compile, run: wmake -f Makefile.os2
38 |
39 |
40 | Installing:
41 | -----------
42 |
43 | - eComStation:
44 |
45 | If you have previously installed SDL2, make a Backup copy of SDL2.dll
46 | located in D:\ecs\dll (where D: is disk on which installed eComStation).
47 | Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
48 |
49 | - OS/2:
50 |
51 | Copy SDL2.dll to any directory on your LIBPATH. If you have a previous
52 | version installed, close all SDL2 applications before replacing the old
53 | copy. Also make sure that any other older versions of DLLs are removed
54 | from your system.
55 |
56 |
57 | Joysticks in SDL2:
58 | ------------------
59 |
60 | The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
61 | Here is the original documentation from SDL-1.2:
62 |
63 | The Joystick detection only works for standard joysticks (2 buttons, 2 axes
64 | and the like). Therefore, if you use a non-standard joystick, you should
65 | specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
66 | file or CONFIG.SYS, so SDL applications can provide full capability to your
67 | device. The syntax is:
68 |
69 | SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
70 |
71 | So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
72 | the line should be:
73 |
74 | SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
75 |
76 | If you want to add spaces in your joystick name, just surround it with
77 | quotes or double-quotes:
78 |
79 | SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
80 |
81 | or
82 |
83 | SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
84 |
85 | Note however that Balls and Hats are not supported under OS/2, and the
86 | value will be ignored... but it is wise to define these correctly because
87 | in the future those can be supported.
88 |
89 | Also the number of buttons is limited to 2 when using two joysticks,
90 | 4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
91 | and 8 when using a joystick with 2 axes. Notice however these are limitations
92 | of the Joystick Port hardware, not OS/2.
93 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_power.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_power_h_
23 | #define SDL_power_h_
24 |
25 | /**
26 | * \file SDL_power.h
27 | *
28 | * Header for the SDL power management routines.
29 | */
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | /**
40 | * The basic state for the system's power supply.
41 | */
42 | typedef enum
43 | {
44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
49 | } SDL_PowerState;
50 |
51 | /**
52 | * Get the current power supply details.
53 | *
54 | * You should never take a battery status as absolute truth. Batteries
55 | * (especially failing batteries) are delicate hardware, and the values
56 | * reported here are best estimates based on what that hardware reports. It's
57 | * not uncommon for older batteries to lose stored power much faster than it
58 | * reports, or completely drain when reporting it has 20 percent left, etc.
59 | *
60 | * Battery status can change at any time; if you are concerned with power
61 | * state, you should call this function frequently, and perhaps ignore changes
62 | * until they seem to be stable for a few seconds.
63 | *
64 | * It's possible a platform can only report battery percentage or time left
65 | * but not both.
66 | *
67 | * \param seconds seconds of battery life left, you can pass a NULL here if
68 | * you don't care, will return -1 if we can't determine a
69 | * value, or we're not running on a battery
70 | * \param percent percentage of battery life left, between 0 and 100, you can
71 | * pass a NULL here if you don't care, will return -1 if we
72 | * can't determine a value, or we're not running on a battery
73 | * \returns an SDL_PowerState enum representing the current battery state.
74 | *
75 | * \since This function is available since SDL 2.0.0.
76 | */
77 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *seconds, int *percent);
78 |
79 | /* Ends C function definitions when using C++ */
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 | #include "close_code.h"
84 |
85 | #endif /* SDL_power_h_ */
86 |
87 | /* vi: set ts=4 sw=4 expandtab: */
88 |
--------------------------------------------------------------------------------
/platforms/README.txt:
--------------------------------------------------------------------------------
1 | .:: Gearsystem ::.
2 | -----------------------------------------------------
3 | Instructions and tips at:
4 | https://github.com/drhelius/Gearsystem
5 | -----------------------------------------------------
6 | Gearsystem is a very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator written in C++ that runs on Windows, macOS, Linux, BSD and RetroArch.
7 | Please, consider sponsoring (https://github.com/sponsors/drhelius) and following me on Twitter (http://twitter.com/drhelius) for updates.
8 | -----------------------------------------------------
9 | Supported Machines:
10 | - Sega Mark III
11 | - Sega Master System
12 | - Sega Game Gear
13 | - Sega Game 1000 (SG-1000)
14 | - Othello Multivision
15 | -----------------------------------------------------
16 | Features:
17 | - Accurate Z80 core, including undocumented opcodes and behavior like R and MEMPTR registers.
18 | - Supported cartridges: ROM, ROM + RAM, SEGA, Codemasters, Korean, MSX + Nemesis, Janggun, SG-1000.
19 | - Automatic region detection: NTSC-JAP, NTSC-USA, PAL-EUR.
20 | - Accurate VDP emulation including timing and Master System 2 only 224 video mode support.
21 | - Support for YM2413 (OPLL) FM sound chip.
22 | - Internal database for rom detection.
23 | - Battery powered RAM save support.
24 | - Save states.
25 | - Compressed rom support (ZIP).
26 | - Game Genie and Pro Action Replay cheat support.
27 | - Supported platforms (standalone): Windows, Linux, BSD and macOS.
28 | - Supported platforms (libretro): Windows, Linux, macOS, Raspberry Pi, Android, iOS, tvOS, PlayStation Vita, PlayStation 3, Nintendo 3DS, Nintendo GameCube, Nintendo Wii, Nintendo WiiU, Nintendo Switch, Emscripten, Classic Mini systems (NES, SNES, C64, ...), OpenDingux, RetroFW and QNX.
29 | - Full debugger with just-in-time disassembler, cpu breakpoints, memory access breakpoints, code navigation (goto address, JP JR and CALL double clicking), debug symbols, memory editor, IO inspector and VRAM viewer including tiles, sprites, backgrounds and palettes.
30 | - Windows and Linux Portable Mode.
31 | - Rom loading from the command line by adding the rom path as an argument.
32 | - Support for modern game controllers through gamecontrollerdb.txt file located in the same directory as the application binary.
33 | -----------------------------------------------------
34 | Gearsystem is licensed under the GNU General Public License v3.0 License:
35 |
36 | Copyright (C) 2013 Ignacio Sanchez
37 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
38 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
39 | You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
40 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
41 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
42 | You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
43 |
--------------------------------------------------------------------------------
/platforms/windows/dependencies/SDL2-2.30.6/include/SDL_guid.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2024 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_guid.h
24 | *
25 | * Include file for handling ::SDL_GUID values.
26 | */
27 |
28 | #ifndef SDL_guid_h_
29 | #define SDL_guid_h_
30 |
31 | #include "SDL_stdinc.h"
32 | #include "SDL_error.h"
33 |
34 | #include "begin_code.h"
35 | /* Set up for C function definitions, even when using C++ */
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | /**
41 | * An SDL_GUID is a 128-bit identifier for an input device that
42 | * identifies that device across runs of SDL programs on the same
43 | * platform. If the device is detached and then re-attached to a
44 | * different port, or if the base system is rebooted, the device
45 | * should still report the same GUID.
46 | *
47 | * GUIDs are as precise as possible but are not guaranteed to
48 | * distinguish physically distinct but equivalent devices. For
49 | * example, two game controllers from the same vendor with the same
50 | * product ID and revision may have the same GUID.
51 | *
52 | * GUIDs may be platform-dependent (i.e., the same device may report
53 | * different GUIDs on different operating systems).
54 | */
55 | typedef struct {
56 | Uint8 data[16];
57 | } SDL_GUID;
58 |
59 | /* Function prototypes */
60 |
61 | /**
62 | * Get an ASCII string representation for a given ::SDL_GUID.
63 | *
64 | * You should supply at least 33 bytes for pszGUID.
65 | *
66 | * \param guid the ::SDL_GUID you wish to convert to string
67 | * \param pszGUID buffer in which to write the ASCII string
68 | * \param cbGUID the size of pszGUID
69 | *
70 | * \since This function is available since SDL 2.24.0.
71 | *
72 | * \sa SDL_GUIDFromString
73 | */
74 | extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
75 |
76 | /**
77 | * Convert a GUID string into a ::SDL_GUID structure.
78 | *
79 | * Performs no error checking. If this function is given a string containing
80 | * an invalid GUID, the function will silently succeed, but the GUID generated
81 | * will not be useful.
82 | *
83 | * \param pchGUID string containing an ASCII representation of a GUID
84 | * \returns a ::SDL_GUID structure.
85 | *
86 | * \since This function is available since SDL 2.24.0.
87 | *
88 | * \sa SDL_GUIDToString
89 | */
90 | extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID);
91 |
92 | /* Ends C function definitions when using C++ */
93 | #ifdef __cplusplus
94 | }
95 | #endif
96 | #include "close_code.h"
97 |
98 | #endif /* SDL_guid_h_ */
99 |
100 | /* vi: set ts=4 sw=4 expandtab: */
101 |
--------------------------------------------------------------------------------