├── .gitattributes
├── src
├── font.bmp
├── retroarch.ico
├── speex
│ ├── version.txt
│ ├── stack_alloc.h
│ ├── fixed_arm4.h
│ ├── resample_sse.h
│ ├── fixed_bfin.h
│ ├── fixed_generic.h
│ ├── fixed_arm5e.h
│ ├── resample_neon.h
│ └── arch.h
├── GlUtil.h
├── dynlib
│ ├── dynlib.c
│ └── dynlib.h
├── About.h
├── CdRom.h
├── Fsm.h
├── Memory.h
├── About.cpp
├── components
│ ├── VideoContext.h
│ ├── Microphone.h
│ ├── Allocator.h
│ ├── VideoContext.cpp
│ ├── Logger.h
│ ├── Audio.h
│ ├── Dialog.h
│ ├── Input.h
│ ├── Video.h
│ ├── Config.h
│ ├── Logger.cpp
│ └── Microphone.cpp
├── Hash.h
├── Emulator.h
├── CdRom.cpp
├── libmincrypt
│ ├── sha256.h
│ ├── hash-internal.h
│ └── sha256.c
├── main.cpp
├── RA_Implementation.cpp
├── font.py
├── States.h
├── RAHasher.vcxproj.filters
├── Util.h
├── Gl.h
├── KeyBinds.h
├── resource.h
├── GlUtil.cpp
├── libretro
│ └── BareCore.h
├── menu.rc
├── Fsm.fsm
├── Application.h
├── libchdr.vcxproj.filters
├── Hash.cpp
└── Hash3DS.cpp
├── .gitignore
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── feature_request.md
│ └── bug_report.md
└── workflows
│ └── c-cpp.yml
├── .gitmodules
├── etc
├── CopyDLLs.bat
└── msbuild.bat
├── Makefile.RAHasher
├── README.md
├── RALibretro.sln
├── Makefile.common
└── Makefile
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.bat text eol=crlf
2 | *.cpp text eol=lf
3 | *.h text eol=lf
4 |
--------------------------------------------------------------------------------
/src/font.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RetroAchievements/RALibretro/HEAD/src/font.bmp
--------------------------------------------------------------------------------
/src/retroarch.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RetroAchievements/RALibretro/HEAD/src/retroarch.ico
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.opensdf
2 | *.sdf
3 | *.suo
4 | *.user
5 | *.o
6 | *.res
7 | *.swp
8 | *.log
9 | *.pdb
10 | *.zip
11 | .vs
12 | /bin
13 | /bin64
14 | /obj
15 | /src/RA_BuildVer.h
16 |
17 | .vscode
18 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # More info: http://EditorConfig.org
2 | root = true
3 |
4 | # * here means any file type
5 | [*]
6 | end_of_line = lf
7 | insert_final_newline = true
8 |
9 | # latin1 is a type of ASCII, should work with mbcs
10 | [*.{h,cpp}]
11 | charset = latin1
12 | indent_style = space
13 | indent_size = 2
14 | trim_trailing_whitespace = true
15 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Suggest a new toolkit feature
4 | url: https://github.com/RetroAchievements/RAIntegration/discussions/new?category=ideas
5 | about: Share ideas for new features or enhancements to the toolkit
6 | - name: Report a toolkit bug
7 | url: https://github.com/RetroAchievements/RAIntegration/issues/new
8 | about: Report an issue with one of the toolkit features
9 |
--------------------------------------------------------------------------------
/src/speex/version.txt:
--------------------------------------------------------------------------------
1 | SpeexDSP 1.2rc3
2 | https://www.speex.org/downloads/
3 |
4 | Speex website indicates it has been superceded by Opus, but Opus documentation specifically
5 | states it does not have a resampler, and points back at Speex:
6 |
7 | https://gitlab.xiph.org/xiph/opusfile/-/blob/master/include/opusfile.h#L59-62
8 |
9 | (the libopusfile API does not currently provide a resampler, but
10 | the
11 | Speex resampler is a good choice if you need one)
12 |
--------------------------------------------------------------------------------
/src/GlUtil.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "libretro/Components.h"
4 |
5 | #include "Gl.h"
6 |
7 | namespace GlUtil
8 | {
9 | void init(libretro::LoggerComponent* logger);
10 |
11 | GLuint createTexture(GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, GLenum filter);
12 | GLuint createShader(GLenum shaderType, const char* source);
13 | GLuint createProgram(const char* vertexShader, const char* fragmentShader);
14 | GLuint createFramebuffer(GLuint *renderbuffer, GLsizei width, GLsizei height, GLuint texture, bool depth, bool stencil);
15 | }
16 |
--------------------------------------------------------------------------------
/src/dynlib/dynlib.c:
--------------------------------------------------------------------------------
1 | #include "dynlib.h"
2 |
3 | #ifdef _WIN32
4 |
5 | #include
6 |
7 | const char* dynlib_error( void )
8 | {
9 | static char msg[ 512 ];
10 |
11 | DWORD err = GetLastError();
12 |
13 | DWORD res = FormatMessage(
14 | FORMAT_MESSAGE_FROM_SYSTEM,
15 | NULL,
16 | err,
17 | MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ),
18 | msg,
19 | sizeof( msg ) - 1,
20 | NULL
21 | );
22 |
23 | if ( res == 0 )
24 | {
25 | snprintf( msg, sizeof( msg ) - 1, "Error %lu", err );
26 | msg[ sizeof( msg ) - 1 ] = 0;
27 | }
28 |
29 | return msg;
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Suggest an emulator feature
3 | about: Share ideas for new features or enhancements to the emulator
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/SDL2"]
2 | path = src/SDL2
3 | url = https://github.com/RetroAchievements/SDL2
4 | [submodule "src/jsonsax"]
5 | path = src/jsonsax
6 | url = https://github.com/leiradel/jsonsax
7 | [submodule "src/miniz"]
8 | path = src/miniz
9 | url = https://github.com/richgel999/miniz.git
10 | ignore = untracked
11 | [submodule "src/RAInterface"]
12 | path = src/RAInterface
13 | url = https://github.com/RetroAchievements/RAInterface.git
14 | [submodule "src/rcheevos"]
15 | path = src/rcheevos
16 | url = https://github.com/RetroAchievements/rcheevos.git
17 | [submodule "src/libchdr"]
18 | path = src/libchdr
19 | url = https://github.com/rtissera/libchdr.git
20 | ignore = untracked
21 |
--------------------------------------------------------------------------------
/src/About.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | void aboutDialog(const char* log);
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Report an emulator bug
3 | about: Report an issue with the emulator
4 |
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 | Steps to reproduce the behavior:
12 | 1. Go to '...'
13 | 2. Click on '....'
14 | 3. Scroll down to '....'
15 | 4. See error
16 |
17 | **Expected behavior**
18 | A clear and concise description of what you expected to happen.
19 |
20 | **Screenshots**
21 | If applicable, add screenshots to help explain your problem.
22 |
23 | **Desktop (please complete the following information):**
24 | - OS: [e.g. Windows 10]
25 |
26 | **Smartphone (please complete the following information):**
27 | - Device: [e.g. iPhone6]
28 | - OS: [e.g. iOS8.1]
29 | - Browser [e.g. stock browser, safari]
30 | - Version [e.g. 22]
31 |
32 | **Additional context**
33 | Add any other context about the problem here.
34 |
--------------------------------------------------------------------------------
/src/dynlib/dynlib.h:
--------------------------------------------------------------------------------
1 | #ifndef DYNLIB_H
2 | #define DYNLIB_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #ifdef _WIN32
9 | #ifndef WIN32_LEAN_AND_MEAN
10 | #define WIN32_LEAN_AND_MEAN
11 | #endif
12 |
13 | #include
14 |
15 | typedef HMODULE dynlib_t;
16 |
17 | #define dynlib_open( path ) LoadLibrary( path )
18 | #define dynlib_symbol( lib, name ) (void*)GetProcAddress( lib, name )
19 | #define dynlib_close( lib ) FreeLibrary( lib )
20 |
21 | const char* dynlib_error( void );
22 | #else
23 | #include
24 |
25 | typedef void* dynlib_t;
26 |
27 | #define dynlib_open( path ) dlopen( path, RTLD_LAZY )
28 | #define dynlib_symbol( lib, name ) dlsym( lib, name )
29 | #define dynlib_close( lib ) dlclose( lib )
30 | #define dynlib_error() dlerror()
31 | #endif
32 |
33 | #ifdef __cplusplus
34 | }
35 | #endif
36 |
37 | #endif /* DYNLIB_H */
38 |
--------------------------------------------------------------------------------
/src/CdRom.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "components/Logger.h"
23 |
24 | #include
25 |
26 | int cdrom_get_cd_names(const char* filename, std::vector* disc_paths, Logger* logger);
27 |
--------------------------------------------------------------------------------
/src/Fsm.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Generated with FSM compiler, https://github.com/leiradel/ddlt
4 |
5 |
6 | #include "Emulator.h"
7 | #include
8 |
9 | typedef const std::string const_string;
10 |
11 | class Application;
12 |
13 | class Fsm {
14 | public:
15 | enum class State {
16 | CoreLoaded,
17 | FrameStep,
18 | GamePaused,
19 | GamePausedNoOvl,
20 | GameRunning,
21 | Quit,
22 | Start,
23 | };
24 |
25 | Fsm(Application& slave): ctx(slave), __state(State::Start) {}
26 |
27 | State currentState() const { return __state; }
28 |
29 | #ifdef DEBUG_FSM
30 | const char* stateName(State state) const;
31 | #endif
32 |
33 | bool loadCore(const_string core);
34 | bool loadGame(const_string path);
35 | bool pauseGame();
36 | bool pauseGameNoOvl();
37 | bool quit();
38 | bool resetGame();
39 | bool resumeGame();
40 | bool step();
41 | bool unloadCore();
42 | bool unloadGame();
43 |
44 | protected:
45 | bool before() const;
46 | bool before(State state) const;
47 | void after() const;
48 | void after(State state) const;
49 |
50 | Application& ctx;
51 | State __state;
52 | };
53 |
--------------------------------------------------------------------------------
/src/Memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Core.h"
23 |
24 | #include "Emulator.h"
25 |
26 | struct rc_memory_regions_t;
27 |
28 | class Memory
29 | {
30 | public:
31 | bool init(libretro::LoggerComponent* logger);
32 | void destroy();
33 |
34 | void attachToCore(libretro::Core* core, int consoleId);
35 |
36 | protected:
37 | void installMemoryBanks();
38 |
39 | libretro::LoggerComponent* _logger;
40 | };
41 |
--------------------------------------------------------------------------------
/src/About.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #include "About.h"
21 |
22 | #include "components/Dialog.h"
23 |
24 | void aboutDialog(const char* log)
25 | {
26 | const WORD WIDTH = 280;
27 | const WORD LINE = 15;
28 |
29 | Dialog db;
30 | db.init("About");
31 |
32 | WORD y = 0;
33 |
34 | db.addLabel("RALibretro \xC2\xA9 2017-2025 RetroAchievements", 0, y, WIDTH, 8);
35 | y += LINE;
36 |
37 | db.addEditbox(40000, 0, y, WIDTH, LINE, 12, (char*)log, 0, true);
38 | y += LINE * 12;
39 |
40 | db.addButton("OK", IDOK, WIDTH - 50, y, 50, 14, true);
41 | db.show();
42 | }
43 |
--------------------------------------------------------------------------------
/src/components/VideoContext.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Components.h"
23 |
24 | #include
25 |
26 | class VideoContext : public libretro::VideoContextComponent
27 | {
28 | public:
29 | bool init(libretro::LoggerComponent* logger, SDL_Window* window);
30 | void destroy();
31 |
32 | virtual void enableCoreContext(bool enable) override;
33 | virtual void resetCoreContext() override;
34 | virtual void swapBuffers() override;
35 |
36 | private:
37 | libretro::LoggerComponent* _logger;
38 | SDL_Window* _window;
39 | SDL_GLContext _raContext;
40 | SDL_GLContext _coreContext;
41 | };
42 |
--------------------------------------------------------------------------------
/src/Hash.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #ifndef _WINDOWS
23 | // prevent interface from attempting to define DLL functions that require Windows APIs
24 | #define RA_EXPORTS
25 |
26 | // explicitly define APIs needed by hasher
27 | typedef unsigned char BYTE;
28 | unsigned int RA_IdentifyHash(const char* sHash);
29 | void RA_ActivateGame(unsigned int nGameId);
30 | void RA_OnLoadNewRom(BYTE* pROMData, unsigned int nROMSize);
31 |
32 | #endif
33 |
34 | #include "Emulator.h"
35 |
36 | namespace libretro
37 | {
38 | class Core;
39 | }
40 |
41 | bool romLoaded(libretro::Core* core, Logger* logger, int consoleId, const std::string& path, void* rom, size_t size, bool changingDiscs);
42 | void romUnloaded(Logger* logger);
43 |
--------------------------------------------------------------------------------
/etc/CopyDLLs.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | @setlocal
3 |
4 | set W64=0
5 | if "%1"=="x64" set W64=1
6 |
7 | set PROJECTDIR=%2
8 | set BINDIR=%3
9 |
10 | rem === SDL2 is required by RALibretro, libstdc++-6 and libwinpthread-1 are required by cores ===
11 | set LIBSTDCPP=libstdc++-6.dll
12 | set LIBPTHREAD=libwinpthread-1.dll
13 | set SDL=SDL2.dll
14 |
15 | set SDLSRC=SDL2\lib\x86
16 | if %W64% equ 1 set SDLSRC=SDL2\lib\x64
17 | if not exist "%BINDIR%\%SDL%" (
18 | echo Copying SDL2.dll from %SDLSRC%
19 | copy /y "%PROJECTDIR%\%SDLSRC%\%SDL%" "%BINDIR%"
20 | )
21 |
22 | if exist "%BINDIR%\%LIBSTDC%" (
23 | if exist "%BINDIR%\%LIBPTHREAD%" (
24 | exit /B 0
25 | )
26 | )
27 |
28 | if %W64% equ 1 if exist C:\msys64\mingw64 set SRCDIR=C:\msys64\mingw64
29 | if %W64% neq 1 if exist C:\msys64\mingw32 set SRCDIR=C:\msys64\mingw32
30 | if "%SRCDIR%"=="" set SRCDIR="%MINGW%"
31 | if not exist "%SRCDIR%" set SRCDIR=C:\mingw
32 | )
33 |
34 | if not exist "%SRCDIR%" (
35 | echo Could not locate MINGW
36 | exit /B 0
37 | )
38 |
39 | if not exist "%BINDIR%\%LIBSTDCPP%" (
40 | if not exist "%SRCDIR%\bin\%LIBSTDCPP%" (
41 | echo WARNING: %LIBSTDCPP% not found in %SRCDIR%\bin
42 | ) else (
43 | echo Copying %LIBSTDCPP% from %SRCDIR%
44 | copy /y "%SRCDIR%\bin\%LIBSTDCPP%" "%BINDIR%"
45 | )
46 | )
47 |
48 | if not exist "%BINDIR%\%LIBPTHREAD%" (
49 | if not exist "%SRCDIR%\bin\%LIBPTHREAD%" (
50 | echo WARNING: %LIBPTHREAD% not found in %SRCDIR%\bin
51 | ) else (
52 | echo Copying %LIBPTHREAD% from %SRCDIR%
53 | copy /y "%SRCDIR%\bin\%LIBPTHREAD%" "%BINDIR%"
54 | )
55 | )
56 |
--------------------------------------------------------------------------------
/src/Emulator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include
26 |
27 | const std::string& getEmulatorName(const std::string& coreName, int system);
28 | const char* getEmulatorExtensions(const std::string& coreName, int system);
29 | const char* getSystemName(int system);
30 | const char* getSystemManufacturer(int system);
31 |
32 | class Config;
33 | class Logger;
34 | bool loadCores(Config* config, Logger* logger);
35 |
36 | bool doesCoreSupportSystem(const std::string& coreFilename, int system);
37 | void getAvailableSystems(std::set& systems);
38 | void getAvailableSystemCores(int system, std::set& coreNames);
39 | int encodeCoreName(const std::string& coreName, int system);
40 | const std::string& getCoreName(int encoded, int& systemOut);
41 | const std::string* getCoreDeprecationMessage(const std::string& coreName);
42 |
43 | bool showCoresDialog(Config* config, Logger* logger, const std::string& loadedCoreName, int selectedSystem);
44 |
--------------------------------------------------------------------------------
/src/components/Microphone.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2023 Brian Weiss
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Components.h"
23 |
24 | #include "libretro/libretro.h"
25 | #include "Audio.h"
26 |
27 | class Microphone : public libretro::MicrophoneComponent
28 | {
29 | public:
30 | bool init(libretro::LoggerComponent* logger);
31 | void destroy();
32 |
33 | virtual retro_microphone_t* openMic(const retro_microphone_params_t* params) override;
34 | virtual void closeMic(retro_microphone_t* microphone) override;
35 | virtual bool getMicParams(const retro_microphone_t* microphone, retro_microphone_params_t* params) override;
36 | virtual bool getMicState(const retro_microphone_t* microphone) override;
37 | virtual bool setMicState(retro_microphone_t* microphone, bool state) override;
38 | virtual int readMic(retro_microphone_t* microphone, int16_t* frames, size_t num_frames) override;
39 |
40 | protected:
41 | libretro::LoggerComponent* _logger;
42 |
43 | Fifo* _fifo;
44 |
45 | struct SDLData;
46 | struct SDLData* _data;
47 |
48 | static void recordCallback(void* data, Uint8* stream, int len);
49 | };
50 |
--------------------------------------------------------------------------------
/src/components/Allocator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Core.h"
23 |
24 | template
25 | class Allocator: public libretro::AllocatorComponent
26 | {
27 | public:
28 | inline bool init(libretro::LoggerComponent* logger)
29 | {
30 | _logger = logger;
31 | _head = 0;
32 | return true;
33 | }
34 |
35 | inline void destroy() {}
36 |
37 | virtual void reset() override
38 | {
39 | _head = 0;
40 | }
41 |
42 | virtual void* allocate(size_t alignment, size_t numBytes) override
43 | {
44 | size_t align_m1 = alignment - 1;
45 | size_t ptr = (_head + align_m1) & ~align_m1;
46 |
47 | if (numBytes <= (kBufferSize - ptr))
48 | {
49 | _head = ptr + numBytes;
50 | return (void*)(_buffer + ptr);
51 | }
52 |
53 | _logger->printf(RETRO_LOG_ERROR, "Out of memory allocating %u bytes", numBytes);
54 | return NULL;
55 | }
56 |
57 | protected:
58 | enum
59 | {
60 | kBufferSize = N
61 | };
62 |
63 | libretro::LoggerComponent* _logger;
64 | uint8_t _buffer[N];
65 | size_t _head;
66 | };
67 |
--------------------------------------------------------------------------------
/src/components/VideoContext.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #include "VideoContext.h"
21 |
22 | #define TAG "[CONTEXT] "
23 |
24 | bool VideoContext::init(libretro::LoggerComponent* logger, SDL_Window* window)
25 | {
26 | _logger = logger;
27 | _window = window;
28 |
29 | _raContext = SDL_GL_CreateContext(_window);
30 | _coreContext = SDL_GL_CreateContext(_window);
31 | if (SDL_GL_MakeCurrent(_window, _raContext) != 0)
32 | {
33 | _logger->error(TAG "SDL_GL_MakeCurrent: %s", SDL_GetError());
34 | return false;
35 | }
36 |
37 | return true;
38 | }
39 |
40 | void VideoContext::destroy()
41 | {
42 | }
43 |
44 | void VideoContext::enableCoreContext(bool enable)
45 | {
46 | if (enable)
47 | {
48 | SDL_GL_MakeCurrent(_window, _coreContext);
49 | }
50 | else
51 | {
52 | SDL_GL_MakeCurrent(_window, _raContext);
53 | }
54 | }
55 |
56 | void VideoContext::resetCoreContext() {
57 | SDL_GL_MakeCurrent(_window, _raContext);
58 | SDL_GL_DeleteContext(_coreContext);
59 | _coreContext = SDL_GL_CreateContext(_window);
60 | }
61 |
62 | void VideoContext::swapBuffers()
63 | {
64 | SDL_GL_SwapWindow(_window);
65 | }
66 |
--------------------------------------------------------------------------------
/src/components/Logger.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Components.h"
23 |
24 | #ifdef LOG_TO_FILE
25 | #include
26 | #endif
27 |
28 | // Must be at least MAX_LINE_SIZE + 3
29 | #ifndef RING_LOG_MAX_BUFFER_SIZE
30 | #define RING_LOG_MAX_BUFFER_SIZE 65536
31 | #endif
32 |
33 | class Logger: public libretro::LoggerComponent
34 | {
35 | public:
36 | bool init(const char* rootFolder);
37 | void destroy();
38 |
39 | std::string contents() const;
40 |
41 | typedef bool (*Iterator)(enum retro_log_level level, const char* line, void* ud);
42 | void iterate(Iterator iterator, void* ud) const;
43 |
44 | protected:
45 | void log(enum retro_log_level level, const char* msg, size_t length) override;
46 |
47 | void write(const void* data, size_t size);
48 | void read(void* data, size_t size);
49 | size_t peek(size_t pos, void* data, size_t size) const;
50 |
51 | inline void skip(size_t size)
52 | {
53 | _first = (_first + size) % RING_LOG_MAX_BUFFER_SIZE;
54 | _avail += size;
55 | }
56 |
57 | char _buffer[RING_LOG_MAX_BUFFER_SIZE];
58 | size_t _avail;
59 | size_t _first;
60 | size_t _last;
61 |
62 | #ifdef LOG_TO_FILE
63 | FILE* _file;
64 | #endif
65 | };
66 |
--------------------------------------------------------------------------------
/Makefile.RAHasher:
--------------------------------------------------------------------------------
1 | # supported parameters
2 | # ARCH architecture - "x86" or "x64" [detected if not set]
3 | # DEBUG if set to anything, builds with DEBUG symbols
4 |
5 | include Makefile.common
6 |
7 | # Toolset setup
8 | CC=gcc
9 | CXX=g++
10 |
11 | ifeq ($(OS),Windows_NT)
12 | EXE=.exe
13 | KERNEL=windows
14 | else
15 | KERNEL := $(shell uname -s)
16 | endif
17 |
18 | # compile flags
19 | DEFINES=-D_CONSOLE
20 | CFLAGS += $(DEFINES)
21 | CXXFLAGS += $(DEFINES)
22 |
23 | # main
24 | LIBS=
25 | OBJS=\
26 | src/components/Logger.o \
27 | src/libmincrypt/sha256.o \
28 | src/miniz/miniz.o \
29 | src/miniz/miniz_tdef.o \
30 | src/miniz/miniz_tinfl.o \
31 | src/miniz/miniz_zip.o \
32 | src/rcheevos/src/rhash/aes.o \
33 | src/rcheevos/src/rhash/cdreader.o \
34 | src/rcheevos/src/rhash/hash.o \
35 | src/rcheevos/src/rhash/hash_disc.o \
36 | src/rcheevos/src/rhash/hash_encrypted.o \
37 | src/rcheevos/src/rhash/hash_rom.o \
38 | src/rcheevos/src/rhash/hash_zip.o \
39 | src/rcheevos/src/rhash/md5.o \
40 | src/Hash3DS.o \
41 | src/Util.o \
42 | src/RAHasher.o
43 |
44 | ifdef HAVE_CHD
45 | OBJS += $(CHD_OBJS) \
46 | src/HashCHD.o
47 | endif
48 |
49 | all: $(OUTDIR)/RAHasher$(EXE)
50 |
51 | %.o: %.cpp
52 | $(CXX) $(CXXFLAGS) -c $< -o $@
53 |
54 | %.o: %.c
55 | $(CC) $(CFLAGS) -c $< -o $@
56 |
57 | src/RA_BuildVer.h: .git/HEAD
58 | src/RAInterface/MakeBuildVer.sh src/RA_BuildVer.h "" RA_LIBRETRO
59 |
60 | src/RAHasher.o: src/RAHasher.cpp src/RA_BuildVer.h
61 | $(CXX) $(CXXFLAGS) -c $< -o $@
62 |
63 | $(OUTDIR)/RAHasher$(EXE): $(OBJS)
64 | mkdir -p $(OUTDIR)
65 | $(CXX) -o $@ $+ $(LDFLAGS)
66 |
67 | zip: $(OUTDIR)/RAHasher$(EXE)
68 | rm -f $(OUTDIR)/RAHasher-*.zip RAHasher-*.zip
69 | zip -9 RAHasher-$(ARCH)-$(KERNEL)-`git describe --tags | sed s/\-.*//g | tr -d "\n"`.zip $(OUTDIR)/RAHasher$(EXE)
70 |
71 | clean:
72 | rm -f $(OUTDIR)/RAHasher$(EXE) $(OBJS) $(OUTDIR)/RAHasher*.zip RAHasher*.zip
73 |
74 | .PHONY: clean FORCE
75 |
--------------------------------------------------------------------------------
/src/components/Audio.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "libretro/Components.h"
23 |
24 | #include "speex/speex_resampler.h"
25 |
26 | #include
27 |
28 | class Fifo
29 | {
30 | public:
31 | bool init(size_t size);
32 | void destroy();
33 | void reset();
34 |
35 | void read(void* data, size_t size);
36 | void write(const void* data, size_t size);
37 |
38 | inline size_t size() { return _size; }
39 |
40 | size_t occupied();
41 | size_t free();
42 |
43 | protected:
44 | SDL_mutex* _mutex;
45 | uint8_t* _buffer;
46 | size_t _size;
47 | size_t _avail;
48 | size_t _first;
49 | size_t _last;
50 | };
51 |
52 | class Audio: public libretro::AudioComponent
53 | {
54 | public:
55 | bool init(libretro::LoggerComponent* logger, double sample_rate, int channels, Fifo* fifo);
56 | void destroy();
57 |
58 | virtual bool setRate(double rate) override;
59 | virtual void mix(const int16_t* samples, size_t frames) override;
60 |
61 | void setBlocking(bool value) { _blocking = value; }
62 |
63 | protected:
64 | libretro::LoggerComponent* _logger;
65 |
66 | double _sampleRate;
67 | double _coreRate;
68 | int _channels;
69 | bool _blocking;
70 |
71 | double _currentRatio;
72 | double _originalRatio;
73 | SpeexResamplerState* _resamplerLeft;
74 | SpeexResamplerState* _resamplerRight;
75 |
76 | Fifo* _fifo;
77 | };
78 |
--------------------------------------------------------------------------------
/src/CdRom.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #include "CdRom.h"
21 |
22 | #include "Util.h"
23 |
24 | #include
25 | #include
26 |
27 | #include
28 |
29 | static int cdrom_get_cd_names_m3u(const char* filename, std::vector* disc_paths, Logger* logger)
30 | {
31 | int count = 0;
32 | char buffer[2048], *ptr, *start;
33 | FILE* fp = util::openFile(logger, filename, "r");
34 | if (fp)
35 | {
36 | size_t bytes = fread(buffer, 1, sizeof(buffer), fp);
37 | fclose(fp);
38 |
39 | buffer[bytes] = '\0';
40 | ptr = buffer;
41 | do
42 | {
43 | start = ptr;
44 | while (*ptr && *ptr != '\n')
45 | ++ptr;
46 |
47 | if (ptr > start)
48 | {
49 | std::string path(start, ptr - start);
50 | disc_paths->push_back(path);
51 | ++count;
52 | }
53 |
54 | if (!*ptr)
55 | break;
56 |
57 | ++ptr;
58 | } while (true);
59 | }
60 |
61 | return count;
62 | }
63 |
64 | int cdrom_get_cd_names(const char* filename, std::vector* disc_paths, Logger* logger)
65 | {
66 | disc_paths->clear();
67 |
68 | int len = strlen(filename);
69 | if (len > 4 && strcasecmp(&filename[len - 4], ".m3u") == 0)
70 | return cdrom_get_cd_names_m3u(filename, disc_paths, logger);
71 |
72 | std::string filename_path = util::fileNameWithExtension(filename);
73 | disc_paths->push_back(std::move(filename_path));
74 | return 1;
75 | }
76 |
--------------------------------------------------------------------------------
/src/libmincrypt/sha256.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * * Redistributions of source code must retain the above copyright
7 | * notice, this list of conditions and the following disclaimer.
8 | * * Redistributions in binary form must reproduce the above copyright
9 | * notice, this list of conditions and the following disclaimer in the
10 | * documentation and/or other materials provided with the distribution.
11 | * * Neither the name of Google Inc. nor the names of its contributors may
12 | * be used to endorse or promote products derived from this software
13 | * without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 | * EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
28 | #define SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
29 |
30 | #include
31 | #include "hash-internal.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif // __cplusplus
36 |
37 | typedef HASH_CTX SHA256_CTX;
38 |
39 | void SHA256_init(SHA256_CTX* ctx);
40 | void SHA256_update(SHA256_CTX* ctx, const void* data, int len);
41 | const uint8_t* SHA256_final(SHA256_CTX* ctx);
42 |
43 | // Convenience method. Returns digest address.
44 | const uint8_t* SHA256_hash(const void* data, int len, uint8_t* digest);
45 |
46 | #define SHA256_DIGEST_SIZE 32
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif // __cplusplus
51 |
52 | #endif // SYSTEM_CORE_INCLUDE_MINCRYPT_SHA256_H_
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RALibretro
2 |
3 | RALibretro is a multi-emulator that can be used to develop RetroAchievements and, of course, earn them.
4 |
5 | The "multi-emulation" feature is only possible because it uses [libretro](https://github.com/libretro/) cores to do the actual emulation. What RALibretro does is to connect the emulation to the tools used to create RetroAchievements.
6 |
7 | The integration with RetroAchievements.org site is done by the [RAIntegration](https://github.com/RetroAchievements/RAIntegration).
8 |
9 |
10 | ## Building RALibretro with MSYS2/Makefile
11 |
12 | ### Install MSYS2
13 |
14 | 1. Go to [http://www.msys2.org/](http://www.msys2.org/) and download the 32 bit version.
15 | 2. Follow the installation instructions on the site [http://www.msys2.org/](http://www.msys2.org/).
16 | 3. When on the prompt for the first time, run `pacman -Syu` (**NOTE**: at the end of this command it will ask you to close the terminal window **without** going back to the prompt.)
17 | 4. Launch the MSYS2 terminal again and run `pacman -Su`
18 |
19 | ### Install the toolchain
20 |
21 | ```
22 | $ pacman -S make git zip mingw-w64-i686-gcc mingw-w64-i686-SDL2 mingw-w64-i686-gcc-libs
23 | ```
24 |
25 | ### Clone the repo
26 |
27 | ```
28 | $ git clone --recursive --depth 1 https://github.com/RetroAchievements/RALibretro.git
29 | ```
30 |
31 | ### Build
32 |
33 | ```
34 | $ cd RALibretro
35 | $ make
36 | ```
37 |
38 | **NOTE**: use `make` for a release build or `make DEBUG=1` for a debug build. Don't forget to run `make clean` first if switching between a release build and a debug build.
39 |
40 | ## Building RALibretro with Visual Studio
41 |
42 | ### Clone the repo
43 |
44 | ```
45 | > git clone --recursive --depth 1 https://github.com/RetroAchievements/RALibretro.git
46 | ```
47 |
48 | ### Build
49 |
50 | Load `RALibretro.sln` in Visual Studio and build it.
51 |
52 | ## Command Line Arguments
53 |
54 | Argument|Description
55 | -|-
56 | -c [--core]|the core's name, e.g. `--core picodrive_libretro`
57 | -s [--system]|the system id, see ConsoleID in [RAInterface/RA_Consoles.h](https://github.com/RetroAchievements/RAInterface/blob/master/RA_Consoles.h), e.g. `--system 1`
58 | -g [--game]|full path to the game's file, e.g. `--game "C:\ROMS\GEN\Demons Of Asteborg Demo.gen"`
59 |
60 | In order to run a game on startup, provide the core, system and game, e.g.:
61 |
62 | `RALibretro.exe --core picodrive_libretro --system 1 --game "C:\ROMS\GEN\Demons Of Asteborg Demo.gen"`
63 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #define WINDOWS_IGNORE_PACKING_MISMATCH 1 // prevent "Windows headers require the default packing option" error - need to upgrade SDL library to fix it
21 |
22 | #include
23 | #include
24 |
25 | #include "Application.h"
26 | #include "Util.h"
27 |
28 | #include
29 |
30 | extern Application app;
31 |
32 | bool isGameActive()
33 | {
34 | return app.isGameActive();
35 | }
36 |
37 | void getGameName(char name[], size_t len)
38 | {
39 | std::string fileName = util::fileName(app.gameName());
40 | strncpy(name, fileName.c_str(), len);
41 | name[len - 1] = '\0';
42 | }
43 |
44 | void pause()
45 | {
46 | app.pauseGame(true);
47 | }
48 |
49 | void resume()
50 | {
51 | app.pauseGame(false);
52 | }
53 |
54 | void reset()
55 | {
56 | // this is called when the user switches from non-hardcore to hardcore - validate the config settings
57 | if (app.validateHardcoreEnablement())
58 | app.resetGame();
59 | }
60 |
61 | void loadROM(const char* path)
62 | {
63 | app.loadGame(path);
64 | }
65 |
66 | extern "C" void abort_handler(int signal_number)
67 | {
68 | app.logger().error("[APP] abort() called");
69 | app.unloadCore();
70 | app.destroy();
71 | }
72 |
73 | int main(int argc, char* argv[])
74 | {
75 | signal(SIGABRT, &abort_handler);
76 |
77 | bool ok = app.init("RALibRetro", 640, 480);
78 | ok &= app.handleArgs(argc, argv);
79 |
80 | if (ok)
81 | {
82 | #if defined(MINGW) || defined(__MINGW32__) || defined(__MINGW64__)
83 | app.run();
84 | #else
85 | __try
86 | {
87 | app.run();
88 | }
89 | __except (EXCEPTION_EXECUTE_HANDLER)
90 | {
91 | app.logger().error("[APP] Unhandled exception %08X", GetExceptionCode());
92 | }
93 | #endif
94 |
95 | app.destroy();
96 | }
97 |
98 | return ok ? 0 : 1;
99 | }
100 |
--------------------------------------------------------------------------------
/src/libmincrypt/hash-internal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007 The Android Open Source Project
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * * Redistributions of source code must retain the above copyright
7 | * notice, this list of conditions and the following disclaimer.
8 | * * Redistributions in binary form must reproduce the above copyright
9 | * notice, this list of conditions and the following disclaimer in the
10 | * documentation and/or other materials provided with the distribution.
11 | * * Neither the name of Google Inc. nor the names of its contributors may
12 | * be used to endorse or promote products derived from this software
13 | * without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 | * EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
28 | #define SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
29 |
30 | #include
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif // __cplusplus
35 |
36 | struct HASH_CTX; // forward decl
37 |
38 | typedef struct HASH_VTAB {
39 | void (* const init)(struct HASH_CTX*);
40 | void (* const update)(struct HASH_CTX*, const void*, int);
41 | const uint8_t* (* const final)(struct HASH_CTX*);
42 | const uint8_t* (* const hash)(const void*, int, uint8_t*);
43 | int size;
44 | } HASH_VTAB;
45 |
46 | typedef struct HASH_CTX {
47 | const HASH_VTAB * f;
48 | uint64_t count;
49 | uint8_t buf[64];
50 | uint32_t state[8]; // upto SHA2
51 | } HASH_CTX;
52 |
53 | #define HASH_init(ctx) (ctx)->f->init(ctx)
54 | #define HASH_update(ctx, data, len) (ctx)->f->update(ctx, data, len)
55 | #define HASH_final(ctx) (ctx)->f->final(ctx)
56 | #define HASH_hash(data, len, digest) (ctx)->f->hash(data, len, digest)
57 | #define HASH_size(ctx) (ctx)->f->size
58 |
59 | #ifdef __cplusplus
60 | }
61 | #endif // __cplusplus
62 |
63 | #endif // SYSTEM_CORE_INCLUDE_MINCRYPT_HASH_INTERNAL_H_
--------------------------------------------------------------------------------
/src/RA_Implementation.cpp:
--------------------------------------------------------------------------------
1 | #include "RA_Interface.h"
2 |
3 | #include "RA_Emulators.h"
4 |
5 | #include
6 |
7 | #include "RA_BuildVer.h"
8 |
9 | extern HWND g_mainWindow;
10 |
11 | bool isGameActive();
12 | void getGameName(char name[], size_t len);
13 | void pause();
14 | void resume();
15 | void reset();
16 | void loadROM(const char* path);
17 |
18 |
19 | // returns -1 if not found
20 | int GetMenuItemIndex(HMENU hMenu, const char* ItemName)
21 | {
22 | int index = 0;
23 | char buf[256];
24 |
25 | while (index < GetMenuItemCount(hMenu))
26 | {
27 | if (GetMenuString(hMenu, index, buf, sizeof(buf) - 1, MF_BYPOSITION) && !strcmp(ItemName, buf))
28 | {
29 | return index;
30 | }
31 |
32 | index++;
33 | }
34 |
35 | return -1;
36 | }
37 |
38 |
39 | // Return whether a game has been loaded. Should return FALSE if
40 | // no ROM is loaded, or a ROM has been unloaded.
41 | bool GameIsActive()
42 | {
43 | return isGameActive();
44 | }
45 |
46 |
47 | void CauseUnpause()
48 | {
49 | resume();
50 | }
51 |
52 |
53 | // Perform whatever action is required to Pause emulation.
54 | void CausePause()
55 | {
56 | pause();
57 | }
58 |
59 |
60 | // Perform whatever function in the case of needing to rebuild the menu.
61 | void RebuildMenu()
62 | {
63 | HMENU mainMenu = GetMenu(g_mainWindow);
64 | if (!mainMenu) return;
65 |
66 | // get file menu index
67 | int index = GetMenuItemIndex(mainMenu, "&RetroAchievements");
68 | if (index >= 0)
69 | DeleteMenu(mainMenu, index, MF_BYPOSITION);
70 |
71 | // ##RA embed RA
72 | AppendMenu(mainMenu, MF_POPUP | MF_STRING, (UINT_PTR)RA_CreatePopupMenu(), TEXT("&RetroAchievements"));
73 | InvalidateRect(g_mainWindow, NULL, TRUE);
74 | DrawMenuBar(g_mainWindow);
75 | }
76 |
77 |
78 | // sNameOut points to a 256 character buffer.
79 | // sNameOut should have copied into it the estimated game title
80 | // for the ROM, if one can be inferred from the ROM.
81 | void GetEstimatedGameTitle(char* sNameOut)
82 | {
83 | getGameName(sNameOut, 256);
84 | }
85 |
86 |
87 | void ResetEmulation()
88 | {
89 | reset();
90 | }
91 |
92 |
93 | void LoadROM(const char* sFullPath)
94 | {
95 | loadROM(sFullPath);
96 | }
97 |
98 | void RA_Init(HWND hWnd)
99 | {
100 | // initialize the DLL
101 | RA_Init(hWnd, RA_Libretro, RA_LIBRETRO_VERSION_FULL);
102 |
103 | // provide callbacks to the DLL
104 | RA_InstallSharedFunctions(NULL, &CauseUnpause, &CausePause, &RebuildMenu, &GetEstimatedGameTitle, &ResetEmulation, &LoadROM);
105 |
106 | // add a placeholder menu item and start the login process - menu will be updated when login completes
107 | RebuildMenu();
108 |
109 | // ensure titlebar text matches expected format
110 | RA_UpdateAppTitle("");
111 | }
112 |
--------------------------------------------------------------------------------
/src/font.py:
--------------------------------------------------------------------------------
1 | #! python
2 |
3 | with open('font.bmp', 'rb') as f:
4 | data = bytearray(f.read())
5 |
6 | # this assumes the file is a 4-bpp bitmap.
7 |
8 | start = 0x42
9 | width = 144
10 | height = 272
11 | stride = width / 2
12 |
13 | with open('components/BitmapFont.h', 'w') as f:
14 | f.write("/*\n");
15 | f.write("Copyright (C) 2024 Brian Weiss\n");
16 | f.write("\n");
17 | f.write("This file is part of RALibretro.\n");
18 | f.write("\n");
19 | f.write("RALibretro is free software: you can redistribute it and/or modify\n");
20 | f.write("it under the terms of the GNU General Public License as published by\n");
21 | f.write("the Free Software Foundation, either version 3 of the License, or\n");
22 | f.write("(at your option) any later version.\n");
23 | f.write("\n");
24 | f.write("RALibretro is distributed in the hope that it will be useful,\n");
25 | f.write("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
26 | f.write("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
27 | f.write("GNU General Public License for more details.\n");
28 | f.write("\n");
29 | f.write("You should have received a copy of the GNU General Public License\n");
30 | f.write("along with RALibretro. If not, see .\n");
31 | f.write("*/\n");
32 | f.write("\n");
33 | f.write("#pragma once\n");
34 | f.write("\n");
35 | f.write("/* https://github.com/epto/epto-fonts/blob/master/font-images/img/simple-8x16.png */\n");
36 | f.write("\n");
37 |
38 | f.write("static uint8_t _bitmapFont[] = {\n")
39 |
40 | for c in range(0x20, 0x80):
41 | f.write(' /* ' )
42 | f.write(hex(c))
43 | f.write(': ')
44 | f.write(chr(c))
45 | f.write(" */\n")
46 |
47 | cy = (int)(c // 16)
48 | cx = (int)(c % 16)
49 | input = (height - 1 - cy * 17) * width + cx * 9
50 | for y in range(0, 16):
51 | f.write(' 0b');
52 | for x in range(0, 8):
53 | i = input + x;
54 | b = data[(int)(start + i // 2)]
55 | if i & 1 == 0:
56 | f.write('1' if (b & 0xF0) != 0 else '0')
57 | else:
58 | f.write('1' if (b & 0x0F) != 0 else '0')
59 |
60 | f.write(",\n");
61 | input -= width;
62 |
63 | f.write("\n");
64 |
65 | f.write(" /* 0x80: unknown char */\n")
66 | f.write(" 0b00000000,\n")
67 | f.write(" 0b00000000,\n")
68 | f.write(" 0b00000000,\n")
69 | f.write(" 0b01111110,\n")
70 | f.write(" 0b01100110,\n")
71 | f.write(" 0b01100110,\n")
72 | f.write(" 0b01100110,\n")
73 | f.write(" 0b01100110,\n")
74 | f.write(" 0b01100110,\n")
75 | f.write(" 0b01111110,\n")
76 | f.write(" 0b00000000,\n")
77 | f.write(" 0b00000000,\n")
78 | f.write(" 0b00000000,\n")
79 | f.write(" 0b00000000,\n")
80 | f.write(" 0b00000000,\n")
81 | f.write(" 0b00000000\n")
82 |
83 | f.write("};\n");
--------------------------------------------------------------------------------
/src/States.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibRetro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "components/Config.h"
23 | #include "components/Logger.h"
24 | #include "components/Video.h"
25 |
26 | #include "libretro/Core.h"
27 |
28 | class States
29 | {
30 | public:
31 | bool init(Logger* logger, Config* config, Video* video);
32 |
33 | void setGame(const std::string& gameFileName, int system, const std::string& coreName, libretro::Core* core);
34 |
35 | std::string getSRamPath() const;
36 | std::string getStatePath(unsigned ndx) const;
37 |
38 | bool saveState(const std::string& path);
39 | bool saveState(unsigned ndx);
40 | bool loadState(const std::string& path);
41 | bool loadState(unsigned ndx);
42 |
43 | void loadSRAM(libretro::Core* core);
44 | void saveSRAM(libretro::Core* core);
45 | void periodicSaveSRAM(libretro::Core* core);
46 |
47 | void migrateFiles();
48 | bool existsState(unsigned ndx);
49 |
50 | std::string serializeSettings() const;
51 | bool deserializeSettings(const char* json);
52 |
53 | void showDialog();
54 |
55 | protected:
56 | enum Path
57 | {
58 | Saves = 0x00,
59 | State = 0x01,
60 | System = 0x02,
61 | Core = 0x04,
62 | Game = 0x08
63 | };
64 | Path _sramPath = Path::Saves;
65 | Path _statePath = Path::Saves;
66 |
67 | static const States::Path _sramPaths[];
68 | static const States::Path _statePaths[];
69 | static const int _saveIntervals[];
70 |
71 | Logger* _logger;
72 | Config* _config;
73 | Video* _video;
74 |
75 | std::string _gameFileName;
76 | int _system = 0;
77 | std::string _coreName;
78 | libretro::Core* _core = NULL;
79 | int _saveInterval = 0;
80 | void* _lastSaveData = NULL;
81 | time_t _lastSave = 0;
82 |
83 | private:
84 | std::string buildPath(Path path) const;
85 | static std::string encodePath(Path path);
86 | static Path decodePath(const std::string& shorthand);
87 |
88 | std::string getSRamPath(Path path) const;
89 | std::string getStatePath(unsigned ndx, Path path, bool bOldFormat) const;
90 |
91 | void saveSRAM(void* sramData, size_t sramSize);
92 | void restoreFrameBuffer(const void* pixels, unsigned image_width, unsigned image_height, unsigned pitch);
93 |
94 | bool loadRAState1(unsigned char* input, size_t size, std::string& errorBuffer);
95 | };
96 |
--------------------------------------------------------------------------------
/etc/msbuild.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 |
4 | rem === Globals ===
5 |
6 | set BUILDCLEAN=0
7 | set DEBUG=0
8 | set RELEASE=0
9 | set W32=0
10 | set W64=0
11 |
12 | for %%A in (%*) do (
13 | if /I "%%A" == "Clean" (
14 | set BUILDCLEAN=1
15 | ) else if /I "%%A" == "Debug" (
16 | set DEBUG=1
17 | ) else if /I "%%A" == "Release" (
18 | set RELEASE=1
19 | ) else if /I "%%A" == "x86" (
20 | set W32=1
21 | ) else if /I "%%A" == "x64" (
22 | set W64=1
23 | )
24 | )
25 |
26 | if %W32% equ 0 if %W64% equ 0 (
27 | set W64=1
28 | )
29 |
30 | echo Initializing Visual Studio environment
31 | if "%VSINSTALLDIR%"=="" set VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\
32 | if not exist "%VSINSTALLDIR%" set VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\
33 | if not exist "%VSINSTALLDIR%" set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\
34 | if not exist "%VSINSTALLDIR%" (
35 | echo Could not determine VSINSTALLDIR
36 | exit /B 1
37 | )
38 | echo using VSINSTALLDIR=%VSINSTALLDIR%
39 |
40 | call "%VSINSTALLDIR%VC\Auxiliary\Build\vcvars32.bat"
41 |
42 | rem === Build each project ===
43 |
44 | if %BUILDCLEAN% equ 1 (
45 | if %DEBUG% equ 1 (
46 | call :build Clean Debug || goto eof
47 | )
48 |
49 | if %RELEASE% equ 1 (
50 | call :build Clean Release || goto eof
51 | )
52 | ) else (
53 | if %DEBUG% equ 1 (
54 | call :build RALibretro Debug || goto eof
55 | )
56 |
57 | if %RELEASE% equ 1 (
58 | call :build RALibretro Release || goto eof
59 | )
60 | )
61 |
62 | exit /B 0
63 |
64 | rem === Build subroutine ===
65 |
66 | :build
67 |
68 | set PROJECT=%~1
69 | set CONFIG=%~2
70 |
71 | if %W32% equ 1 call :build2 %PROJECT% %CONFIG% x86
72 | if %W64% equ 1 call :build2 %PROJECT% %CONFIG% x64
73 |
74 | exit /B %ERRORLEVEL%
75 |
76 | :build2
77 |
78 | rem === Do the build ===
79 |
80 | echo.
81 | echo Building %~1 %~2 %~3
82 |
83 | rem -- vsbuild doesn't like periods in the "-t" parameter, so replace them with underscores
84 | rem -- https://stackoverflow.com/questions/56253635/what-could-i-be-doing-wrong-with-my-msbuild-argument
85 | rem -- https://stackoverflow.com/questions/15441422/replace-character-of-string-in-batch-script/25812295
86 | set ESCAPEDKEY=%~1
87 | :replace_periods
88 | for /f "tokens=1* delims=." %%i in ("%ESCAPEDKEY%") do (
89 | set ESCAPEDKEY=%%j
90 | if defined ESCAPEDKEY (
91 | set ESCAPEDKEY=%%i_%%j
92 | goto replace_periods
93 | ) else (
94 | set ESCAPEDKEY=%%i
95 | )
96 | )
97 |
98 | msbuild.exe RALibretro.sln -t:%ESCAPEDKEY% -p:Configuration=%~2 -p:Platform=%~3 /nowarn:C4091
99 | set RESULT=%ERRORLEVEL%
100 |
101 | rem === If build failed, bail ===
102 |
103 | if not %RESULT% equ 0 (
104 | echo %~1 %~2 failed: %RESULT%
105 | exit /B %RESULT%
106 | )
107 |
108 | rem === For termination from within function ===
109 |
110 | :eof
111 | exit /B %ERRORLEVEL%
112 |
--------------------------------------------------------------------------------
/RALibretro.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29201.188
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RALibretro", "src\RALibretro.vcxproj", "{418D11DE-D07C-4BF2-A454-ACCCB451BBE1}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{28CC2E0D-4F95-4A78-AA58-BA25530C93F1}"
9 | ProjectSection(SolutionItems) = preProject
10 | .editorconfig = .editorconfig
11 | EndProjectSection
12 | EndProject
13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RAHasher", "src\RAHasher.vcxproj", "{5E39410E-0276-4024-8697-1BD685207142}"
14 | EndProject
15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchdr", "src\libchdr.vcxproj", "{6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|x64 = Debug|x64
20 | Debug|x86 = Debug|x86
21 | Release|x64 = Release|x64
22 | Release|x86 = Release|x86
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Debug|x64.ActiveCfg = Debug|x64
26 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Debug|x64.Build.0 = Debug|x64
27 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Debug|x86.ActiveCfg = Debug|Win32
28 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Debug|x86.Build.0 = Debug|Win32
29 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Release|x64.ActiveCfg = Release|x64
30 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Release|x64.Build.0 = Release|x64
31 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Release|x86.ActiveCfg = Release|Win32
32 | {418D11DE-D07C-4BF2-A454-ACCCB451BBE1}.Release|x86.Build.0 = Release|Win32
33 | {5E39410E-0276-4024-8697-1BD685207142}.Debug|x64.ActiveCfg = Debug|x64
34 | {5E39410E-0276-4024-8697-1BD685207142}.Debug|x64.Build.0 = Debug|x64
35 | {5E39410E-0276-4024-8697-1BD685207142}.Debug|x86.ActiveCfg = Debug|Win32
36 | {5E39410E-0276-4024-8697-1BD685207142}.Debug|x86.Build.0 = Debug|Win32
37 | {5E39410E-0276-4024-8697-1BD685207142}.Release|x64.ActiveCfg = Release|x64
38 | {5E39410E-0276-4024-8697-1BD685207142}.Release|x64.Build.0 = Release|x64
39 | {5E39410E-0276-4024-8697-1BD685207142}.Release|x86.ActiveCfg = Release|Win32
40 | {5E39410E-0276-4024-8697-1BD685207142}.Release|x86.Build.0 = Release|Win32
41 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Debug|x64.ActiveCfg = Debug|x64
42 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Debug|x64.Build.0 = Debug|x64
43 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Debug|x86.ActiveCfg = Debug|Win32
44 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Debug|x86.Build.0 = Debug|Win32
45 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Release|x64.ActiveCfg = Release|x64
46 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Release|x64.Build.0 = Release|x64
47 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Release|x86.ActiveCfg = Release|Win32
48 | {6CFBE506-0BC2-4DBC-B7F2-D879C140D5D1}.Release|x86.Build.0 = Release|Win32
49 | EndGlobalSection
50 | GlobalSection(SolutionProperties) = preSolution
51 | HideSolutionNode = FALSE
52 | EndGlobalSection
53 | GlobalSection(ExtensibilityGlobals) = postSolution
54 | SolutionGuid = {71DAD649-EAE3-4C0D-B698-FF8A5EE83E01}
55 | EndGlobalSection
56 | EndGlobal
57 |
--------------------------------------------------------------------------------
/src/components/Dialog.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | class Dialog
26 | {
27 | public:
28 | typedef const char* (*GetOption)(int index, void* udata);
29 |
30 | Dialog();
31 | ~Dialog();
32 |
33 | void init(const char* title);
34 | void addCheckbox(const char* caption, DWORD id, WORD x, WORD y, WORD w, WORD h, bool* checked);
35 | void addLabel(const char* caption, WORD x, WORD y, WORD w, WORD h);
36 | void addLabel(const char* caption, DWORD id, WORD x, WORD y, WORD w, WORD h);
37 | void addButton(const char* caption, DWORD id, WORD x, WORD y, WORD w, WORD h, bool isDefault);
38 | void addCombobox(DWORD id, WORD x, WORD y, WORD w, WORD h, WORD maxDropDownHeight, GetOption get_option, void* udata, int* selected);
39 | void addEditbox(DWORD id, WORD x, WORD y, WORD w, WORD h, WORD lines, char* contents, size_t maxSize, bool readOnly);
40 |
41 | bool show();
42 |
43 | protected:
44 | enum Type
45 | {
46 | kCheckbox,
47 | kCombobox,
48 | kEditbox
49 | };
50 |
51 | struct ControlData
52 | {
53 | Type _type;
54 | DWORD _id;
55 |
56 | union
57 | {
58 | bool* _checked;
59 |
60 | struct
61 | {
62 | GetOption _getOption;
63 | void* _udata;
64 | int* _selected;
65 | };
66 |
67 | struct
68 | {
69 | char* _contents;
70 | size_t _maxSize;
71 | };
72 | };
73 | };
74 |
75 | void align(size_t alignment);
76 |
77 | void writeDlgItemTemplateEx(DWORD helpId, DWORD exStyle, DWORD style, WORD x, WORD y, WORD cx, WORD cy, DWORD id, DWORD windowClass, const char* title, WORD extraCount);
78 |
79 | void write(void* data, size_t size);
80 | void writeStr(const char* str);
81 | void writeWide(const WCHAR* str);
82 |
83 | template void write(T t)
84 | {
85 | write(&t, sizeof(t));
86 | }
87 |
88 | void update(WORD x, WORD y, WORD w, WORD h);
89 |
90 | virtual void initControls(HWND hwnd);
91 | virtual void retrieveData(HWND hwnd);
92 |
93 | static INT_PTR CALLBACK s_dialogProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
94 | virtual INT_PTR dialogProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { return FALSE; }
95 | virtual void markClosed(HWND hwnd);
96 |
97 | void* _template;
98 | size_t _size;
99 | size_t _reserved;
100 |
101 | WORD* _numControls;
102 | WORD* _width;
103 | WORD* _height;
104 |
105 | std::vector _controlData;
106 | bool _updated;
107 | };
108 |
--------------------------------------------------------------------------------
/.github/workflows/c-cpp.yml:
--------------------------------------------------------------------------------
1 | name: C/C++ CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | - develop
8 | tags:
9 | - "*"
10 | pull_request:
11 | branches:
12 | - master
13 | - develop
14 |
15 | jobs:
16 | RALibretro-Win32:
17 | runs-on: windows-latest
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v2
21 | with:
22 | submodules: recursive
23 | - name: Install MSBuild
24 | uses: microsoft/setup-msbuild@v1.0.2
25 | - name: Build
26 | run: msbuild.exe RALibretro.sln -p:Configuration=Release -p:Platform=x86
27 |
28 | RALibretro-Win64:
29 | runs-on: windows-latest
30 | steps:
31 | - name: Checkout
32 | uses: actions/checkout@v2
33 | with:
34 | submodules: recursive
35 | - name: Install MSBuild
36 | uses: microsoft/setup-msbuild@v1.0.2
37 | - name: Build
38 | run: msbuild.exe RALibretro.sln -p:Configuration=Release -p:Platform=x64
39 |
40 | RALibretro-Win32-cross-compile:
41 | runs-on: ubuntu-latest
42 | steps:
43 | - name: Checkout
44 | uses: actions/checkout@v2
45 | with:
46 | submodules: recursive
47 | - name: Install dependencies
48 | run: |
49 | sudo apt-get update
50 | sudo apt-get install gcc-multilib # bits/libc-header-start.h
51 | - name: Install MinGW
52 | uses: egor-tensin/setup-mingw@v2
53 | - name: Build
54 | run: make ARCH=x86
55 |
56 | RALibretro-Win64-cross-compile:
57 | runs-on: ubuntu-latest
58 | steps:
59 | - name: Checkout
60 | uses: actions/checkout@v2
61 | with:
62 | submodules: recursive
63 | - name: Install dependencies
64 | run: |
65 | sudo apt-get update
66 | sudo apt-get install gcc-multilib # bits/libc-header-start.h
67 | - name: Install MinGW
68 | uses: egor-tensin/setup-mingw@v2
69 | - name: Build
70 | run: make ARCH=x64
71 |
72 | RAHasher-linux-x86:
73 | runs-on: ubuntu-latest
74 | steps:
75 | - name: Checkout
76 | uses: actions/checkout@v2
77 | with:
78 | submodules: recursive
79 | - name: Install dependencies
80 | run: |
81 | sudo apt-get update
82 | sudo apt-get install gcc-multilib g++-multilib # bits/libc-header-start.h, bits/c++config.h
83 | - name: Build
84 | run: make ARCH=x86 HAVE_CHD=1 -f Makefile.RAHasher
85 | - name: Zip
86 | if: startsWith(github.ref, 'refs/tags/')
87 | run: make ARCH=x86 HAVE_CHD=1 -f Makefile.RAHasher zip
88 | - name: Release
89 | uses: softprops/action-gh-release@v1
90 | if: startsWith(github.ref, 'refs/tags/')
91 | with:
92 | draft: true
93 | files: RAHasher*.zip
94 |
95 | RAHasher-linux-x64:
96 | runs-on: ubuntu-latest
97 | steps:
98 | - name: Checkout
99 | uses: actions/checkout@v2
100 | with:
101 | submodules: recursive
102 | - name: Install dependencies
103 | run: |
104 | sudo apt-get update
105 | sudo apt-get install gcc-multilib # bits/libc-header-start.h
106 | - name: Build
107 | run: make ARCH=x64 HAVE_CHD=1 -f Makefile.RAHasher
108 | - name: Zip
109 | if: startsWith(github.ref, 'refs/tags/')
110 | run: make ARCH=x64 HAVE_CHD=1 -f Makefile.RAHasher zip
111 | - name: Release
112 | uses: softprops/action-gh-release@v1
113 | if: startsWith(github.ref, 'refs/tags/')
114 | with:
115 | draft: true
116 | files: RAHasher*.zip
117 |
--------------------------------------------------------------------------------
/src/RAHasher.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {dbb91ad7-cb9c-4d0b-8000-4c52930b4044}
18 |
19 |
20 | {1e293426-6398-4c86-81b8-5e0004cc542d}
21 |
22 |
23 | {4ea653d5-1cc2-4ca4-b75e-4e5ec8fe3ecd}
24 |
25 |
26 | {be15c3d6-6a8d-418e-b432-31e7fc552895}
27 |
28 |
29 |
30 |
31 | Source Files
32 |
33 |
34 | Source Files\RALibRetro
35 |
36 |
37 | Source Files\miniz
38 |
39 |
40 | Source Files\miniz
41 |
42 |
43 | Source Files\miniz
44 |
45 |
46 | Source Files\miniz
47 |
48 |
49 | Source Files\RALibRetro
50 |
51 |
52 | Source Files\rhash
53 |
54 |
55 | Source Files\rhash
56 |
57 |
58 | Source Files\rhash
59 |
60 |
61 | Source Files\RALibRetro
62 |
63 |
64 | Source Files\RALibRetro
65 |
66 |
67 | Source Files\rhash
68 |
69 |
70 | Source Files\libmincrypt
71 |
72 |
73 | Source Files\rhash
74 |
75 |
76 | Source Files\rhash
77 |
78 |
79 | Source Files\rhash
80 |
81 |
82 | Source Files\rhash
83 |
84 |
85 |
86 |
87 | Source Files\rhash
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/speex/stack_alloc.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2002 Jean-Marc Valin */
2 | /**
3 | @file stack_alloc.h
4 | @brief Temporary memory allocation on stack
5 | */
6 | /*
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions
9 | are met:
10 |
11 | - Redistributions of source code must retain the above copyright
12 | notice, this list of conditions and the following disclaimer.
13 |
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 |
18 | - Neither the name of the Xiph.org Foundation nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | */
34 |
35 | #ifndef STACK_ALLOC_H
36 | #define STACK_ALLOC_H
37 |
38 | #ifdef USE_ALLOCA
39 | # ifdef WIN32
40 | # include
41 | # else
42 | # ifdef HAVE_ALLOCA_H
43 | # include
44 | # else
45 | # include
46 | # endif
47 | # endif
48 | #endif
49 |
50 | /**
51 | * @def ALIGN(stack, size)
52 | *
53 | * Aligns the stack to a 'size' boundary
54 | *
55 | * @param stack Stack
56 | * @param size New size boundary
57 | */
58 |
59 | /**
60 | * @def PUSH(stack, size, type)
61 | *
62 | * Allocates 'size' elements of type 'type' on the stack
63 | *
64 | * @param stack Stack
65 | * @param size Number of elements
66 | * @param type Type of element
67 | */
68 |
69 | /**
70 | * @def VARDECL(var)
71 | *
72 | * Declare variable on stack
73 | *
74 | * @param var Variable to declare
75 | */
76 |
77 | /**
78 | * @def ALLOC(var, size, type)
79 | *
80 | * Allocate 'size' elements of 'type' on stack
81 | *
82 | * @param var Name of variable to allocate
83 | * @param size Number of elements
84 | * @param type Type of element
85 | */
86 |
87 | #ifdef ENABLE_VALGRIND
88 |
89 | #include
90 |
91 | #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
92 |
93 | #define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
94 |
95 | #else
96 |
97 | #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
98 |
99 | #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
100 |
101 | #endif
102 |
103 | #if defined(VAR_ARRAYS)
104 | #define VARDECL(var)
105 | #define ALLOC(var, size, type) type var[size]
106 | #elif defined(USE_ALLOCA)
107 | #define VARDECL(var) var
108 | #define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
109 | #else
110 | #define VARDECL(var) var
111 | #define ALLOC(var, size, type) var = PUSH(stack, size, type)
112 | #endif
113 |
114 |
115 | #endif
116 |
--------------------------------------------------------------------------------
/Makefile.common:
--------------------------------------------------------------------------------
1 | # default parameter values
2 | ifeq ($(ARCH),)
3 | UNAME := $(shell uname -s)
4 | ifeq ($(findstring MINGW64, $(UNAME)), MINGW64)
5 | ARCH=x64
6 | else ifeq ($(findstring MINGW32, $(UNAME)), MINGW32)
7 | ARCH=x86
8 | else
9 | UNAME := $(shell uname -m)
10 | ifeq ($(UNAME), x86_64)
11 | ARCH=x64
12 | else ifeq ($(UNAME), aarch64)
13 | ARCH=arm64
14 | else
15 | ARCH=x86
16 | endif
17 | endif
18 | endif
19 |
20 | INCLUDES=-Isrc -I./src/miniz -I./src/rcheevos/include
21 | CFLAGS=-Wall $(INCLUDES)
22 | CXXFLAGS=$(CFLAGS) -std=c++11
23 | LDFLAGS=-static-libgcc -static-libstdc++
24 |
25 | ifeq ($(ARCH), x86)
26 | CFLAGS += -m32
27 | CXXFLAGS += -m32
28 | LDFLAGS += -m32
29 | OUTDIR=bin
30 | else ifeq ($(ARCH), x64)
31 | CFLAGS += -m64
32 | CXXFLAGS += -m64
33 | LDFLAGS += -m64
34 | OUTDIR=bin64
35 | else ifeq ($(ARCH), arm64)
36 | CFLAGS += -march=armv8-a
37 | CXXFLAGS += -march=armv8-a
38 | LDFLAGS += -march=armv8-a
39 | OUTDIR=bin64
40 | else
41 | $(error unknown ARCH "$(ARCH)")
42 | endif
43 |
44 | ifneq ($(DEBUG),)
45 | CFLAGS += -O0 -g
46 | CXXFLAGS += -O0 -g
47 | else
48 | CFLAGS += -O3 -DNDEBUG
49 | CXXFLAGS += -O3 -DNDEBUG
50 | endif
51 |
52 | ifdef HAVE_CHD
53 | CXXFLAGS += -DHAVE_CHD -I./src/libchdr/include
54 | CFLAGS += -DZ7_ST -DZSTD_DISABLE_ASM -I./src/libchdr/include -I./src/libchdr/deps/lzma-24.05/include -I./src/libchdr/deps/zlib-1.3.1 -I./src/libchdr/deps/zstd-1.5.6/lib
55 | CHD_OBJS = src/libchdr/deps/lzma-24.05/src/Alloc.o \
56 | src/libchdr/deps/lzma-24.05/src/Bra86.o \
57 | src/libchdr/deps/lzma-24.05/src/BraIA64.o \
58 | src/libchdr/deps/lzma-24.05/src/CpuArch.o \
59 | src/libchdr/deps/lzma-24.05/src/Delta.o \
60 | src/libchdr/deps/lzma-24.05/src/LzFind.o \
61 | src/libchdr/deps/lzma-24.05/src/Lzma86Dec.o \
62 | src/libchdr/deps/lzma-24.05/src/LzmaDec.o \
63 | src/libchdr/deps/lzma-24.05/src/LzmaEnc.o \
64 | src/libchdr/deps/lzma-24.05/src/Sort.o \
65 | src/libchdr/deps/zlib-1.3.1/adler32.o \
66 | src/libchdr/deps/zlib-1.3.1/compress.o \
67 | src/libchdr/deps/zlib-1.3.1/crc32.o \
68 | src/libchdr/deps/zlib-1.3.1/deflate.o \
69 | src/libchdr/deps/zlib-1.3.1/gzclose.o \
70 | src/libchdr/deps/zlib-1.3.1/gzlib.o \
71 | src/libchdr/deps/zlib-1.3.1/gzread.o \
72 | src/libchdr/deps/zlib-1.3.1/gzwrite.o \
73 | src/libchdr/deps/zlib-1.3.1/infback.o \
74 | src/libchdr/deps/zlib-1.3.1/inffast.o \
75 | src/libchdr/deps/zlib-1.3.1/inflate.o \
76 | src/libchdr/deps/zlib-1.3.1/inftrees.o \
77 | src/libchdr/deps/zlib-1.3.1/trees.o \
78 | src/libchdr/deps/zlib-1.3.1/uncompr.o \
79 | src/libchdr/deps/zlib-1.3.1/zutil.o \
80 | src/libchdr/deps/zstd-1.5.6/lib/common/debug.o \
81 | src/libchdr/deps/zstd-1.5.6/lib/common/entropy_common.o \
82 | src/libchdr/deps/zstd-1.5.6/lib/common/error_private.o \
83 | src/libchdr/deps/zstd-1.5.6/lib/common/fse_decompress.o \
84 | src/libchdr/deps/zstd-1.5.6/lib/common/pool.o \
85 | src/libchdr/deps/zstd-1.5.6/lib/common/threading.o \
86 | src/libchdr/deps/zstd-1.5.6/lib/common/xxhash.o \
87 | src/libchdr/deps/zstd-1.5.6/lib/common/zstd_common.o \
88 | src/libchdr/deps/zstd-1.5.6/lib/decompress/huf_decompress.o \
89 | src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_ddict.o \
90 | src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_decompress.o \
91 | src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_decompress_block.o \
92 | src/libchdr/src/libchdr_bitstream.o \
93 | src/libchdr/src/libchdr_cdrom.o \
94 | src/libchdr/src/libchdr_chd.o \
95 | src/libchdr/src/libchdr_flac.o \
96 | src/libchdr/src/libchdr_huffman.o
97 | endif
98 |
--------------------------------------------------------------------------------
/src/Util.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "components/Logger.h"
23 |
24 | #include
25 | #include
26 |
27 | // _WINDOWS says we're building _for_ Windows
28 | #ifdef _WINDOWS
29 | #define WIN32_LEAN_AND_MEAN
30 | #include
31 | #endif
32 |
33 | // _WIN32 says we're building _on_ Windows
34 | #ifdef _WIN32
35 | #define strcasecmp _stricmp
36 | #define strncasecmp _strnicmp
37 | #else
38 | #define sprintf_s sprintf
39 | #endif
40 |
41 | namespace util
42 | {
43 | time_t fileTime(const std::string& path);
44 | bool exists(const std::string& path);
45 |
46 | FILE* openFile(Logger* logger, const std::string& path, const char* mode);
47 | std::string loadFile(Logger* logger, const std::string& path);
48 | void* loadFile(Logger* logger, const std::string& path, size_t* size);
49 |
50 | #ifndef NO_MINIZ
51 | void* loadZippedFile(Logger* logger, const std::string& path, size_t* size, std::string& unzippedFileName);
52 | bool unzipFile(Logger* logger, const std::string& zipPath, const std::string& archiveFileName, const std::string& unzippedPath);
53 | #endif
54 |
55 | bool saveFile(Logger* logger, const std::string& path, const void* data, size_t size);
56 | void deleteFile(const std::string& path);
57 |
58 | #ifndef _CONSOLE
59 | bool downloadFile(Logger* logger, const std::string& url, const std::string& path);
60 | #endif
61 |
62 | std::string jsonEscape(const std::string& str);
63 | std::string jsonUnescape(const std::string& str);
64 |
65 | std::string fullPath(const std::string& path);
66 | std::string fileName(const std::string& path);
67 | std::string fileNameWithExtension(const std::string& path);
68 | std::string extension(const std::string& path);
69 | std::string replaceFileName(const std::string& originalPath, const char* newFileName);
70 | std::string sanitizeFileName(const std::string& fileName);
71 |
72 | std::string directory(const std::string& path);
73 |
74 | #ifdef _WINDOWS
75 | void ensureDirectoryExists(const std::string& path);
76 | #endif
77 |
78 | #ifdef _WINDOWS
79 | std::string openFileDialog(HWND hWnd, const std::string& extensionsFilter);
80 | std::string saveFileDialog(HWND hWnd, const std::string& extensionsFilter, const char* defaultExtension = NULL);
81 | #endif
82 |
83 | const void* toPng(Logger* logger, const void* data, unsigned width, unsigned height, unsigned pitch, enum retro_pixel_format format, int* len);
84 | const void* toRgb(Logger* logger, const void* data, unsigned width, unsigned height, unsigned pitch, enum retro_pixel_format format);
85 | void saveImage(Logger* logger, const std::string& path, const void* data, unsigned width, unsigned height, unsigned pitch, enum retro_pixel_format format);
86 | void* fromRgb(Logger* logger, const void* data, unsigned width, unsigned height, unsigned* pitch, enum retro_pixel_format format);
87 | void* fromPng(Logger* logger, const void* data, int len, unsigned* width, unsigned* height, unsigned* pitch);
88 | void* loadImage(Logger* logger, const std::string& path, unsigned* width, unsigned* height, unsigned* pitch);
89 |
90 | #ifdef _WINDOWS
91 | std::string ucharToUtf8(const std::wstring& unicodeString);
92 | std::wstring utf8ToUChar(const std::string& utf8String);
93 | #endif
94 | }
95 |
--------------------------------------------------------------------------------
/src/Gl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "libretro/Components.h"
4 |
5 | #include
6 |
7 | namespace Gl
8 | {
9 | void init(libretro::LoggerComponent* logger);
10 | bool ok();
11 |
12 | GLenum getError();
13 | const char* getErrorMsg(GLenum error);
14 | void getIntegerv(GLenum pname, GLint *params);
15 |
16 | void genTextures(GLsizei n, GLuint* textures);
17 | void deleteTextures(GLsizei n, const GLuint* textures);
18 | void bindTexture(GLenum target, GLuint texture);
19 | void activeTexture(GLenum texture);
20 | void texParameteri(GLenum target, GLenum pname, GLint param);
21 | void texImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data);
22 | void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
23 | void getTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* pixels);
24 | void pixelStorei(GLenum pname, GLint param);
25 |
26 | void genBuffers(GLsizei n, GLuint* buffers);
27 | void deleteBuffers(GLsizei n, const GLuint* buffers);
28 | void bindBuffer(GLenum target, GLuint buffer);
29 | void bufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
30 | void genVertexArray(GLsizei n, GLuint *arrays);
31 | void deleteVertexArrays(GLsizei n, const GLuint *arrays);
32 | void bindVertexArray(GLuint array);
33 | void vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
34 | void enableVertexAttribArray(GLuint index);
35 | void disableVertexAttribArray(GLuint index);
36 |
37 | GLuint createShader(GLenum shaderType);
38 | void deleteShader(GLuint shader);
39 | void shaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
40 | void compileShader(GLuint shader);
41 | void getShaderiv(GLuint shader, GLenum pname, GLint* params);
42 | void getShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog);
43 |
44 | GLuint createProgram();
45 | void deleteProgram(GLuint program);
46 | void attachShader(GLuint program, GLuint shader);
47 | void linkProgram(GLuint program);
48 | void validateProgram(GLuint program);
49 | void getProgramiv(GLuint program, GLenum pname, GLint* params);
50 | void getProgramInfoLog(GLuint program, GLsizei maxLength, GLsizei* length, GLchar* infoLog);
51 | void useProgram(GLuint program);
52 | GLint getAttribLocation(GLuint program, const GLchar* name);
53 | GLint getUniformLocation(GLuint program, const GLchar* name);
54 | void uniform1i(GLint location, GLint v0);
55 | void uniform2f(GLint location, GLfloat v0, GLfloat v1);
56 |
57 | void genFramebuffers(GLsizei n, GLuint* ids);
58 | void deleteFramebuffers(GLsizei n, GLuint* ids);
59 | void bindFramebuffer(GLenum target, GLuint framebuffer);
60 | void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
61 | void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
62 | void drawBuffers(GLsizei n, const GLenum* bufs);
63 | GLenum checkFramebufferStatus(GLenum target);
64 |
65 | void genRenderbuffers(GLsizei n, GLuint* renderbuffers);
66 | void deleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
67 | void bindRenderbuffer(GLenum target, GLuint renderbuffer);
68 | void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
69 |
70 | void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
71 | void clear(GLbitfield mask);
72 | void enable(GLenum cap);
73 | void disable(GLenum cap);
74 | void blendFunc(GLenum sfactor, GLenum dfactor);
75 | void blendEquation(GLenum mode);
76 | void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
77 | void drawArrays(GLenum mode, GLint first, GLsizei count);
78 |
79 | void bindSampler(GLuint unit, GLuint sampler);
80 |
81 | int getVersion();
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/KeyBinds.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Andre Leiradella
3 |
4 | This file is part of RALibretro.
5 |
6 | RALibretro is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | RALibretro is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with RALibretro. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "components/Logger.h"
23 |
24 | #include
25 |
26 | #include
27 | #include