C++ bindings for R3000GTE

This commit is contained in:
angie 2023-04-30 12:36:32 -04:00
parent e249be9f38
commit bf775c7351
4 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,28 @@
/* SPDX-FileCopyrightText: © 2023 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#ifndef RABBITIZER_INSTRUCTION_R3000GTE_HPP
#define RABBITIZER_INSTRUCTION_R3000GTE_HPP
#pragma once
#include "InstructionBase.hpp"
namespace rabbitizer {
class InstructionR3000GTE : public InstructionBase {
public:
InstructionR3000GTE(uint32_t word, uint32_t vram);
virtual ~InstructionR3000GTE();
uint8_t GetR3000GTE_fakeOpcode() const;
uint8_t GetR3000GTE_sf() const;
uint8_t GetR3000GTE_mx() const;
uint8_t GetR3000GTE_v() const;
uint8_t GetR3000GTE_cv() const;
uint8_t GetR3000GTE_lm() const;
};
};
#endif

View File

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: © 2022 Decompollaborate */
/* SPDX-FileCopyrightText: © 2022-2023 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#ifndef RABBITIZER_HPP
@ -17,6 +17,7 @@
#include "instructions/InstructionBase.hpp"
#include "instructions/InstructionCpu.hpp"
#include "instructions/InstructionRsp.hpp"
#include "instructions/InstructionR3000GTE.hpp"
#include "instructions/InstructionR5900.hpp"
#include "analysis/LoPairingInfo.hpp"

View File

@ -0,0 +1,39 @@
/* SPDX-FileCopyrightText: © 2023 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#include "instructions/InstructionR3000GTE.hpp"
#include "instructions/RabbitizerInstructionR3000GTE.h"
using namespace rabbitizer;
InstructionR3000GTE::InstructionR3000GTE(uint32_t word, uint32_t vram) : InstructionBase() {
RabbitizerInstructionR3000GTE_init(&this->instr, word, vram);
RabbitizerInstructionR3000GTE_processUniqueId(&this->instr);
}
InstructionR3000GTE::~InstructionR3000GTE() {
RabbitizerInstructionR3000GTE_destroy(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_fakeOpcode() const {
return RAB_INSTR_R3000GTE_GET_FAKE_OPCODE(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_sf() const {
return RAB_INSTR_R3000GTE_GET_sf(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_mx() const {
return RAB_INSTR_R3000GTE_GET_mx(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_v() const {
return RAB_INSTR_R3000GTE_GET_v(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_cv() const {
return RAB_INSTR_R3000GTE_GET_cv(&this->instr);
}
uint8_t InstructionR3000GTE::GetR3000GTE_lm() const {
return RAB_INSTR_R3000GTE_GET_lm(&this->instr);
}

View File

@ -23,3 +23,10 @@ pub fn shiftl(v: u32, s: u32, w: u32) -> u32 {
pub fn shiftr(v: u32, s: u32, w: u32) -> u32 {
mask(v >> s, w)
}
pub fn convert_option_string_to_option_str(input: &Option<String>) -> Option<&str> {
match input {
None => None,
Some(x) => Some(x.as_str())
}
}