commit 7008fefc4abe0752f4abb11fc6a67c0bc25556d2
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sat Feb 20 12:41:24 2021 -0700
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Fri Feb 26 18:59:40 2021 -0700
Compile with c++11 instead of 17
This is really only to make porting to other platforms easier. This is
not tested very well yet
---
platform/3ds/Makefile | 2 +-
platform/3ds/source/3dsHost.cpp | 16 +++++-------
platform/SDL2/Makefile | 2 +-
platform/switch/Makefile | 2 +-
platform/switch/source/SwitchHost.cpp | 15 +++++------
source/Audio.cpp | 23 +++++++++++++---
source/cart.cpp | 28 ++++++++++----------
source/graphics.cpp | 8 +++---
source/logger.cpp | 24 +++++++----------
source/logger.h | 26 +++++--------------
source/main.cpp | 16 ++++++------
source/mathhelpers.cpp | 12 +++++++++
source/mathhelpers.h | 6 +++++
source/synth.cpp | 3 ++-
source/tests/test_base.cpp | 12 ++++-----
source/vm.cpp | 49 +++++++++++++++++------------------
test/Makefile | 10 ++++---
test/nooplogger.cpp | 10 +++----
18 files changed, 137 insertions(+), 127 deletions(-)
diff --git a/platform/3ds/Makefile b/platform/3ds/Makefile
index 374e89d..6fae34e 100644
--- a/platform/3ds/Makefile
+++ b/platform/3ds/Makefile
@@ -61,7 +61,7 @@ CFLAGS := -g -Wall -O2 -mword-relocations \
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
-CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++17
+CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 0b80e16..cb090ce 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -7,9 +7,7 @@
#include <fstream>
#include <iostream>
-#include <filesystem>
using namespace std;
-namespace fs = std::filesystem;
#include "../../../source/host.h"
@@ -400,18 +398,16 @@ vector<string> Host::listcarts(){
chdir("sdmc:/");
DIR* dir = opendir("/p8carts");
+ struct dirent *ent;
+ std::string fullCartDir = "/p8carts/";
if (dir) {
- for(auto& p: fs::directory_iterator("/p8carts")){
- auto ext = p.path().extension().string();
- if (ext == ".p8" || ext == ".png"){
- carts.push_back(p.path().string());
- }
+ /* print all the files and directories within directory */
+ while ((ent = readdir (dir)) != NULL) {
+ carts.push_back(fullCartDir + ent->d_name);
}
-
- closedir(dir);
+ closedir (dir);
}
-
return carts;
}
diff --git a/platform/SDL2/Makefile b/platform/SDL2/Makefile
index 4ba4c4d..f60227a 100644
--- a/platform/SDL2/Makefile
+++ b/platform/SDL2/Makefile
@@ -21,7 +21,7 @@ CFLAGS := -g -Wall -O2 -ffunction-sections \
CFLAGS += $(INCLUDE)
-CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++17
+CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++11
LIBS := -lSDL2
diff --git a/platform/switch/Makefile b/platform/switch/Makefile
index fe7ba30..42c3b93 100644
--- a/platform/switch/Makefile
+++ b/platform/switch/Makefile
@@ -50,7 +50,7 @@ CFLAGS := -g -Wall -O2 -ffunction-sections \
CFLAGS += $(INCLUDE) -D__SWITCH__
-CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++17
+CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
diff --git a/platform/switch/source/SwitchHost.cpp b/platform/switch/source/SwitchHost.cpp
index 7db6a0a..4104a95 100644
--- a/platform/switch/source/SwitchHost.cpp
+++ b/platform/switch/source/SwitchHost.cpp
@@ -6,9 +6,7 @@
#include <fstream>
#include <iostream>
-#include <filesystem>
using namespace std;
-namespace fs = std::filesystem;
#include "../../../source/host.h"
#include "../../../source/hostVmShared.h"
@@ -320,16 +318,15 @@ vector<string> Host::listcarts(){
vector<string> carts;
DIR* dir = opendir("/p8carts");
+ struct dirent *ent;
+ std::string fullCartDir = "/p8carts/";
if (dir) {
- for(auto& p: fs::directory_iterator("/p8carts")){
- auto ext = p.path().extension().string();
- if (ext == ".p8" || ext == ".png"){
- carts.push_back(p.path().string());
- }
+ /* print all the files and directories within directory */
+ while ((ent = readdir (dir)) != NULL) {
+ carts.push_back(fullCartDir + ent->d_name);
}
-
- closedir(dir);
+ closedir (dir);
}
diff --git a/source/Audio.cpp b/source/Audio.cpp
index 706697b..d7ddcef 100644
--- a/source/Audio.cpp
+++ b/source/Audio.cpp
@@ -1,6 +1,7 @@
#include "Audio.h"
#include "synth.h"
#include "hostVmShared.h"
+#include "mathhelpers.h"
#include <string>
#include <sstream>
@@ -18,12 +19,23 @@ Audio::Audio(PicoRam* memory){
}
void Audio::resetAudioState() {
- _audioState = {0};
-
for(int i = 0; i < 4; i++) {
_audioState._sfxChannels[i].sfxId = -1;
+ _audioState._sfxChannels[i].offset = 0;
+ _audioState._sfxChannels[i].phi = 0;
+ _audioState._sfxChannels[i].can_loop = true;
+ _audioState._sfxChannels[i].is_music = false;
+ _audioState._sfxChannels[i].prev_key = 0;
+ _audioState._sfxChannels[i].prev_vol = 0;
}
+ _audioState._musicChannel.count = 0;
_audioState._musicChannel.pattern = -1;
+ _audioState._musicChannel.master = -1;
+ _audioState._musicChannel.mask = 0xf;
+ _audioState._musicChannel.speed = 0;
+ _audioState._musicChannel.volume = 0.f;
+ _audioState._musicChannel.volume_step = 0.f;
+ _audioState._musicChannel.offset = 0.f;
}
audioState* Audio::getAudioState() {
@@ -204,7 +216,10 @@ static float key_to_freq(float key)
//adapted from zepto8 sfx.cpp (wtfpl license)
int16_t Audio::getSampleForChannel(int channel){
- using std::fabs, std::fmod, std::floor, std::max;
+ using std::fabs;
+ using std::fmod;
+ using std::floor;
+ using std::max;
int const samples_per_second = 22050;
@@ -219,7 +234,7 @@ int16_t Audio::getSampleForChannel(int channel){
float const offset_per_sample = offset_per_second / samples_per_second;
_audioState._musicChannel.offset += offset_per_sample;
_audioState._musicChannel.volume += _audioState._musicChannel.volume_step / samples_per_second;
- _audioState._musicChannel.volume = std::clamp(_audioState._musicChannel.volume, 0.f, 1.f);
+ _audioState._musicChannel.volume = clamp(_audioState._musicChannel.volume, 0.f, 1.f);
if (_audioState._musicChannel.volume_step < 0 && _audioState._musicChannel.volume <= 0)
{
diff --git a/source/cart.cpp b/source/cart.cpp
index b913985..705662a 100644
--- a/source/cart.cpp
+++ b/source/cart.cpp
@@ -100,13 +100,13 @@ bool Cart::loadCartFromPng(std::string filename){
//if there's an error, display it
if(error) {
LoadError = "png decoder error " + std::string(lodepng_error_text(error));
- Logger::Write("%s%s", LoadError.c_str(), "\n");
+ Logger_Write("%s%s", LoadError.c_str(), "\n");
return false;
}
if (width != 160 || height != 205) {
LoadError = "Invalid png dimensions";
- Logger::Write("invalid dimensions\n");
+ Logger_Write("invalid dimensions\n");
return false;
}
@@ -173,7 +173,7 @@ bool Cart::loadCartFromPng(std::string filename){
compression = 1;
}
- Logger::Write("Version: %d Compression %d", version, compression);
+ Logger_Write("Version: %d Compression %d", version, compression);
if (compression == 0) {
auto codeBlockLength = 0x8000 - 0x4300;
@@ -244,7 +244,7 @@ bool Cart::loadCartFromPng(std::string filename){
move_to_front mtf;
- //Logger::Write("# Size: %d (%04x)\n", int(compressed), int(compressed));
+ //Logger_Write("# Size: %d (%04x)\n", int(compressed), int(compressed));
while (LuaString.size() < length && pos < compressed * 8)
{
@@ -259,7 +259,7 @@ bool Cart::loadCartFromPng(std::string filename){
uint8_t ch = mtf.get(n);
if (!ch)
break;
- //Logger::Write("%04x [%d] $%d\n", int(LuaString.size()), int(pos-oldpos), ch);
+ //Logger_Write("%04x [%d] $%d\n", int(LuaString.size()), int(pos-oldpos), ch);
LuaString.push_back(char(ch));
}
else
@@ -272,7 +272,7 @@ bool Cart::loadCartFromPng(std::string filename){
len += (n = get_bits(3));
while (n == 7);
- //Logger::Write("%04x [%d] %d@-%d\n", int(LuaString.size()), int(pos-oldpos), len, offset);
+ //Logger_Write("%04x [%d] %d@-%d\n", int(LuaString.size()), int(pos-oldpos), len, offset);
for (int i = 0; i < len; ++i)
LuaString.push_back(LuaString[LuaString.size() - offset]);
}
@@ -290,7 +290,7 @@ Cart::Cart(std::string filename){
//zero out cart rom so no garbage is left over
initCartRom();
- Logger::Write("getting file contents\n");
+ Logger_Write("getting file contents\n");
if (hasEnding(filename, ".p8")){
std::string cartStr;
@@ -301,7 +301,7 @@ Cart::Cart(std::string filename){
else {
cartStr = get_file_contents(filename.c_str());
}
- Logger::Write("Got file contents... parsing cart\n");
+ Logger_Write("Got file contents... parsing cart\n");
fullCartText = cartStr;
@@ -336,12 +336,12 @@ Cart::Cart(std::string filename){
}
}
- Logger::Write("Setting cart graphics rom data from strings\n");
+ Logger_Write("Setting cart graphics rom data from strings\n");
setSpriteSheet(SpriteSheetString);
setSpriteFlags(SpriteFlagsString);
setMapData(MapString);
- Logger::Write("Setting cart audio rom data from strings\n");
+ Logger_Write("Setting cart audio rom data from strings\n");
setSfx(SfxString);
setMusic(MusicString);
}
@@ -353,7 +353,7 @@ Cart::Cart(std::string filename){
}
LoadError = "";
- Logger::Write("got valid png cart\n");
+ Logger_Write("got valid png cart\n");
}
else {
return;
@@ -384,17 +384,17 @@ void Cart::initCartRom(){
}
void Cart::setSpriteSheet(std::string spritesheetstring){
- Logger::Write("Copying data to spritesheet\n");
+ Logger_Write("Copying data to spritesheet\n");
copy_string_to_sprite_memory(CartRom.SpriteSheetData, spritesheetstring);
}
void Cart::setSpriteFlags(std::string spriteFlagsstring){
- Logger::Write("Copying data to sprite flags\n");
+ Logger_Write("Copying data to sprite flags\n");
copy_string_to_memory(CartRom.SpriteFlagsData, spriteFlagsstring);
}
void Cart::setMapData(std::string mapDataString){
- Logger::Write("Copying data to map data\n");
+ Logger_Write("Copying data to map data\n");
copy_string_to_memory(CartRom.MapData, mapDataString);
}
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 7494239..65fc47e 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -8,6 +8,7 @@
#include "graphics.h"
#include "hostVmShared.h"
#include "nibblehelpers.h"
+#include "mathhelpers.h"
#include "stringToDataHelpers.h"
@@ -361,20 +362,19 @@ bool Graphics::isYWithinClip(int y) {
y < _memory->drawState.clip_ye;
}
-
int clampCoordToScreenDims(int val) {
- return std::clamp(val, 0, 128);
+ return clamp(val, 0, 128);
}
int Graphics::clampXCoordToClip(int x) {
- return std::clamp(
+ return clamp(
x,
(int)_memory->drawState.clip_xb,
(int)_memory->drawState.clip_xe - 1);
}
int Graphics::clampYCoordToCLip(int y) {
- return std::clamp(
+ return clamp(
y,
(int)_memory->drawState.clip_yb,
(int)_memory->drawState.clip_ye - 1);
diff --git a/source/logger.cpp b/source/logger.cpp
index 27306fe..69bcf8b 100644
--- a/source/logger.cpp
+++ b/source/logger.cpp
@@ -3,20 +3,16 @@
#include "logger.h"
+FILE * m_file = nullptr;
+bool m_enabled = false;
-void Logger::Initialize()
+void Logger_Initialize()
{
- Logger::m_file = freopen("pico.log", "w", stderr);
- Logger::m_enabled = true;
+ m_file = freopen("pico.log", "w", stderr);
+ m_enabled = true;
}
-/*
-** {Function Name}:{Line}
-** {Resolved printf stuff}
-** {Newline}
-** {Start of next Output}
-*/
-void Logger::LogOutput(const char * func, size_t line, const char * format, ...)
+void Logger_LogOutput(const char * func, size_t line, const char * format, ...)
{
if (!m_enabled || !m_file)
return;
@@ -31,7 +27,7 @@ void Logger::LogOutput(const char * func, size_t line, const char * format, ...)
fflush(m_file);
}
-void Logger::Write(const char * format, ...)
+void Logger_Write(const char * format, ...)
{
if (!m_enabled || !m_file)
return;
@@ -44,17 +40,17 @@ void Logger::Write(const char * format, ...)
fflush(m_file);
}
-void Logger::WriteUnformatted(const char * message)
+void Logger_WriteUnformatted(const char * message)
{
if (!m_enabled || !m_file)
return;
- fprintf(m_file, message);
+ fprintf(m_file, "%s", message);
fflush(m_file);
}
-void Logger::Exit()
+void Logger_Exit()
{
if (!m_enabled || !m_file)
return;
diff --git a/source/logger.h b/source/logger.h
index 3625832..e895b39 100644
--- a/source/logger.h
+++ b/source/logger.h
@@ -1,27 +1,13 @@
-/*
-LovePotion logger
-** logger.h
-** @brief : Logs shit when enabled
-*/
#pragma once
#include <stdio.h>
-namespace Logger
-{
- void Initialize();
+void Logger_Initialize();
+void Logger_Exit();
+void Logger_LogOutput(const char * func, size_t line, const char * format, ...);
+void Logger_Write(const char * format, ...);
+void Logger_WriteUnformatted(const char * message);
- void Exit();
- void LogOutput(const char * func, size_t line, const char * format, ...);
-
- void Write(const char * format, ...);
-
- void WriteUnformatted(const char * message);
-
- inline FILE * m_file = nullptr;
- inline bool m_enabled = false;
-}
-
-#define LOG(format, ...) Logger::LogOutput(__PRETTY_FUNCTION__, __LINE__, format, ## __VA_ARGS__)
\ No newline at end of file
+#define LOG(format, ...) Logger_LogOutput(__PRETTY_FUNCTION__, __LINE__, format, ## __VA_ARGS__)
\ No newline at end of file
diff --git a/source/main.cpp b/source/main.cpp
index d914a20..bb93bb8 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -14,32 +14,32 @@
int main(int argc, char* argv[])
{
- Logger::Initialize();
+ Logger_Initialize();
Host *host = new Host();
Vm *vm = new Vm(host);
host->oneTimeSetup(vm->GetPaletteColors());
- Logger::Write("initialized Vm and host\n");
+ Logger_Write("initialized Vm and host\n");
- Logger::Write("Setting cart list on vm\n");
+ Logger_Write("Setting cart list on vm\n");
vm->SetCartList(host->listcarts());
- Logger::Write("Loading Bios cart\n");
+ Logger_Write("Loading Bios cart\n");
vm->LoadBiosCart();
- Logger::Write("Bios Cart Loaded\n");
+ Logger_Write("Bios Cart Loaded\n");
// Main loop
- Logger::Write("Starting main loop\n");
+ Logger_Write("Starting main loop\n");
vm->GameLoop();
- Logger::Write("Turning off vm and exiting logger\n");
+ Logger_Write("Turning off vm and exiting logger\n");
vm->CloseCart();
delete vm;
- Logger::Exit();
+ Logger_Exit();
host->oneTimeCleanup();
delete host;
diff --git a/source/mathhelpers.cpp b/source/mathhelpers.cpp
new file mode 100644
index 0000000..ffe6201
--- /dev/null
+++ b/source/mathhelpers.cpp
@@ -0,0 +1,12 @@
+#include "mathhelpers.h"
+
+//std::clamp is in c++17, but not c++11
+int clamp (int val, int lo, int hi) {
+ val = (val > hi) ? hi : val;
+ return (val < lo) ? lo : val;
+}
+
+float clamp (float val, float lo, float hi) {
+ val = (val > hi) ? hi : val;
+ return (val < lo) ? lo : val;
+}
\ No newline at end of file
diff --git a/source/mathhelpers.h b/source/mathhelpers.h
new file mode 100644
index 0000000..9829276
--- /dev/null
+++ b/source/mathhelpers.h
@@ -0,0 +1,6 @@
+#pragma once
+
+//std::clamp is in c++17, but not c++11
+int clamp (int val, int lo, int hi);
+
+float clamp (float val, float lo, float hi);
\ No newline at end of file
diff --git a/source/synth.cpp b/source/synth.cpp
index a47f719..bf89f96 100644
--- a/source/synth.cpp
+++ b/source/synth.cpp
@@ -20,7 +20,8 @@ namespace z8
float synth::waveform(int instrument, float advance)
{
- using std::fabs, std::fmod;
+ using std::fabs;
+ using std::fmod;
float t = fmod(advance, 1.f);
float ret = 0.f;
diff --git a/source/tests/test_base.cpp b/source/tests/test_base.cpp
index 70b4039..a338af8 100644
--- a/source/tests/test_base.cpp
+++ b/source/tests/test_base.cpp
@@ -13,13 +13,13 @@ bool assertStringsEqual(std::string expected, std::string actual, std::string te
printTestOuput(testName, equal);
if (!equal){
- Logger::Write("start expected: \n");
- Logger::Write(expected.c_str());
- Logger::Write("end expected: \n");
+ Logger_Write("start expected: \n");
+ Logger_Write(expected.c_str());
+ Logger_Write("end expected: \n");
- Logger::Write("start actual: \n");
- Logger::Write(actual.c_str());
- Logger::Write("end actual: \n");
+ Logger_Write("start actual: \n");
+ Logger_Write(actual.c_str());
+ Logger_Write("end actual: \n");
}
return equal;
diff --git a/source/vm.cpp b/source/vm.cpp
index 2824c13..82895e0 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -74,7 +74,7 @@ Vm::Vm(
_audio = audio;
//this can probably go away when I'm loading actual carts and just have to expose api to lua
- Logger::Write("Initializing global api\n");
+ Logger_Write("Initializing global api\n");
initPicoApi(_graphics, _input, this, _audio);
//initGlobalApi(_graphics);
@@ -126,7 +126,7 @@ bool Vm::loadCart(Cart* cart) {
if (_cartLoadError == "") {
_cartLoadError = "No Lua to load. Aborting cart load";
}
- Logger::Write("%s\n", _cartLoadError.c_str());
+ Logger_Write("%s\n", _cartLoadError.c_str());
return false;
}
@@ -149,6 +149,18 @@ bool Vm::loadCart(Cart* cart) {
luaL_openlibs(_luaState);
lua_pushglobaltable(_luaState);
+ //load in global lua fuctions for pico 8
+ auto convertedGlobalLuaFunctions = convert_emojis(p8GlobalLuaFunctions);
+ 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;
+ }
//graphics
lua_register(_luaState, "cls", cls);
@@ -231,25 +243,12 @@ bool Vm::loadCart(Cart* cart) {
lua_register(_luaState, "__togglepausemenu", togglepausemenu);
lua_register(_luaState, "__resetcart", resetcart);
- //load in global lua fuctions for pico 8
- auto convertedGlobalLuaFunctions = convert_emojis(p8GlobalLuaFunctions);
- 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;
- }
-
int loadedCart = luaL_loadstring(_luaState, cart->LuaString.c_str());
if (loadedCart != LUA_OK) {
_cartLoadError = "Error loading cart lua";
- Logger::Write("ERROR loading cart\n");
- Logger::Write("Error: %s\n", lua_tostring(_luaState, -1));
+ Logger_Write("ERROR loading cart\n");
+ Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
lua_pop(_luaState, 1);
return false;
@@ -258,8 +257,8 @@ bool Vm::loadCart(Cart* cart) {
if (setjmp(place) == 0) {
if (lua_pcall(_luaState, 0, 0, 0)){
_cartLoadError = "Runtime error";
- Logger::Write("ERROR running cart\n");
- Logger::Write("Error: %s\n", lua_tostring(_luaState, -1));
+ Logger_Write("ERROR running cart\n");
+ Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
lua_pop(_luaState, 1);
}
}
@@ -319,10 +318,10 @@ void Vm::LoadBiosCart(){
}
void Vm::LoadCart(std::string filename){
- Logger::Write("Loading cart %s\n", filename.c_str());
+ Logger_Write("Loading cart %s\n", filename.c_str());
CloseCart();
- Logger::Write("Calling Cart Constructor\n");
+ Logger_Write("Calling Cart Constructor\n");
Cart *cart = new Cart(filename);
_cartLoadError = cart->LoadError;
@@ -452,18 +451,18 @@ void Vm::FillAudioBuffer(void *audioBuffer, size_t offset, size_t size){
void Vm::CloseCart() {
if (_loadedCart){
- Logger::Write("deleting cart\n");
+ Logger_Write("deleting cart\n");
delete _loadedCart;
_loadedCart = nullptr;
}
if (_luaState) {
- Logger::Write("closing lua state\n");
+ Logger_Write("closing lua state\n");
lua_close(_luaState);
_luaState = nullptr;
}
- Logger::Write("resetting state\n");
+ Logger_Write("resetting state\n");
_hasUpdate = false;
_hasDraw = false;
_targetFps = 30;
@@ -541,7 +540,7 @@ bool Vm::ExecuteLua(string luaString, string callbackFunction){
if (! success == LUA_OK){
//bad lua passed
- Logger::Write("Error: %s\n", lua_tostring(_luaState, -1));
+ Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
lua_pop(_luaState, 1);
return false;
diff --git a/test/Makefile b/test/Makefile
index ed2e441..c657846 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,6 +1,6 @@
#match flags from 3ds and switch makefiles. This may not all be necessary
CFLAGS := -Wall -g -c -O2 \
- -fno-rtti -fexceptions -std=gnu++17
+ -fno-rtti -fexceptions -std=gnu++11
all: runtests
@@ -12,7 +12,7 @@ testrunner.a: testroot.o \
g++ -I$(CURDIR)/include -L$(CURDIR)/lib \
testroot.o \
fontdata.o fontdatatests.o \
- graphics.o graphicstests.o stringToDataHelpers.o \
+ graphics.o graphicstests.o stringToDataHelpers.o mathhelpers.o \
Audio.o synth.o audiotests.o \
cartPatcher.o cartpatchertests.o \
cart.o carttests.o nooplogger.o lodepng.o emojiconversion.o filehelpers.o utf8-util.o \
@@ -35,15 +35,17 @@ graphicstests.o: liblua.a fontdatatests.o graphicstests.cpp ../source/graphics.c
../source/fontdata.cpp ../source/fontdata.h \
../source/PicoRam.h ../source/hostVmShared.h \
../source/stringToDataHelpers.h ../source/stringToDataHelpers.cpp \
+ ../source/mathhelpers.h ../source/mathhelpers.cpp \
../source/nibblehelpers.h ../source/nibblehelpers.cpp
g++ $(CFLAGS) -I$(CURDIR)/include -L$(CURDIR)/lib \
graphicstests.cpp ../source/graphics.cpp \
- ../source/stringToDataHelpers.cpp ../source/nibblehelpers.cpp
+ ../source/stringToDataHelpers.cpp ../source/nibblehelpers.cpp ../source/mathhelpers.cpp
audiotests.o: audiotests.cpp ../source/Audio.cpp ../source/Audio.h \
../source/synth.cpp ../source/synth.h \
+ ../source/mathhelpers.h ../source/mathhelpers.cpp \
../source/PicoRam.h ../source/hostVmShared.h
- g++ $(CFLAGS) audiotests.cpp ../source/Audio.cpp ../source/synth.cpp
+ g++ $(CFLAGS) audiotests.cpp ../source/Audio.cpp ../source/synth.cpp ../source/mathhelpers.cpp
cartpatchertests.o: liblua.a cartpatchertests.cpp ../source/cartPatcher.cpp ../source/cartPatcher.h
g++ $(CFLAGS) -I$(CURDIR)/include -L$(CURDIR)/lib \
diff --git a/test/nooplogger.cpp b/test/nooplogger.cpp
index 1f8f530..4286f9c 100644
--- a/test/nooplogger.cpp
+++ b/test/nooplogger.cpp
@@ -4,22 +4,22 @@
#include "logger.h"
-void Logger::Initialize()
+void Logger_Initialize()
{
}
-void Logger::LogOutput(const char * func, size_t line, const char * format, ...)
+void Logger_LogOutput(const char * func, size_t line, const char * format, ...)
{
}
-void Logger::Write(const char * format, ...)
+void Logger_Write(const char * format, ...)
{
}
-void Logger::WriteUnformatted(const char * message)
+void Logger_WriteUnformatted(const char * message)
{
}
-void Logger::Exit()
+void Logger_Exit()
{
}