mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-23 18:45:51 -05:00
The active codes vector cannot safely be used outside the mutex, move the lock out into RunCodeHandler. s_code_handler_installed was also racing against SetActiveCodes since it's being written both inside and outside the lock. General cleanup. Add s_ prefixes, use constexpr, remove C casts.
40 lines
697 B
C++
40 lines
697 B
C++
// Copyright 2010 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
namespace Gecko
|
|
{
|
|
class GeckoCode
|
|
{
|
|
public:
|
|
GeckoCode() : enabled(false) {}
|
|
struct Code
|
|
{
|
|
u32 address = 0;
|
|
u32 data = 0;
|
|
std::string original_line;
|
|
};
|
|
|
|
std::vector<Code> codes;
|
|
std::string name, creator;
|
|
std::vector<std::string> notes;
|
|
|
|
bool enabled;
|
|
bool user_defined;
|
|
|
|
bool Compare(const GeckoCode& compare) const;
|
|
bool Exist(u32 address, u32 data) const;
|
|
};
|
|
|
|
void SetActiveCodes(const std::vector<GeckoCode>& gcodes);
|
|
void RunCodeHandler();
|
|
|
|
} // namespace Gecko
|