foxygit / fake-08-xbox360 Log in
commit 0ffdc4bf518fb557d75176fd057058553f26cfbe
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Thu Feb 10 17:13:40 2022 -0700
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Thu Feb 10 17:13:40 2022 -0700

    WIP moving color rgb values to better location

    move to hostvmshared header instead of graphics header so they reduce
    number of places they need to get passed
---
 platform/3ds/source/3dsHost.cpp             |  4 +--
 platform/SDL2Common/source/sdl2basehost.cpp |  5 +--
 platform/bittboy/source/BittBoyHost.cpp     |  5 +--
 platform/miyoomini/source/MiyooMiniHost.cpp |  5 +--
 platform/wiiu/source/WiiUHost.cpp           |  5 ---
 source/graphics.cpp                         | 42 --------------------------
 source/graphics.h                           | 38 -----------------------
 source/host.h                               | 10 ++++--
 source/hostCommonFunctions.cpp              | 45 +++++++++++++++++++++++++++
 source/hostVmShared.h                       | 35 +++++++++++++++++++++
 source/main.cpp                             |  3 +-
 source/vm.cpp                               |  5 ---
 source/vm.h                                 |  1 -
 test/endtoendtests.cpp                      | 31 ++++++++++---------
 test/graphicstests.cpp                      | 36 ----------------------
 test/stubhost.cpp                           | 47 ++++++++++++++++++++++++++++-
 16 files changed, 155 insertions(+), 162 deletions(-)

diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 24bf2fd..2a867f7 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -53,7 +53,6 @@ int touchLocationX;
 int touchLocationY;
 uint8_t mouseBtnState;

-Color* _paletteColors;
 uint16_t _rgb565Colors[144];
 uint32_t _rgba8Colors[144];
 Audio* _audio;
@@ -299,7 +298,7 @@ Host::Host() {
         std::string cartDirectory) {}


-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+void Host::oneTimeSetup(Audio* audio){
     osSetSpeedupEnable(true);

     stretch = StretchAndOverflow;
@@ -334,7 +333,6 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     currKDown32 = 0;
     currKHeld32 = 0;

-    _paletteColors = paletteColors;
     for(int i = 0; i < 144; i++){
         _rgba8Colors[i] = 0xFF | (_paletteColors[i].Blue << 8) | (_paletteColors[i].Green << 16) | (_paletteColors[i].Red << 24);
         _rgb565Colors[i] = (((_paletteColors[i].Red & 0xf8)<<8) + ((_paletteColors[i].Green & 0xfc)<<3)+(_paletteColors[i].Blue>>3));
diff --git a/platform/SDL2Common/source/sdl2basehost.cpp b/platform/SDL2Common/source/sdl2basehost.cpp
index 1cebd09..14e1546 100644
--- a/platform/SDL2Common/source/sdl2basehost.cpp
+++ b/platform/SDL2Common/source/sdl2basehost.cpp
@@ -47,7 +47,6 @@ uint8_t currKDown;
 uint8_t currKHeld;
 bool stretchKeyPressed = false;

-Color* _paletteColors;
 Audio* _audio;

 SDL_Window* window;
@@ -186,7 +185,7 @@ void Host::setPlatformParams(
 }


-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+void Host::oneTimeSetup(Audio* audio){
     if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
     {
         fprintf(stderr, "SDL could not initialize\n");
@@ -236,8 +235,6 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     currKDown = 0;
     currKHeld = 0;

-    _paletteColors = paletteColors;
-
     loadSettingsIni();

     _changeStretch(stretch);
diff --git a/platform/bittboy/source/BittBoyHost.cpp b/platform/bittboy/source/BittBoyHost.cpp
index f1470f4..4e11087 100644
--- a/platform/bittboy/source/BittBoyHost.cpp
+++ b/platform/bittboy/source/BittBoyHost.cpp
@@ -53,7 +53,6 @@ uint32_t targetFrameTimeMs;
 uint8_t currKDown;
 uint8_t currKHeld;

-Color* _paletteColors;
 Audio* _audio;

 SDL_Event event;
@@ -180,7 +179,7 @@ Host::Host() {
     #endif
  }

-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+void Host::oneTimeSetup(Audio* audio){
     if (SDL_Init(SDL_INIT_VIDEO) != 0)
     {
         fprintf(stderr, "SDL could not initialize\n");
@@ -204,8 +203,6 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     frame_time = 0;
     targetFrameTimeMs = 0;

-    _paletteColors = paletteColors;
-
     SDL_PixelFormat *f = window->format;

     for(int i = 0; i < 144; i++){
diff --git a/platform/miyoomini/source/MiyooMiniHost.cpp b/platform/miyoomini/source/MiyooMiniHost.cpp
index 6b3d575..7534a15 100644
--- a/platform/miyoomini/source/MiyooMiniHost.cpp
+++ b/platform/miyoomini/source/MiyooMiniHost.cpp
@@ -58,7 +58,6 @@ uint32_t targetFrameTimeMs;
 uint8_t currKDown;
 uint8_t currKHeld;

-Color* _paletteColors;
 Audio* _audio;

 SDL_Event event;
@@ -219,7 +218,7 @@ Host::Host() {

  }

-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+void Host::oneTimeSetup(Audio* audio){
     if (SDL_Init(SDL_INIT_VIDEO) != 0)
     {
         fprintf(stderr, "SDL could not initialize\n");
@@ -243,8 +242,6 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     frame_time = 0;
     targetFrameTimeMs = 0;

-    _paletteColors = paletteColors;
-
     SDL_PixelFormat *f = window->format;

     for(int i = 0; i < 144; i++){
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index c46d8f6..e248570 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -62,9 +62,6 @@ uint32_t now_time;
 uint32_t frame_time;
 uint32_t targetFrameTimeMs;

-
-Color* _paletteColors;
-
 Audio* _audio;

 SDL_Window* window;
@@ -262,8 +259,6 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
     currKDown = 0;
     currKHeld = 0;

-    _paletteColors = paletteColors;
-
     loadSettingsIni();

     _changeStretch(stretch);
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 947459a..4c0fa8d 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -24,44 +24,6 @@ Graphics::Graphics(std::string fontdata, PicoRam* memory) {

 	copy_string_to_sprite_memory(fontSpriteData, fontdata);

-	_paletteColors[0] = COLOR_00;
-	_paletteColors[1] = COLOR_01;
-	_paletteColors[2] = COLOR_02;
-	_paletteColors[3] = COLOR_03;
-	_paletteColors[4] = COLOR_04;
-	_paletteColors[5] = COLOR_05;
-	_paletteColors[6] = COLOR_06;
-	_paletteColors[7] = COLOR_07;
-	_paletteColors[8] = COLOR_08;
-	_paletteColors[9] = COLOR_09;
-	_paletteColors[10] = COLOR_10;
-	_paletteColors[11] = COLOR_11;
-	_paletteColors[12] = COLOR_12;
-	_paletteColors[13] = COLOR_13;
-	_paletteColors[14] = COLOR_14;
-	_paletteColors[15] = COLOR_15;
-
-	for (int i = 16; i < 128; i++) {
-		_paletteColors[i] = {0, 0, 0, 0};
-	}
-
-	_paletteColors[128] = COLOR_128;
-	_paletteColors[129] = COLOR_129;
-	_paletteColors[130] = COLOR_130;
-	_paletteColors[131] = COLOR_131;
-	_paletteColors[132] = COLOR_132;
-	_paletteColors[133] = COLOR_133;
-	_paletteColors[134] = COLOR_134;
-	_paletteColors[135] = COLOR_135;
-	_paletteColors[136] = COLOR_136;
-	_paletteColors[137] = COLOR_137;
-	_paletteColors[138] = COLOR_138;
-	_paletteColors[139] = COLOR_139;
-	_paletteColors[140] = COLOR_140;
-	_paletteColors[141] = COLOR_141;
-	_paletteColors[142] = COLOR_142;
-	_paletteColors[143] = COLOR_143;
-
 	//set default clip
 	clip();
 	pal();
@@ -85,10 +47,6 @@ uint8_t* Graphics::GetScreenPaletteMap(){
 	return _memory->drawState.screenPaletteMap;
 }

-Color* Graphics::GetPaletteColors(){
-	return this->_paletteColors;
-}
-
 //start helper methods
 //based on tac08 implementation of blitter()
 void Graphics::copySpriteToScreen(
diff --git a/source/graphics.h b/source/graphics.h
index b85d83b..6e5500a 100644
--- a/source/graphics.h
+++ b/source/graphics.h
@@ -7,47 +7,10 @@
 #include <fix32.h>
 using namespace z8;

-#define COLOR_00 {  2,   4,   8, 255}
-#define COLOR_01 { 29,  43,  83, 255}
-#define COLOR_02 {126,  37,  83, 255}
-#define COLOR_03 {  0, 135,  81, 255}
-#define COLOR_04 {171,  82,  54, 255}
-#define COLOR_05 { 95,  87,  79, 255}
-#define COLOR_06 {194, 195, 199, 255}
-#define COLOR_07 {255, 241, 232, 255}
-#define COLOR_08 {255,   0,  77, 255}
-#define COLOR_09 {255, 163,   0, 255}
-#define COLOR_10 {255, 236,  39, 255}
-#define COLOR_11 {  0, 228,  54, 255}
-#define COLOR_12 { 41, 173, 255, 255}
-#define COLOR_13 {131, 118, 156, 255}
-#define COLOR_14 {255, 119, 168, 255}
-#define COLOR_15 {255, 204, 170, 255}
-
-//alt palette
-#define COLOR_128 { 41,  24,  20, 255}
-#define COLOR_129 { 17,  29,  53, 255}
-#define COLOR_130 { 66,  33,  54, 255}
-#define COLOR_131 { 18,  83,  89, 255}
-#define COLOR_132 {116,  47,  41, 255}
-#define COLOR_133 { 73,  51,  59, 255}
-#define COLOR_134 {162, 136, 121, 255}
-#define COLOR_135 {243, 239, 125, 255}
-#define COLOR_136 {190,  18,  80, 255}
-#define COLOR_137 {255, 108,  36, 255}
-#define COLOR_138 {168, 231,  46, 255}
-#define COLOR_139 {  0, 181,  67, 255}
-#define COLOR_140 {  6,  90, 181, 255}
-#define COLOR_141 {117,  70, 101, 255}
-#define COLOR_142 {255, 110,  89, 255}
-#define COLOR_143 {255, 157, 129, 255}
-

 class Graphics {
 	uint8_t fontSpriteData[128 * 64];

-	Color _paletteColors[144];
-
 	PicoRam* _memory;

 	void copySpriteToScreen(
@@ -100,7 +63,6 @@ class Graphics {
 	uint8_t* GetP8FrameBuffer();
 	uint8_t* GetP8SpriteSheetBuffer();
 	uint8_t* GetScreenPaletteMap();
-	Color* GetPaletteColors();

 	bool isColorTransparent(uint8_t color);
 	uint8_t getDrawPalMappedColor(uint8_t color);
diff --git a/source/host.h b/source/host.h
index b02516d..9f4fbe2 100644
--- a/source/host.h
+++ b/source/host.h
@@ -30,8 +30,7 @@ class Host {
     int mouseOffsetX = 0;
     int mouseOffsetY = 0;
     int quit = 0;
-
-
+
     std::string _logFilePrefix;
     std::string _customBiosLua;
     std::string _cartDirectory;
@@ -41,10 +40,13 @@ class Host {

     std::string getCartDataFile(std::string cartDataKey);

+    Color _paletteColors[144];
+
     public:
     Host();

-    void oneTimeSetup(Color* paletteColors, Audio* audio);
+    void setUpPaletteColors();
+    void oneTimeSetup(Audio* audio);

     void setTargetFps(int targetFps);

@@ -80,6 +82,8 @@ class Host {

     std::string getCartDirectory();

+    Color* GetPaletteColors();
+
     void setPlatformParams(
         int windowWidth,
         int windowHeight,
diff --git a/source/hostCommonFunctions.cpp b/source/hostCommonFunctions.cpp
index 14cf1ab..b609766 100644
--- a/source/hostCommonFunctions.cpp
+++ b/source/hostCommonFunctions.cpp
@@ -1,6 +1,7 @@
 #include <string>

 #include "host.h"
+#include "hostVmShared.h"
 #include "filehelpers.h"

 #include "SimpleIni.h"
@@ -9,6 +10,50 @@ using namespace std;

 CSimpleIniA settingsIni;

+void Host::setUpPaletteColors(){
+    _paletteColors[0] = COLOR_00;
+	_paletteColors[1] = COLOR_01;
+	_paletteColors[2] = COLOR_02;
+	_paletteColors[3] = COLOR_03;
+	_paletteColors[4] = COLOR_04;
+	_paletteColors[5] = COLOR_05;
+	_paletteColors[6] = COLOR_06;
+	_paletteColors[7] = COLOR_07;
+	_paletteColors[8] = COLOR_08;
+	_paletteColors[9] = COLOR_09;
+	_paletteColors[10] = COLOR_10;
+	_paletteColors[11] = COLOR_11;
+	_paletteColors[12] = COLOR_12;
+	_paletteColors[13] = COLOR_13;
+	_paletteColors[14] = COLOR_14;
+	_paletteColors[15] = COLOR_15;
+
+	for (int i = 16; i < 128; i++) {
+		_paletteColors[i] = {0, 0, 0, 0};
+	}
+
+	_paletteColors[128] = COLOR_128;
+	_paletteColors[129] = COLOR_129;
+	_paletteColors[130] = COLOR_130;
+	_paletteColors[131] = COLOR_131;
+	_paletteColors[132] = COLOR_132;
+	_paletteColors[133] = COLOR_133;
+	_paletteColors[134] = COLOR_134;
+	_paletteColors[135] = COLOR_135;
+	_paletteColors[136] = COLOR_136;
+	_paletteColors[137] = COLOR_137;
+	_paletteColors[138] = COLOR_138;
+	_paletteColors[139] = COLOR_139;
+	_paletteColors[140] = COLOR_140;
+	_paletteColors[141] = COLOR_141;
+	_paletteColors[142] = COLOR_142;
+	_paletteColors[143] = COLOR_143;
+}
+
+Color* Host::GetPaletteColors(){
+    return _paletteColors;
+}
+
 void Host::loadSettingsIni(){
     std::string settingsIniStr = get_file_contents(_logFilePrefix + "settings.ini");

diff --git a/source/hostVmShared.h b/source/hostVmShared.h
index 186f721..093f769 100644
--- a/source/hostVmShared.h
+++ b/source/hostVmShared.h
@@ -3,6 +3,41 @@
 /// Creates a bitmask from a bit number.
 #define BITMASK(n) (1U<<(n))

+#define COLOR_00 {  2,   4,   8, 255}
+#define COLOR_01 { 29,  43,  83, 255}
+#define COLOR_02 {126,  37,  83, 255}
+#define COLOR_03 {  0, 135,  81, 255}
+#define COLOR_04 {171,  82,  54, 255}
+#define COLOR_05 { 95,  87,  79, 255}
+#define COLOR_06 {194, 195, 199, 255}
+#define COLOR_07 {255, 241, 232, 255}
+#define COLOR_08 {255,   0,  77, 255}
+#define COLOR_09 {255, 163,   0, 255}
+#define COLOR_10 {255, 236,  39, 255}
+#define COLOR_11 {  0, 228,  54, 255}
+#define COLOR_12 { 41, 173, 255, 255}
+#define COLOR_13 {131, 118, 156, 255}
+#define COLOR_14 {255, 119, 168, 255}
+#define COLOR_15 {255, 204, 170, 255}
+
+//alt palette
+#define COLOR_128 { 41,  24,  20, 255}
+#define COLOR_129 { 17,  29,  53, 255}
+#define COLOR_130 { 66,  33,  54, 255}
+#define COLOR_131 { 18,  83,  89, 255}
+#define COLOR_132 {116,  47,  41, 255}
+#define COLOR_133 { 73,  51,  59, 255}
+#define COLOR_134 {162, 136, 121, 255}
+#define COLOR_135 {243, 239, 125, 255}
+#define COLOR_136 {190,  18,  80, 255}
+#define COLOR_137 {255, 108,  36, 255}
+#define COLOR_138 {168, 231,  46, 255}
+#define COLOR_139 {  0, 181,  67, 255}
+#define COLOR_140 {  6,  90, 181, 255}
+#define COLOR_141 {117,  70, 101, 255}
+#define COLOR_142 {255, 110,  89, 255}
+#define COLOR_143 {255, 157, 129, 255}
+
 enum
 {
 	P8_KEY_LEFT   = BITMASK(0),
diff --git a/source/main.cpp b/source/main.cpp
index 636caca..a428638 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -26,7 +26,8 @@ int main(int argc, char* argv[])

 	Vm *vm = new Vm(host, memory, nullptr, nullptr, audio);

-	host->oneTimeSetup(vm->GetPaletteColors(), audio);
+	host->setUpPaletteColors();
+	host->oneTimeSetup(audio);

 	Logger_Write("initialized Vm and host\n");

diff --git a/source/vm.cpp b/source/vm.cpp
index f2048ef..9ee6a80 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -501,11 +501,6 @@ uint8_t* Vm::GetScreenPaletteMap(){
     return _graphics->GetScreenPaletteMap();
 }

-Color* Vm::GetPaletteColors(){
-    return _graphics->GetPaletteColors();
-}
-
-
 void Vm::FillAudioBuffer(void *audioBuffer, size_t offset, size_t size){
    _audio->FillAudioBuffer(audioBuffer, offset, size);
 }
diff --git a/source/vm.h b/source/vm.h
index 2e071e7..d4737e7 100644
--- a/source/vm.h
+++ b/source/vm.h
@@ -73,7 +73,6 @@ class Vm {

     uint8_t* GetPicoInteralFb();
     uint8_t* GetScreenPaletteMap();
-    Color* GetPaletteColors();

     void FillAudioBuffer(void *audioBuffer, size_t offset, size_t size);

diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp
index fc1ea7c..9bcf5ac 100644
--- a/test/endtoendtests.cpp
+++ b/test/endtoendtests.cpp
@@ -11,7 +11,7 @@
 #include "../source/hostVmShared.h"
 #include "../source/nibblehelpers.h"

-bool verifyScreenshot(Vm* vm, std::string screenshotFilename) {
+bool verifyScreenshot(Vm* vm, Host* host, std::string screenshotFilename) {
     std::vector<unsigned char> png;
     std::vector<unsigned char> image; //the raw pixels
     unsigned width, height;
@@ -30,7 +30,8 @@ bool verifyScreenshot(Vm* vm, std::string screenshotFilename) {

     uint8_t* picoFb = vm->GetPicoInteralFb();
 	uint8_t* screenPaletteMap = vm->GetScreenPaletteMap();
-	Color* paletteColors = vm->GetPaletteColors();
+    host->setUpPaletteColors();
+	Color* paletteColors = host->GetPaletteColors();

     size_t imageBytes = image.size();

@@ -108,7 +109,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/pset00-test_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/pset00-test_f01.png"));
         }

         vm->CloseCart();
@@ -122,7 +123,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/pset3pix_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/pset3pix_f01.png"));
         }

         vm->CloseCart();
@@ -136,7 +137,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/psetall_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/psetall_f01.png"));
         }

         vm->CloseCart();
@@ -150,7 +151,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/cliptest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/cliptest_f01.png"));
         }

         vm->CloseCart();
@@ -164,7 +165,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/memorytest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/memorytest_f01.png"));
         }

         vm->CloseCart();
@@ -178,7 +179,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/cartdatatest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/cartdatatest_f01.png"));
         }

         vm->CloseCart();
@@ -436,7 +437,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/fillptest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/fillptest_f01.png"));
         }

         vm->CloseCart();
@@ -452,7 +453,7 @@ TEST_CASE("Loading and running carts") {
             vm->UpdateAndDraw();
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/peek4test_f02.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/peek4test_f02.png"));
         }

         vm->CloseCart();
@@ -466,7 +467,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/paltabletest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/paltabletest_f01.png"));
         }

         vm->CloseCart();
@@ -480,7 +481,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/nilpairstest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/nilpairstest_f01.png"));
         }

         vm->CloseCart();
@@ -494,7 +495,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/splittest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/splittest_f01.png"));
         }

         vm->CloseCart();
@@ -533,7 +534,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/includetest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/includetest_f01.png"));
         }

         vm->CloseCart();
@@ -547,7 +548,7 @@ TEST_CASE("Loading and running carts") {
         SUBCASE("sceen matches screenshot"){
             vm->UpdateAndDraw();

-            CHECK(verifyScreenshot(vm, "carts/screenshots/subtest_f01.png"));
+            CHECK(verifyScreenshot(vm, host, "carts/screenshots/subtest_f01.png"));
         }

         vm->CloseCart();
diff --git a/test/graphicstests.cpp b/test/graphicstests.cpp
index e547e87..47282a1 100644
--- a/test/graphicstests.cpp
+++ b/test/graphicstests.cpp
@@ -49,42 +49,6 @@ TEST_CASE("graphics class behaves as expected") {
     Graphics* graphics = new Graphics(fontdata, &picoRam);
     graphics->cls();

-    SUBCASE("Palette set up in constructor") {
-        Color* palette = graphics->GetPaletteColors();
-        Color testColor;
-        testColor = {  2,   4,   8, 255};
-        CHECK(colorsEqual(& palette[0], & testColor) == true);
-        testColor = { 29,  43,  83, 255};
-        CHECK(colorsEqual(& palette[1], & testColor) == true);
-        testColor = {126,  37,  83, 255};
-        CHECK(colorsEqual(& palette[2], & testColor) == true);
-        testColor = {  0, 135,  81, 255};
-        CHECK(colorsEqual(& palette[3], & testColor) == true);
-        testColor = {171,  82,  54, 255};
-        CHECK(colorsEqual(& palette[4], & testColor) == true);
-        testColor = { 95,  87,  79, 255};
-        CHECK(colorsEqual(& palette[5], & testColor) == true);
-        testColor = {194, 195, 199, 255};
-        CHECK(colorsEqual(& palette[6], & testColor) == true);
-        testColor = {255, 241, 232, 255};
-        CHECK(colorsEqual(& palette[7], & testColor) == true);
-        testColor = {255,   0,  77, 255};
-        CHECK(colorsEqual(& palette[8], & testColor) == true);
-        testColor = {255, 163,   0, 255};
-        CHECK(colorsEqual(& palette[9], & testColor) == true);
-        testColor = {255, 236,  39, 255};
-        CHECK(colorsEqual(& palette[10], & testColor) == true);
-        testColor = {  0, 228,  54, 255};
-        CHECK(colorsEqual(& palette[11], & testColor) == true);
-        testColor = { 41, 173, 255, 255};
-        CHECK(colorsEqual(& palette[12], & testColor) == true);
-        testColor = {131, 118, 156, 255};
-        CHECK(colorsEqual(& palette[13], & testColor) == true);
-        testColor = {255, 119, 168, 255};
-        CHECK(colorsEqual(& palette[14], & testColor) == true);
-        testColor = {255, 204, 170, 255};
-        CHECK(colorsEqual(& palette[15], & testColor) == true);
-    }
     SUBCASE("Constructor sets default clip") {
         CHECK(picoRam.drawState.clip_xb == 0);
         CHECK(picoRam.drawState.clip_yb == 0);
diff --git a/test/stubhost.cpp b/test/stubhost.cpp
index 9db93a2..d0b0f0b 100644
--- a/test/stubhost.cpp
+++ b/test/stubhost.cpp
@@ -22,7 +22,7 @@ Host::Host() { }
 StubHost::StubHost() { }


-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
+void Host::oneTimeSetup(Audio* audio){

 }

@@ -108,3 +108,48 @@ void Host::saveCartData(std::string cartDataKey, std::string contents) {
 std::string Host::getCartDirectory() {
     return "carts";
 }
+
+
+void Host::setUpPaletteColors(){
+    _paletteColors[0] = COLOR_00;
+	_paletteColors[1] = COLOR_01;
+	_paletteColors[2] = COLOR_02;
+	_paletteColors[3] = COLOR_03;
+	_paletteColors[4] = COLOR_04;
+	_paletteColors[5] = COLOR_05;
+	_paletteColors[6] = COLOR_06;
+	_paletteColors[7] = COLOR_07;
+	_paletteColors[8] = COLOR_08;
+	_paletteColors[9] = COLOR_09;
+	_paletteColors[10] = COLOR_10;
+	_paletteColors[11] = COLOR_11;
+	_paletteColors[12] = COLOR_12;
+	_paletteColors[13] = COLOR_13;
+	_paletteColors[14] = COLOR_14;
+	_paletteColors[15] = COLOR_15;
+
+	for (int i = 16; i < 128; i++) {
+		_paletteColors[i] = {0, 0, 0, 0};
+	}
+
+	_paletteColors[128] = COLOR_128;
+	_paletteColors[129] = COLOR_129;
+	_paletteColors[130] = COLOR_130;
+	_paletteColors[131] = COLOR_131;
+	_paletteColors[132] = COLOR_132;
+	_paletteColors[133] = COLOR_133;
+	_paletteColors[134] = COLOR_134;
+	_paletteColors[135] = COLOR_135;
+	_paletteColors[136] = COLOR_136;
+	_paletteColors[137] = COLOR_137;
+	_paletteColors[138] = COLOR_138;
+	_paletteColors[139] = COLOR_139;
+	_paletteColors[140] = COLOR_140;
+	_paletteColors[141] = COLOR_141;
+	_paletteColors[142] = COLOR_142;
+	_paletteColors[143] = COLOR_143;
+}
+
+Color* Host::GetPaletteColors(){
+    return _paletteColors;
+}