Skip to content

Commit

Permalink
Merge pull request dolphin-emu#8215 from CookiePLMonster/appverifier-…
Browse files Browse the repository at this point in the history
…sanitize

Fixed various errors spotted with Application Verifier
  • Loading branch information
stenzek authored Jun 29, 2019
2 parents f151570 + 5f0b4d8 commit e388f01
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Source/Android/jni/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool first_o

if (first_open)
{
DolphinAnalytics::Instance()->ReportDolphinStart(GetAnalyticValue("DEVICE_TYPE"));
DolphinAnalytics::Instance().ReportDolphinStart(GetAnalyticValue("DEVICE_TYPE"));
}

WiimoteReal::InitAdapterClass();
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Common/HttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ HttpRequest::Response HttpRequest::Impl::Fetch(const std::string& url, Method me
curl_easy_getinfo(m_curl.get(), CURLINFO_RESPONSE_CODE, &response_code);
if (response_code != 200)
{
ERROR_LOG(COMMON, "Failed to %s %s: server replied with code %li and body\n\x1b[0m%s", type,
url.c_str(), response_code, buffer.data());
ERROR_LOG(COMMON, "Failed to %s %s: server replied with code %li and body\n\x1b[0m%.*s", type,
url.c_str(), response_code, static_cast<int>(buffer.size()), buffer.data());
return {};
}

Expand Down
10 changes: 3 additions & 7 deletions Source/Core/Core/Analytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,10 @@ DolphinAnalytics::DolphinAnalytics()
MakeBaseBuilder();
}

std::shared_ptr<DolphinAnalytics> DolphinAnalytics::Instance()
DolphinAnalytics& DolphinAnalytics::Instance()
{
std::lock_guard lk{s_instance_mutex};
if (!s_instance)
{
s_instance.reset(new DolphinAnalytics());
}
return s_instance;
static DolphinAnalytics instance;
return instance;
}

void DolphinAnalytics::ReloadConfig()
Expand Down
7 changes: 1 addition & 6 deletions Source/Core/Core/Analytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DolphinAnalytics
{
public:
// Performs lazy-initialization of a singleton and returns the instance.
static std::shared_ptr<DolphinAnalytics> Instance();
static DolphinAnalytics& Instance();

#if defined(ANDROID)
// Get value from java.
Expand Down Expand Up @@ -124,9 +124,4 @@ class DolphinAnalytics

std::mutex m_reporter_mutex;
Common::AnalyticsReporter m_reporter;

// Shared pointer in order to allow for multithreaded use of the instance and
// avoid races at reinitialization time.
static inline std::mutex s_instance_mutex;
static inline std::shared_ptr<DolphinAnalytics> s_instance;
};
2 changes: 1 addition & 1 deletion Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
HLE::Reload();
PatchEngine::Reload();
HiresTexture::Update();
DolphinAnalytics::Instance()->ReportGameStart();
DolphinAnalytics::Instance().ReportGameStart();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
Common::SetCurrentThreadName("CPU-GPU thread");

// This needs to be delayed until after the video backend is ready.
DolphinAnalytics::Instance()->ReportGameStart();
DolphinAnalytics::Instance().ReportGameStart();

if (_CoreParameter.bFastmem)
EMM::InstallExceptionHandler(); // Let's run under memory watch
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ bool Wiimote::ProcessReadDataRequest()
m_read_request.address + m_read_request.size > CameraLogic::REPORT_DATA_OFFSET;

if (is_reading_ext || is_reading_ir)
DolphinAnalytics::Instance()->ReportGameQuirk(GameQuirk::DIRECTLY_READS_WIIMOTE_INPUT);
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::DIRECTLY_READS_WIIMOTE_INPUT);

// Top byte of address is ignored on the bus, but it IS maintained in the read-reply.
auto const bytes_read = m_i2c_bus.BusRead(
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/PPCCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ u32 InstructionCache::ReadInstruction(u32 addr)
{
INFO_LOG(POWERPC, "ICache read at %08x returned stale data: CACHED: %08x vs. RAM: %08x", addr,
res, inmem);
DolphinAnalytics::Instance()->ReportGameQuirk(GameQuirk::ICACHE_MATTERS);
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::ICACHE_MATTERS);
}
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinNoGUI/MainNoGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int main(int argc, char* argv[])
sigaction(SIGINT, &sa, nullptr);
sigaction(SIGTERM, &sa, nullptr);

DolphinAnalytics::Instance()->ReportDolphinStart("nogui");
DolphinAnalytics::Instance().ReportDolphinStart("nogui");

if (!BootManager::BootCore(std::move(boot), s_platform->GetWindowSystemInfo()))
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinQt/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ int main(int argc, char* argv[])
int retval;

{
DolphinAnalytics::Instance()->ReportDolphinStart("qt");
DolphinAnalytics::Instance().ReportDolphinStart("qt");

MainWindow win{std::move(boot), static_cast<const char*>(options.get("movie"))};
if (options.is_set("debugger"))
Expand Down Expand Up @@ -210,7 +210,7 @@ int main(int argc, char* argv[])
SConfig::GetInstance().m_analytics_permission_asked = true;
Settings::Instance().SetAnalyticsEnabled(answer == QMessageBox::Yes);

DolphinAnalytics::Instance()->ReloadConfig();
DolphinAnalytics::Instance().ReloadConfig();
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DolphinQt/Settings/GeneralPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void GeneralPane::OnSaveConfig()

#if defined(USE_ANALYTICS) && USE_ANALYTICS
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
DolphinAnalytics::Instance()->ReloadConfig();
DolphinAnalytics::Instance().ReloadConfig();
#endif
settings.bCPUThread = m_checkbox_dualcore->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
Expand All @@ -325,8 +325,8 @@ void GeneralPane::OnSaveConfig()
#if defined(USE_ANALYTICS) && USE_ANALYTICS
void GeneralPane::GenerateNewIdentity()
{
DolphinAnalytics::Instance()->GenerateNewIdentity();
DolphinAnalytics::Instance()->ReloadConfig();
DolphinAnalytics::Instance().GenerateNewIdentity();
DolphinAnalytics::Instance().ReloadConfig();
ModalMessageBox message_box(this);
message_box.setIcon(QMessageBox::Information);
message_box.setWindowTitle(tr("Identity Generation"));
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/RenderBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6
perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
perf_sample.num_prims = stats.thisFrame.numPrims + stats.thisFrame.numDLPrims;
perf_sample.num_draw_calls = stats.thisFrame.numDrawCalls;
DolphinAnalytics::Instance()->ReportPerformanceInfo(std::move(perf_sample));
DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));

if (IsFrameDumping())
DumpCurrentFrame(xfb_entry->texture.get(), xfb_rect, ticks);
Expand Down
22 changes: 20 additions & 2 deletions Source/DSPTool/DSPTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,39 @@ int main(int argc, const char* argv[])
{
const std::string argument = argv[i];
if (argument == "-d")
{
disassemble = true;
}
else if (argument == "-o")
output_name = argv[++i];
{
if (++i < argc)
output_name = argv[i];
}
else if (argument == "-h")
output_header_name = argv[++i];
{
if (++i < argc)
output_header_name = argv[i];
}
else if (argument == "-c")
{
compare = true;
}
else if (argument == "-s")
{
outputSize = true;
}
else if (argument == "-m")
{
multiple = true;
}
else if (argument == "-f")
{
force = true;
}
else if (argument == "-p")
{
print_results = true;
}
else if (argument == "-ps")
{
print_results = true;
Expand Down

0 comments on commit e388f01

Please sign in to comment.