foxygit / fake-08-xbox360 Log in
commit 3b6eb55d6a11a273a675e01088eed3686cf12534
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Wed May 11 07:42:51 2022 -0600
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Wed May 11 07:42:51 2022 -0600

    normalize white space in vm.cpp
---
 source/vm.cpp | 184 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 92 insertions(+), 92 deletions(-)

diff --git a/source/vm.cpp b/source/vm.cpp
index 3a35528..57e538a 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -173,17 +173,17 @@ bool Vm::loadCart(Cart* cart) {
     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);
-
+    //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
@@ -302,23 +302,23 @@ bool Vm::loadCart(Cart* cart) {
         //trigger closing of cart and reload of bios
         return false;
     }
-
-	#if LOAD_PACK_INS
-	if(cart->FullCartPath == SettingsCartName){
-
-		std::string enablepackins = "showpackinoptions = true";
-		int doStrRes = luaL_dostring(_luaState, enablepackins.c_str());
-
-		if (doStrRes != LUA_OK){
-			//bad lua passed
-			Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
-			lua_pop(_luaState, 1);
-		}
-
-
-	}
-
-	#endif
+
+    #if LOAD_PACK_INS
+    if(cart->FullCartPath == SettingsCartName){
+
+        std::string enablepackins = "showpackinoptions = true";
+        int doStrRes = luaL_dostring(_luaState, enablepackins.c_str());
+
+        if (doStrRes != LUA_OK){
+            //bad lua passed
+            Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
+            lua_pop(_luaState, 1);
+        }
+
+
+    }
+
+    #endif

     // Push the _init function on the top of the lua stack (or nil if it doesn't exist)
     lua_getglobal(_luaState, "_init");
@@ -399,7 +399,7 @@ void Vm::LoadCart(std::string filename){
         LoadBiosCart();
         return;
     }
-	if (filename == "__FAKE08-SETTINGS.p8") {
+    if (filename == "__FAKE08-SETTINGS.p8") {
         LoadSettingsCart();
         return;
     }
@@ -632,33 +632,33 @@ string Vm::GetBiosError() {

 void Vm::GameLoop() {
     while (_host->shouldRunMainLoop())
-	{
-		//shouldn't need to set this every frame
-		_host->setTargetFps(_targetFps);
+    {
+        //shouldn't need to set this every frame
+        _host->setTargetFps(_targetFps);

-		//is this better at the end of the loop?
-		_host->waitForTargetFps();
+        //is this better at the end of the loop?
+        _host->waitForTargetFps();

-		if (_host->shouldQuit()) break; // break in order to return to hbmenu
-		//this should probably be handled just in the host class
-		_host->changeStretch();
+        if (_host->shouldQuit()) break; // break in order to return to hbmenu
+        //this should probably be handled just in the host class
+        _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
-		//then we don't need to pass them in here
-		UpdateAndDraw();
+        //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
+        //then we don't need to pass them in here
+        UpdateAndDraw();

-		uint8_t* picoFb = GetPicoInteralFb();
-		uint8_t* screenPaletteMap = GetScreenPaletteMap();
+        uint8_t* picoFb = GetPicoInteralFb();
+        uint8_t* screenPaletteMap = GetScreenPaletteMap();

-		_host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);
+        _host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);

-		if (_host->shouldFillAudioBuff()) {
-			FillAudioBuffer(_host->getAudioBufferPointer(), 0, _host->getAudioBufferSize());
+        if (_host->shouldFillAudioBuff()) {
+            FillAudioBuffer(_host->getAudioBufferPointer(), 0, _host->getAudioBufferSize());

-			_host->playFilledAudioBuffer();
-		}
-	}
+            _host->playFilledAudioBuffer();
+        }
+    }
 }

 bool Vm::ExecuteLua(string luaString, string callbackFunction){
@@ -779,10 +779,10 @@ bool Vm::vm_cartdata(string key) {
     //todo: validate hex format
     if (cartDataStr.length() > 0) {
         deserializeCartDataToMemory(cartDataStr);
-		return true;
+        return true;
     } else {
-		return false;
-	}
+        return false;
+    }

     //call host to get current cart data and init- set memory
     //file name should match pico 8: {key}.p8d.txt in the cdata directory
@@ -910,7 +910,7 @@ void Vm::update_buttons() {
     _input->SetState(inputState.KDown, inputState.KHeld);
     if (_memory->drawState.devkitMode) {
         _input->SetMouse(inputState.mouseX, inputState.mouseY, inputState.mouseBtnState);
-		_input->SetKeyboard(inputState.KBdown,inputState.KBkey);
+        _input->SetKeyboard(inputState.KBdown,inputState.KBkey);
     }
     else {
         _input->SetMouse(0, 0, 0);
@@ -944,8 +944,8 @@ void Vm::vm_flip() {

         _host->setTargetFps(_targetFps);

-		uint8_t* picoFb = GetPicoInteralFb();
-		uint8_t* screenPaletteMap = GetScreenPaletteMap();
+        uint8_t* picoFb = GetPicoInteralFb();
+        uint8_t* screenPaletteMap = GetScreenPaletteMap();

         if (_pauseMenu){
             //pause menu probably needs refactor out of lua. For now this is better than just quitting
@@ -958,10 +958,10 @@ void Vm::vm_flip() {
             lua_pop(_luaState, 0);
         }

-		_host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);
+        _host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);

         //is this better at the end of the loop?
-		_host->waitForTargetFps();
+        _host->waitForTargetFps();
     }
 }

@@ -1070,59 +1070,59 @@ std::string Vm::getCartParam() {
 //settings
 int Vm::getSetting(std::string sname) {

-	return _host->getSetting(sname);
-
+    return _host->getSetting(sname);
+
 }

 void Vm::setSetting(std::string sname, int sval) {

-	_host->setSetting(sname,sval);
-
+    _host->setSetting(sname,sval);
+
 }


 void Vm::installPackins() {
     #if LOAD_PACK_INS
-	_host->setSetting("packinloaded",0);
-	_host->unpackCarts();
-	#endif
+    _host->setSetting("packinloaded",0);
+    _host->unpackCarts();
+    #endif
 }




 void Vm::loadLabel(std::string filename, bool mini, int minioffset) {
-
-	auto cartDir = _host->getCartDirectory();
+
+    auto cartDir = _host->getCartDirectory();
     Cart *labelcart = new Cart(filename, cartDir);
-	std::string labelstr = labelcart->LabelString;
-	if(labelstr.length() == 0){
-		labelstr = NoLabelString;
-	}
-	if (mini) {
-		copy_mini_label_to_sprite_memory(_memory->spriteSheetData, labelstr, minioffset);
-	} else {
-		copy_string_to_sprite_memory(_memory->spriteSheetData, labelstr);
-	}
-	delete labelcart;
-
+    std::string labelstr = labelcart->LabelString;
+    if(labelstr.length() == 0){
+        labelstr = NoLabelString;
+    }
+    if (mini) {
+        copy_mini_label_to_sprite_memory(_memory->spriteSheetData, labelstr, minioffset);
+    } else {
+        copy_string_to_sprite_memory(_memory->spriteSheetData, labelstr);
+    }
+    delete labelcart;
+
 }

 std::string Vm::getLuaLine(string filename, int linenumber) {
-
-	auto cartDir = _host->getCartDirectory();
+
+    auto cartDir = _host->getCartDirectory();
     Cart *luacart = new Cart(filename, cartDir);
-	std::string luastr = luacart->LuaString;
-
-	std::string line;
-	std::istringstream luastream(luastr);
-
-	while (linenumber-- >= 0){
-		std::getline(luastream,line);
-	}
-
-	delete luacart;
-
-	return line;
-
+    std::string luastr = luacart->LuaString;
+
+    std::string line;
+    std::istringstream luastream(luastr);
+
+    while (linenumber-- >= 0){
+        std::getline(luastream,line);
+    }
+
+    delete luacart;
+
+    return line;
+
 }
\ No newline at end of file