Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create mario.py #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Create mario.py
jackcravens6651 authored Sep 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit fec21530e6ea992238bd1693de139bfd15b7f71e
101 changes: 101 additions & 0 deletions mario.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
source/Emulation/MemoryAccess.cpp
source/Emulation/PPU.cpp
source/SMB/SMB.cpp
source/SMB/SMBData.cpp
source/SMB/SMBEngine.cpp
source/Util/Video.cpp)

4 changes: 4 additions & 0 deletions4
codegen/asm6502.y
Original file line number Diff line number Diff line change
@@ -376,6 +376,10 @@ int main(int argc, char** argv)
std::ofstream sourceFile(sourceFilePath.c_str());
sourceFile << translator.getSourceOutput();

std::string dataFilePath = outputDir + "/source/SMB/SMBData.cpp";
std::ofstream dataFile(dataFilePath.c_str());
dataFile << translator.getDataOutput();

std::string dataHeaderFilePath = outputDir + "/source/SMB/SMBDataPointers.hpp";
std::ofstream dataHeaderFile(dataHeaderFilePath.c_str());
dataHeaderFile << translator.getDataHeaderOutput();
10 changes: 9 additions & 1 deletion10
codegen/translator.cpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ Translator::Translator(const std::string& inputFilename, RootNode* astRootNode)
sourceOutput << AUTOGENERATED_FILE_MESSAGE;
constantHeaderOutput << AUTOGENERATED_FILE_MESSAGE;
dataHeaderOutput << AUTOGENERATED_FILE_MESSAGE;
dataOutput << AUTOGENERATED_FILE_MESSAGE;

translate();
}
@@ -36,6 +37,11 @@ std::string Translator::getConstantHeaderOutput() const
return constantHeaderOutput.str();
}

std::string Translator::getDataOutput() const
{
return dataOutput.str();
}

std::string Translator::getDataHeaderOutput() const
{
return dataHeaderOutput.str();
@@ -513,7 +519,9 @@ void Translator::generateDataDeclarations()
dataHeaderOutput << addressDefines.str();
dataHeaderOutput<< "#endif // SMBDATAPOINTERS_HPP\n";

sourceOutput << loading.str();
dataOutput <<
"#include \"SMB.hpp\"\n\n";
dataOutput << loading.str();
}

void Translator::indexEmptyLines()
2 changes: 2 additions & 0 deletions2
codegen/translator.hpp
Original file line number Diff line number Diff line change
@@ -13,12 +13,14 @@ class Translator
Translator(const std::string& inputFilename, RootNode* astRootNode);

std::string getConstantHeaderOutput() const;
std::string getDataOutput() const;
std::string getDataHeaderOutput() const;
std::string getSourceOutput() const;

private:
std::string inputFilename;
std::stringstream constantHeaderOutput;
std::stringstream dataOutput;
std::stringstream dataHeaderOutput;
std::stringstream sourceOutput;
RootNode* root;
3,585 changes: 0 additions & 3,585 deletions3,585
source/SMB/SMB.cpp
Large diffs are not rendered by default.

3,590 changes: 3,590 additions & 0 deletions3,590
source/SMB/SMBData.cpp
Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions4
source/SMB/SMBEngine.hpp
Original file line number Diff line number Diff line change
@@ -93,6 +93,8 @@ class SMBEngine

/**
* Run the decompiled code for the game.
*
* See SMB.cpp for implementation.
*
* @param mode the mode to run. 0 runs initialization routines, 1 runs the logic for frames.
*/
@@ -131,6 +133,8 @@ class SMBEngine

/**
* Load all constant data that was present in the SMB ROM.
*
* See SMBData.cpp for implementation.
*/
void loadConstantData();