commit 59f06d67f88655b151fcc8d48bda1484fedbd714
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Mon Jan 15 12:10:09 2024 -0700
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Mon Jan 15 12:10:09 2024 -0700
WIP- Fix lots of build errors
---
platform/3ds/source/3dsHost.cpp | 2 +-
platform/bittboy/source/BittBoyHost.cpp | 2 +-
platform/funkey-s/source/FunkeyHost.cpp | 2 +-
platform/gcw0/source/ODHost.cpp | 2 +-
platform/libretro/libretrohost.cpp | 2 +-
platform/miyoomini/source/MiyooMiniHost.cpp | 2 +-
platform/switch/source/SwitchHost.cpp | 2 +-
platform/vita/source/VitaHost.cpp | 2 +-
platform/wiiu/source/WiiUHost.cpp | 2 +-
platform/windows/source/WindowsHost.cpp | 2 +-
source/fontdata.h | 1 +
source/nibblehelpers.h | 1 +
source/stringToDataHelpers.h | 1 +
source/vm.cpp | 171 +---------------------------
test/cartloadingtest.cpp | 2 +-
test/endtoendtests.cpp | 102 ++++++++---------
test/fontdatatests.cpp | 1 +
test/stubhost.cpp | 2 +-
test/vmtests.cpp | 8 +-
19 files changed, 73 insertions(+), 236 deletions(-)
diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index d014bc1..9194baa 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -266,7 +266,7 @@ void audioSetup(){
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
_logFilePrefix = "sdmc:/3ds/fake08/";
_cartDirectory = "/p8carts";
diff --git a/platform/bittboy/source/BittBoyHost.cpp b/platform/bittboy/source/BittBoyHost.cpp
index 9edc195..7dc654c 100644
--- a/platform/bittboy/source/BittBoyHost.cpp
+++ b/platform/bittboy/source/BittBoyHost.cpp
@@ -172,7 +172,7 @@ void _changeStretch(StretchOption newStretch){
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
#ifdef _BITTBOY
_cartDirectory = "/mnt/roms/PICO-8";
_logFilePrefix = "/mnt/emus/pico8/";
diff --git a/platform/funkey-s/source/FunkeyHost.cpp b/platform/funkey-s/source/FunkeyHost.cpp
index 618943d..ee465fa 100644
--- a/platform/funkey-s/source/FunkeyHost.cpp
+++ b/platform/funkey-s/source/FunkeyHost.cpp
@@ -93,7 +93,7 @@ void audioSetup(){
}
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
#ifdef _BITTBOY
_cartDirectory = "/mnt/roms/PICO-8";
#else
diff --git a/platform/gcw0/source/ODHost.cpp b/platform/gcw0/source/ODHost.cpp
index f064c82..4a4d1e7 100644
--- a/platform/gcw0/source/ODHost.cpp
+++ b/platform/gcw0/source/ODHost.cpp
@@ -191,7 +191,7 @@ void _changeStretch(StretchOption newStretch){
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
#ifdef _GCW0
_cartDirectory = "/media/sdcard/roms/PICO8";
_logFilePrefix = "/media/sdcard/roms/PICO8/";
diff --git a/platform/libretro/libretrohost.cpp b/platform/libretro/libretrohost.cpp
index 3a0dd6e..06a325a 100644
--- a/platform/libretro/libretrohost.cpp
+++ b/platform/libretro/libretrohost.cpp
@@ -40,7 +40,7 @@ void setCartDirectory(std::string dir) {
-Host::Host() { }
+Host::Host(int windowWidth, int windowHeight) { }
void Host::oneTimeSetup(Audio* audio){
diff --git a/platform/miyoomini/source/MiyooMiniHost.cpp b/platform/miyoomini/source/MiyooMiniHost.cpp
index 372f368..9f6d337 100644
--- a/platform/miyoomini/source/MiyooMiniHost.cpp
+++ b/platform/miyoomini/source/MiyooMiniHost.cpp
@@ -211,7 +211,7 @@ void _changeStretch(StretchOption newStretch){
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
#ifdef _DESKTOP
std::string home = getenv("HOME");
diff --git a/platform/switch/source/SwitchHost.cpp b/platform/switch/source/SwitchHost.cpp
index 9b050e8..c104d2b 100644
--- a/platform/switch/source/SwitchHost.cpp
+++ b/platform/switch/source/SwitchHost.cpp
@@ -79,7 +79,7 @@ uint8_t ConvertInputToP8(u64 input){
return result;
}
-Host::Host()
+Host::Host(int windowWidth, int windowHeight)
{
struct stat st = {0};
diff --git a/platform/vita/source/VitaHost.cpp b/platform/vita/source/VitaHost.cpp
index 50c6b08..913d3f8 100644
--- a/platform/vita/source/VitaHost.cpp
+++ b/platform/vita/source/VitaHost.cpp
@@ -67,7 +67,7 @@ string _desktopSdl2customBiosLua = "cartpath = \"ux0:/p8carts/\"\n"
"pausebtn = \"start\"";
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
//make sure directories exists
sceIoMkdir("ux0:/data/", 0777);
sceIoMkdir("ux0:/data/fake08/", 0777);
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index e6948b3..294ea6b 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -171,7 +171,7 @@ void _changeStretch(StretchOption newStretch){
flip = SDL_FLIP_NONE;
}
-Host::Host() {
+Host::Host(int windowWidth, int windowHeight) {
struct stat st = {0};
int res = chdir("fs:/vol/external01");
diff --git a/platform/windows/source/WindowsHost.cpp b/platform/windows/source/WindowsHost.cpp
index 703d516..003491a 100644
--- a/platform/windows/source/WindowsHost.cpp
+++ b/platform/windows/source/WindowsHost.cpp
@@ -51,7 +51,7 @@ string _desktopSdl2customBiosLua = "cartpath = \"AppData\"\n"
-Host::Host()
+Host::Host(int windowWidth, int windowHeight)
{
struct stat st = {0};
diff --git a/source/fontdata.h b/source/fontdata.h
index f2cd4b2..403ca9b 100644
--- a/source/fontdata.h
+++ b/source/fontdata.h
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <cstdint>
std::string get_font_data();
diff --git a/source/nibblehelpers.h b/source/nibblehelpers.h
index 8ff137a..289ae39 100644
--- a/source/nibblehelpers.h
+++ b/source/nibblehelpers.h
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <cstdint>
//for 1 byte (8 bit) indexes, 128x64
//should be the equivalent of return y * 64 + (x / 2);
diff --git a/source/stringToDataHelpers.h b/source/stringToDataHelpers.h
index dfa8336..1268b31 100644
--- a/source/stringToDataHelpers.h
+++ b/source/stringToDataHelpers.h
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <cstdint>
void copy_string_to_sprite_memory(uint8_t sprite_data[128 * 64], std::string data);
diff --git a/source/vm.cpp b/source/vm.cpp
index aa5fcdc..4c8176c 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -203,7 +203,6 @@ bool Vm::Initialize() {
//stubbed in graphics:
lua_register(_luaState, "fillp", fillp);
- //lua_register(_luaState, "flip", flip);
//input
lua_register(_luaState, "btn", btn);
@@ -328,144 +327,6 @@ bool Vm::loadCart(Cart* cart) {
_cartChangeQueued = false;
abortLua = false;
- // initialize Lua interpreter
- _luaState = luaL_newstate();
-
- lua_setpico8memory(_luaState, (uint8_t *)&_memory->data);
- // load Lua base libraries (print / math / etc)
- luaL_openlibs(_luaState);
- lua_pushglobaltable(_luaState);
-
- //system
- //must be registered before loading globals for pause menu to work
- lua_register(_luaState, "__listcarts", listcarts);
- lua_register(_luaState, "__getbioserror", getbioserror);
- lua_register(_luaState, "__loaddefaultcart", loaddefaultcart);
- lua_register(_luaState, "__loadsettingscart", loadsettingscart);
- lua_register(_luaState, "__togglepausemenu", togglepausemenu);
- lua_register(_luaState, "__resetcart", resetcart);
- //lua_register(_luaState, "load", load);
-
- //settings
- lua_register(_luaState, "__getsetting", getsetting);
- lua_register(_luaState, "__setsetting", setsetting);
-
- lua_register(_luaState, "__installpackins", installpackins);
-
- //label
- lua_register(_luaState, "__loadlabel", loadlabel);
-
- lua_register(_luaState, "__getlualine", getlualine);
-
- //register global functions first, they will get local aliases when
- //the rest of the api is registered
- //graphics
- lua_register(_luaState, "cls", cls);
- lua_register(_luaState, "pset", pset);
- lua_register(_luaState, "pget", pget);
- lua_register(_luaState, "color", color);
- lua_register(_luaState, "line", line);
- lua_register(_luaState, "tline", tline);
- lua_register(_luaState, "circ", circ);
- lua_register(_luaState, "circfill", circfill);
- lua_register(_luaState, "oval", oval);
- lua_register(_luaState, "ovalfill", ovalfill);
- lua_register(_luaState, "rect", rect);
- lua_register(_luaState, "rectfill", rectfill);
- lua_register(_luaState, "print", print);
- lua_register(_luaState, "cursor", cursor);
- lua_register(_luaState, "spr", spr);
- lua_register(_luaState, "sspr", sspr);
- lua_register(_luaState, "fget", fget);
- lua_register(_luaState, "fset", fset);
- lua_register(_luaState, "sget", sget);
- lua_register(_luaState, "sset", sset);
- lua_register(_luaState, "camera", camera);
- lua_register(_luaState, "clip", clip);
-
- lua_register(_luaState, "pal", pal);
- lua_register(_luaState, "palt", palt);
-
- lua_register(_luaState, "mget", mget);
- lua_register(_luaState, "mset", mset);
- lua_register(_luaState, "map", gfx_map);
- lua_register(_luaState, "mapdraw", gfx_map);
-
- //stubbed in graphics:
- lua_register(_luaState, "fillp", fillp);
- //lua_register(_luaState, "flip", flip);
-
- //input
- lua_register(_luaState, "btn", btn);
- lua_register(_luaState, "btnp", btnp);
-
- lua_register(_luaState, "time", time);
- lua_register(_luaState, "t", time);
-
- //audio:
- lua_register(_luaState, "music", music);
- lua_register(_luaState, "sfx", sfx);
-
- //memory
- lua_register(_luaState, "cstore", cstore);
- lua_register(_luaState, "memcpy", api_memcpy);
- lua_register(_luaState, "memset", api_memset);
- lua_register(_luaState, "peek", peek);
- lua_register(_luaState, "poke", poke);
- lua_register(_luaState, "peek2", peek2);
- lua_register(_luaState, "poke2", poke2);
- lua_register(_luaState, "peek4", peek4);
- lua_register(_luaState, "poke4", poke4);
- lua_register(_luaState, "reload", reload);
- lua_register(_luaState, "reset", reset);
-
- //cart data
- lua_register(_luaState, "cartdata", cartdata);
- lua_register(_luaState, "dget", dget);
- lua_register(_luaState, "dset", dset);
-
- //
- lua_register(_luaState, "printh", printh);
- lua_register(_luaState, "stat", stat);
- lua_register(_luaState, "_update_buttons", _update_buttons);
- lua_register(_luaState, "run", run);
- lua_register(_luaState, "extcmd", extcmd);
- lua_register(_luaState, "_set_fps", setFps);
-
- //rng
- lua_register(_luaState, "rnd", rnd);
- lua_register(_luaState, "srand", srand);
-
- //load in global lua fuctions for pico 8- part of this is setting a local variable
- //with the same name as all the globals we just registered
- //auto convertedGlobalLuaFunctions = convert_emojis(p8GlobalLuaFunctions);
- auto convertedGlobalLuaFunctions = charset::utf8_to_pico8(p8Bios);
- int loadedGlobals = luaL_dostring(_luaState, convertedGlobalLuaFunctions.c_str());
-
- if (loadedGlobals != LUA_OK) {
- _cartLoadError = "ERROR loading pico 8 lua globals";
- Logger_Write("ERROR loading pico 8 lua globals\n");
- Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
- lua_pop(_luaState, 1);
-
- return false;
- }
-
- // Push the eris.init_persist_all function on the top of the lua stack (or nil if it doesn't exist)
- // we call this function to establish the default global state of things not to save in the save state
- // needs to be called after globals are loaded but before the cart is run, or _init is called
- //TODO: move these calls to the glue code?
- lua_getglobal(_luaState, "eris");
- lua_getfield(_luaState, -1, "init_persist_all");
-
- if (lua_pcall(_luaState, 0, 0, 0)){
- Logger_Write("Error setting up lua persistence: %s\n", lua_tostring(_luaState, -1));
- lua_pop(_luaState, 1);
- return false;
- }
-
- //pop the eris.init_persist_all fuction off the stack now that we're done with it
- lua_pop(_luaState, 1);
//need to add game loop to the bottom of the cart code
const char* gameLoop = R"#(
@@ -533,34 +394,6 @@ end
#endif
- // Push the _init function on the top of the lua stack (or nil if it doesn't exist)
- // lua_getglobal(_luaState, "_init");
-
- // if (lua_isfunction(_luaState, -1)) {
- // if (lua_pcall(_luaState, 0, 0, 0)){
- // _cartLoadError = lua_tostring(_luaState, -1);
- // Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
- // lua_pop(_luaState, 1);
- // QueueCartChange(BiosCartName);
- // return false;
- // }
- // }
-
- // //pop the _init fuction off the stack now that we're done with it
- // lua_pop(_luaState, 0);
-
-
-
- //check for update, mark correct target fps
- // lua_getglobal(_luaState, "_update60");
- // if (lua_isfunction(_luaState, -1)) {
- // _targetFps = 60;
- // }
- // else {
- // _targetFps = 30;
- // }
- // lua_pop(_luaState, 0);
-
//customize bios per host's requirements
if (cart->FullCartPath == DefaultCartName || cart->FullCartPath == SettingsCartName) {
@@ -920,9 +753,9 @@ void Vm::GameLoop() {
//is this better at the end of the loop?
//_host->waitForTargetFps();
- //if (_host->shouldQuit()) break; // break in order to return to hbmenu
+ if (_host->shouldQuit()) break; // break in order to return to hbmenu
//this should probably be handled just in the host class
- //_host->changeStretch();
+ _host->changeStretch();
//update buttons needs to be callable from the cart, and also flip
//it should update call the pico part of scanInput and set the values in memory
diff --git a/test/cartloadingtest.cpp b/test/cartloadingtest.cpp
index 94ac523..05645d0 100644
--- a/test/cartloadingtest.cpp
+++ b/test/cartloadingtest.cpp
@@ -529,7 +529,7 @@ string checkCart(Vm* vm, string cartDirectory, string cart){
}
else
{
- vm->UpdateAndDraw();
+ vm->Step();
if (vm->GetBiosError() != "") {
vm->GetBiosError();
diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp
index 6ec850e..a4ec9d4 100644
--- a/test/endtoendtests.cpp
+++ b/test/endtoendtests.cpp
@@ -117,7 +117,7 @@ TEST_CASE("Loading and running carts") {
}
if (getFileExtension(cartfile) == ".p8") {
SUBCASE(cartfile.c_str()){
- vm->UpdateAndDraw();
+ vm->Step();
std::stringstream ss;
ss << "carts/screenshots/" << screenshot;
@@ -137,10 +137,10 @@ TEST_CASE("Loading and running carts") {
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
}
- SUBCASE("Frame count updated with each UpdateAndDrawCall()"){
- vm->UpdateAndDraw();
- vm->UpdateAndDraw();
- vm->UpdateAndDraw();
+ SUBCASE("Frame count updated with each Step() Call"){
+ vm->Step();
+ vm->Step();
+ vm->Step();
CHECK(vm->GetFrameCount() == 3);
}
@@ -163,7 +163,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/pset00-test_f01.png"));
}
@@ -177,7 +177,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/pset3pix_f01.png"));
}
@@ -191,7 +191,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/psetall_f01.png"));
}
@@ -205,7 +205,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/cliptest_f01.png"));
}
@@ -219,7 +219,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/memorytest_f01.png"));
}
@@ -233,7 +233,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/cartdatatest_f01.png"));
}
@@ -244,7 +244,7 @@ TEST_CASE("Loading and running carts") {
vm->LoadCart("tonumtest2.p8", false);
SUBCASE("can parse positive int"){
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r1test()\n"
@@ -255,7 +255,7 @@ TEST_CASE("Loading and running carts") {
CHECK(parsedCorrectly);
}
SUBCASE("can parse negative decimal") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r2test()\n"
@@ -266,7 +266,7 @@ TEST_CASE("Loading and running carts") {
CHECK(parsedCorrectly);
}
SUBCASE("can parse hex") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r3test()\n"
@@ -278,7 +278,7 @@ TEST_CASE("Loading and running carts") {
}
SUBCASE("can parse binary literal") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r5test()\n"
@@ -289,7 +289,7 @@ TEST_CASE("Loading and running carts") {
CHECK(parsedCorrectly);
}
SUBCASE("can parse large positive number") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r6test()\n"
@@ -300,7 +300,7 @@ TEST_CASE("Loading and running carts") {
CHECK(parsedCorrectly);
}
SUBCASE("unparseable string returns nil") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r8test()\n"
@@ -313,7 +313,7 @@ TEST_CASE("Loading and running carts") {
//currently failing
SUBCASE("can parse hex with decimal") {
- vm->UpdateAndDraw();
+ vm->Step();
bool parsedCorrectly = vm->ExecuteLua(
"function r4test()\n"
@@ -325,7 +325,7 @@ TEST_CASE("Loading and running carts") {
CHECK(parsedCorrectly);
}
//SUBCASE("too large int overflows") {
- // vm->UpdateAndDraw();
+ // vm->Step();
// bool parsedCorrectly = vm->ExecuteLua(
// "function r7test()\n"
@@ -345,7 +345,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("addition works"){
- vm->UpdateAndDraw();
+ vm->Step();
bool additionWorks = vm->ExecuteLua(
"function additiontest()\n"
@@ -356,7 +356,7 @@ TEST_CASE("Loading and running carts") {
CHECK(additionWorks);
}
SUBCASE("multiplication works"){
- vm->UpdateAndDraw();
+ vm->Step();
bool multiplicationWorks = vm->ExecuteLua(
"function multiplicationtest()\n"
@@ -367,7 +367,7 @@ TEST_CASE("Loading and running carts") {
CHECK(multiplicationWorks);
}
SUBCASE("division works"){
- vm->UpdateAndDraw();
+ vm->Step();
bool divisionWorks = vm->ExecuteLua(
"function divisiontest()\n"
@@ -378,7 +378,7 @@ TEST_CASE("Loading and running carts") {
CHECK(divisionWorks);
}
SUBCASE("subtraction works"){
- vm->UpdateAndDraw();
+ vm->Step();
bool subtractionWorks = vm->ExecuteLua(
"function subtractiontest()\n"
@@ -389,7 +389,7 @@ TEST_CASE("Loading and running carts") {
CHECK(subtractionWorks);
}
SUBCASE("rnd returns between 0 and 1, and can add"){
- vm->UpdateAndDraw();
+ vm->Step();
bool rndWorks = vm->ExecuteLua(
"function rndtest()\n"
@@ -400,7 +400,7 @@ TEST_CASE("Loading and running carts") {
CHECK(rndWorks);
}
SUBCASE("rnd returns between 0 and 1 without calling srand first"){
- vm->UpdateAndDraw();
+ vm->Step();
bool rndWorks = vm->ExecuteLua(
"function firstrndtest()\n"
@@ -411,7 +411,7 @@ TEST_CASE("Loading and running carts") {
CHECK(rndWorks);
}
SUBCASE("# returns count of array"){
- vm->UpdateAndDraw();
+ vm->Step();
bool rndWorks = vm->ExecuteLua(
"function counttest()\n"
@@ -422,7 +422,7 @@ TEST_CASE("Loading and running carts") {
CHECK(rndWorks);
}
SUBCASE("ceil works"){
- vm->UpdateAndDraw();
+ vm->Step();
bool ceilWorks = vm->ExecuteLua(
"function ceiltest()\n"
@@ -491,7 +491,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/fillptest_f01.png"));
}
@@ -506,8 +506,8 @@ TEST_CASE("Loading and running carts") {
}
SUBCASE("sceen matches screenshot"){
//first frame doesn't have uniform colors
- vm->UpdateAndDraw();
- vm->UpdateAndDraw();
+ vm->Step();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/peek4test_f02.png"));
}
@@ -521,7 +521,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/paltabletest_f01.png"));
}
@@ -535,7 +535,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/nilpairstest_f01.png"));
}
@@ -549,7 +549,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/splittest_f01.png"));
}
@@ -591,7 +591,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/includetest_f01.png"));
}
@@ -605,7 +605,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/subtest_f01.png"));
}
@@ -619,7 +619,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/peek_poke_extraargs_f01.png"));
}
@@ -633,7 +633,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/tline_test_f01.png"));
}
@@ -647,7 +647,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/short_print_test_f01.png"));
}
@@ -661,7 +661,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/pal_args_test_f01.png"));
}
@@ -675,7 +675,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/loop_max_val_f01.png"));
}
@@ -689,7 +689,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/peek_high_addr_f01.png"));
}
@@ -703,7 +703,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/ord_multiple_f01.png"));
}
@@ -717,7 +717,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/e_next_to_digit_f01.png"));
}
@@ -731,7 +731,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/one_off_chars_f01.png"));
}
@@ -745,7 +745,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/print_mem_poke_f01.png"));
}
@@ -756,7 +756,7 @@ TEST_CASE("Loading and running carts") {
vm->LoadCart("print_scroll_test.p8");
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/print_scroll_test_f01.png"));
}
@@ -769,7 +769,7 @@ TEST_CASE("Loading and running carts") {
vm->LoadCart("ppwr-big-digit-test.p8");
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/ppwr-big-digit-test_f01.png"));
}
@@ -783,7 +783,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/split_noargs_test_f01.png"));
}
@@ -797,7 +797,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/str_index_sub_test_f01.png"));
}
@@ -811,7 +811,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/count_val_test_f01.png"));
}
@@ -825,7 +825,7 @@ TEST_CASE("Loading and running carts") {
CHECK(vm->GetBiosError() == "");
}
SUBCASE("sceen matches screenshot"){
- vm->UpdateAndDraw();
+ vm->Step();
CHECK(verifyScreenshot(vm, host, "carts/screenshots/boldtexttest_f01.png"));
}
diff --git a/test/fontdatatests.cpp b/test/fontdatatests.cpp
index 33baedd..32f6721 100644
--- a/test/fontdatatests.cpp
+++ b/test/fontdatatests.cpp
@@ -1,4 +1,5 @@
#include "doctest.h"
+#include <cstdint>
#include "../source/fontdata.h"
#include "../source/stringToDataHelpers.h"
diff --git a/test/stubhost.cpp b/test/stubhost.cpp
index 56f3b07..024a3ee 100644
--- a/test/stubhost.cpp
+++ b/test/stubhost.cpp
@@ -21,7 +21,7 @@ static std::string stubCurrKBkey = "";
-Host::Host() { }
+Host::Host(int windowWidth, int windowHeight) { }
StubHost::StubHost() { }
diff --git a/test/vmtests.cpp b/test/vmtests.cpp
index 0c3230e..5b45019 100644
--- a/test/vmtests.cpp
+++ b/test/vmtests.cpp
@@ -428,7 +428,7 @@ TEST_CASE("Vm memory functions") {
vm->LoadCart("drillerinputtest.p8");
SUBCASE("no buttons gives 0"){
- vm->UpdateAndDraw();
+ vm->Step();
bool btnbits = vm->ExecuteLua(
"function btnbitstest0()\n"
" return btnbits == 0\n"
@@ -439,7 +439,7 @@ TEST_CASE("Vm memory functions") {
}
SUBCASE("left pushed returns 1"){
stubHost->stubInput(1, 1);
- vm->UpdateAndDraw();
+ vm->Step();
bool btnbits = vm->ExecuteLua(
"function btnbitstest1()\n"
" return btnbits == 1\n"
@@ -450,7 +450,7 @@ TEST_CASE("Vm memory functions") {
}
SUBCASE("right pushed returns 2"){
stubHost->stubInput(2, 2);
- vm->UpdateAndDraw();
+ vm->Step();
bool btnbits = vm->ExecuteLua(
"function btnbitstest2()\n"
" return btnbits == 2\n"
@@ -461,7 +461,7 @@ TEST_CASE("Vm memory functions") {
}
SUBCASE("right pushed detected by band op"){
stubHost->stubInput(2, 2);
- vm->UpdateAndDraw();
+ vm->Step();
bool btnbits = vm->ExecuteLua(
"function rightbandtest()\n"
" return rightband == 2\n"