Skip to content

Commit 40c6f01

Browse files
committed
Merge branch 'master' into main
2 parents 312fe76 + 41b0361 commit 40c6f01

File tree

677 files changed

+93033
-4907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

677 files changed

+93033
-4907
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A frontend for the SameBoy GameBoy emulator, with a focus on music creation. It runs standalone and can be used as an audio plugin (VST) in your favourite DAW!
33

44
## Features
5-
- Wraps [SameBoy](https://github.com/LIJI32/SameBoy) v0.14.3
5+
- Wraps [SameBoy](https://github.com/LIJI32/SameBoy) v0.15.7
66
- Full MIDI support for [mGB](https://github.com/trash80/mGB)
77
- Syncs [LSDj](https://www.littlesounddj.com) to your DAW
88
- Emulates various [Arduinoboy](https://github.com/trash80/Arduinoboy) modes

premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ project "RetroPlug"
9494

9595
configuration { "not emscripten" }
9696
prebuildcommands {
97-
"%{wks.location}/bin/x64/Release/ScriptCompiler ../../src/compiler.config.lua"
97+
"%{wks.location}/bin/%{cfg.platform}/Debug/ScriptCompiler ../../src/compiler.config.lua"
9898
}
9999

100100
filter { "system:windows", "files:src/retroplug/luawrapper/**" }

scripts/sameboy.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ project "SameBoyBootRoms"
4040
files { SAMEBOY_DIR .. "BootROMs/**.asm" }
4141

4242
prebuildcommands {
43-
'rgbgfx -h -u -o "%{cfg.objdir}/SameBoyLogo.2bpp" "' .. BOOTROM_DIR .. '/SameBoyLogo.png"',
43+
'rgbgfx -Z -u -c embedded -o "%{cfg.objdir}/SameBoyLogo.2bpp" "' .. BOOTROM_DIR .. '/SameBoyLogo.png"',
4444
'"%{cfg.buildtarget.directory}/pb12" < "%{cfg.objdir}/SameBoyLogo.2bpp" > "%{cfg.objdir}/SameBoyLogo.pb12"'
4545
}
4646

@@ -57,12 +57,32 @@ project "SameBoyBootRoms"
5757

5858
end
5959

60+
local function getVersion()
61+
local file = io.open("../thirdparty/SameBoy/version.mk", "r")
62+
if file == nil then
63+
error("Failed to detect SameBoy version: version.mk could not be opened")
64+
end
65+
66+
local version = file:read()
67+
local st, en = version:find(":= ")
68+
69+
if st == nil then
70+
error("Failed to detect SameBoy version: version.mk contains invalid data")
71+
end
72+
73+
version = version:sub(en + 1)
74+
75+
file:close()
76+
77+
return version
78+
end
79+
6080
project "SameBoy"
6181
kind "StaticLib"
6282
language "C"
6383
toolset "clang"
6484

65-
defines { "GB_INTERNAL", "GB_DISABLE_TIMEKEEPING" }
85+
defines { "GB_INTERNAL", "GB_DISABLE_TIMEKEEPING", [[GB_VERSION="]] .. getVersion() .. [["]] }
6686

6787
sysincludedirs {
6888
SAMEBOY_DIR .. "Core",

src/plugs/SameBoyPlug.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
#include <fstream>
44
#include <xxhash.h>
55

6-
extern "C" {
7-
#include <gb.h>
8-
}
9-
106
#include "retroplug/Constants.h"
117
#include "retroplug/util/SampleConverter.h"
128
#include "generated/bootroms/agb_boot.h"
@@ -16,6 +12,10 @@ extern "C" {
1612
#include "generated/bootroms/sgb_boot.h"
1713
#include "generated/bootroms/sgb2_boot.h"
1814

15+
extern "C" {
16+
#include <gb.h>
17+
}
18+
1919
const size_t LINK_TICKS_MAX = 3907;
2020

2121
const size_t MAX_SERIAL_ITEMS = 128;
@@ -83,7 +83,7 @@ static uint32_t rgbEncode(GB_gameboy_t* gb, uint8_t r, uint8_t g, uint8_t b) {
8383
return 255 << 24 | b << 16 | g << 8 | r;
8484
}
8585

86-
static void vblankHandler(GB_gameboy_t* gb) {
86+
static void vblankHandler(GB_gameboy_t* gb, GB_vblank_type_t type) {
8787
SameBoyPlugState* state = (SameBoyPlugState*)GB_get_user_data(gb);
8888
state->vblankOccurred = true;
8989
}
@@ -136,7 +136,7 @@ void SameBoyPlug::init(GameboyModel model) {
136136
GB_set_serial_transfer_bit_start_callback(_state.gb, serialStart);
137137
GB_set_serial_transfer_bit_end_callback(_state.gb, serialEnd);
138138

139-
GB_set_color_correction_mode(_state.gb, GB_COLOR_CORRECTION_EMULATE_HARDWARE);
139+
GB_set_color_correction_mode(_state.gb, GB_COLOR_CORRECTION_MODERN_BALANCED);
140140
GB_set_highpass_filter_mode(_state.gb, GB_HIGHPASS_ACCURATE);
141141

142142
GB_set_rendering_disabled(_state.gb, true);

src/plugs/SameBoyPlug.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
#include <vector>
44
#include <queue>
5-
#include <gb_struct_def.h>
65

76
#include "retroplug/Messages.h"
87

8+
struct GB_gameboy_s;
9+
typedef struct GB_gameboy_s GB_gameboy_t;
10+
911
const size_t PIXEL_WIDTH = 160;
1012
const size_t PIXEL_HEIGHT = 144;
1113
const size_t PIXEL_COUNT = (PIXEL_WIDTH * PIXEL_HEIGHT);

src/retroplug/luawrapper/UiLuaContext.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
#include "platform/Logger.h"
1919
#include "Wrappers.h"
2020

21-
//#ifdef COMPILE_LUA_SCRIPTS
21+
#ifdef COMPILE_LUA_SCRIPTS
2222
#include "generated/CompiledScripts.h"
23-
//#endif
23+
#endif
24+
25+
//#define DEBUG_SCRIPTS
2426

2527
void UiLuaContext::init(AudioContextProxy* proxy, const std::string& path, const std::string& scriptPath) {
2628
_configPath = path;
@@ -47,7 +49,7 @@ bool UiLuaContext::onKey(VirtualKey key, bool down) {
4749
return res;
4850
}
4951

50-
return false;
52+
return false;
5153
}
5254

5355
void UiLuaContext::onDoubleClick(float x, float y, MouseMod mod) {
@@ -91,14 +93,14 @@ void UiLuaContext::reload() {
9193
if (_valid) {
9294
callFunc(_viewRoot, "onReloadBegin");
9395
}
94-
96+
9597
shutdown();
9698
setup(false);
9799

98100
if (_valid) {
99101
callFunc(_viewRoot, "onReloadEnd");
100102
}
101-
103+
102104
_haltFrameProcessing = !_valid;
103105
}
104106

@@ -141,13 +143,13 @@ bool UiLuaContext::setup(bool updateProject) {
141143
_state = new sol::state();
142144
sol::state& s = *_state;
143145

144-
s.open_libraries( sol::lib::base, sol::lib::package, sol::lib::table, sol::lib::string,
146+
s.open_libraries( sol::lib::base, sol::lib::package, sol::lib::table, sol::lib::string,
145147
sol::lib::math, sol::lib::debug, sol::lib::coroutine, sol::lib::io );
146148

147149
std::string packagePath = s["package"]["path"];
148150
packagePath += ";" + _configPath + "/?.lua";
149151

150-
#ifdef COMPILE_LUA_SCRIPTS
152+
#ifndef DEBUG_SCRIPTS
151153
spdlog::info("Using precompiled lua scripts");
152154
s.add_package_loader(CompiledScripts::common::loader);
153155
s.add_package_loader(CompiledScripts::ui::loader);
@@ -158,7 +160,7 @@ bool UiLuaContext::setup(bool updateProject) {
158160
#endif
159161

160162
s["package"]["path"] = packagePath;
161-
163+
162164
luawrappers::registerCommon(s);
163165
luawrappers::registerChrono(s);
164166
luawrappers::registerLsdj(s);
@@ -191,7 +193,7 @@ bool UiLuaContext::setup(bool updateProject) {
191193
);
192194

193195
// TODO: Fix naming of this too!
194-
s.create_named_table("nativeutil",
196+
s.create_named_table("nativeutil",
195197
"mergeMenu", mergeMenu
196198
);
197199

@@ -223,7 +225,7 @@ bool UiLuaContext::setup(bool updateProject) {
223225
}
224226

225227
// Load the users config settings
226-
// TODO: This should probably happen outside of this class since it may be used by the
228+
// TODO: This should probably happen outside of this class since it may be used by the
227229
// audio lua context too.
228230
std::string configPath = _configPath + "/config.lua";
229231
bool configValid = false;

src/retroplug/model/ProcessingContext.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ void ProcessingContext::process(float** outputs, size_t frameCount) {
174174
} else {
175175
linkedPlugs[linkedPlugCount++] = plug;
176176
}
177+
178+
plug->pressButtons(_buttonPresses[i].data().presses.data(), _buttonPresses[i].getCount());
179+
_buttonPresses[i].clear();
177180

178181
totalPlugCount++;
179182
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Always use LF line endings for shaders
2+
*.fsh text eol=lf
3+
*.metal text eol=lf
4+
5+
HexFiend/* linguist-vendored
6+
*.inc linguist-language=C
7+
Core/*.h linguist-language=C
8+
SDL/*.h linguist-language=C
9+
Windows/*.h linguist-language=C
10+
Cocoa/*.h linguist-language=Objective-C
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: LIJI32
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Blargg's Test ROMs by Shay Green <[email protected]>
2+
3+
Acid2 tests by Matt Currie under MIT:
4+
5+
MIT License
6+
7+
Copyright (c) 2020 Matt Currie
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE.

0 commit comments

Comments
 (0)