V-Gears 0
Free Final Fantasy VII engine.
WorldDisassembler.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
19
20class WorldEngine;
21
23
24 public:
25
33 WorldDisassembler(WorldEngine* engine, InstVec& insts, int script_number);
34
39
43 void DoDisassemble() override;
44
45 private:
46
61 template<typename T> void ParseOpcode(
62 int opcode, std::string name, T instruction, int stack_change, const char* argument_format
63 ){
64 uint32 full_opcode = (full_opcode << 8) + opcode;
65 this->insts_.push_back(instruction);
66 this->insts_.back()->SetOpcode(full_opcode);
67 this->insts_.back()->SetAddress(this->address_);
68 this->insts_.back()->SetStackChange(0);
69 this->insts_.back()->SetName(std::string(name));
70 this->insts_.back()->SetCodeGenData("");
71 this->ReadParams(this->insts_.back(), argument_format);
72 }
73
78};
std::vector< InstPtr > InstVec
Type representing a vector of InstPtrs.
Definition: Instruction.h:382
Base class for disassemblers.
Definition: Disassembler.h:28
uint32 address_
The current address.
Definition: Disassembler.h:130
void ReadParams(InstPtr inst, const char *types)
Read parameters and associate them with an instruction.
Definition: Disassembler.cpp:58
InstVec & insts_
List of disassembled instructions.
Definition: Disassembler.h:120
Definition: WorldDisassembler.h:22
WorldDisassembler(WorldEngine *engine, InstVec &insts, int script_number)
CConstructor.
Definition: WorldDisassembler.cpp:30
void ParseOpcode(int opcode, std::string name, T instruction, int stack_change, const char *argument_format)
Parses an opcode.
Definition: WorldDisassembler.h:61
void DoDisassemble() override
Disassembles the instructions.
Definition: WorldDisassembler.cpp:66
~WorldDisassembler()
Destructor.
Definition: WorldDisassembler.cpp:33
int script_number_
The script number.
Definition: WorldDisassembler.h:77
Represents the FF7 world map engine.
Definition: WorldEngine.h:29
unsigned int uint32
Definition: scummsys.h:435