本文整理汇总了C++中Memory::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Memory::Initialize方法的具体用法?C++ Memory::Initialize怎么用?C++ Memory::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memory
的用法示例。
在下文中一共展示了Memory::Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
/*
if (argc < 2)
{
cerr << "Usage: " << argv[0] << " rom" << endl;
return 1;
}
*/
//string romName(argv[1]);
string romName("C:\\Users\\Gauthier\\Desktop\\Pokemon_red.gb");
ifstream romFile(romName, ios::binary);
if (!romFile.is_open())
{
cerr << "Couldn't open rom " << romName << endl;
return 1;
}
string romContent;
romFile.seekg(0, std::ios::end);
romContent.reserve((size_t) romFile.tellg());
romContent.resize((size_t) romFile.tellg());
romFile.seekg(0, std::ios::beg);
romFile.read(&romContent[0], romContent.length());
CartridgeInfo_t cartridgeInfo;
ReadRomInformation((unsigned char*)&romContent[0x0134], cartridgeInfo);
Memory memory;
memory.Initialize(romContent, cartridgeInfo);
InterruptsHandler interruptsHandler;
interruptsHandler.Initialize(memory);
CPU cpu(memory, interruptsHandler);
cpu.Initialize(cartridgeInfo);
while (true)
{
cpu.Step(true);
}
return 0;
}