1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Stdafx: Major header cleanup

This commit is contained in:
Sacha 2014-07-11 21:59:13 +10:00
parent 14050c7302
commit 6e06fdf638
41 changed files with 68 additions and 217 deletions

View File

@ -1,88 +0,0 @@
#pragma once
template<typename T, size_t size> class SizedStack
{
T m_ptr[size];
uint m_count;
public:
SizedStack()
{
Clear();
}
~SizedStack()
{
Clear();
}
void Clear()
{
m_count = 0;
}
bool Pop(T& dst)
{
if(!m_count)
return false;
dst = m_ptr[--m_count];
return true;
}
bool Push(const T& src)
{
if(m_count + 1 > size)
return false;
m_ptr[m_count++] = src;
return true;
}
size_t GetFreeCount() const
{
return size - m_count;
}
size_t GetCount() const
{
return m_count;
}
size_t GetMaxCount() const
{
return size;
}
};
template<typename T> struct ScopedPtr
{
private:
T* m_ptr;
public:
ScopedPtr() : m_ptr(nullptr)
{
}
ScopedPtr(T* ptr) : m_ptr(ptr)
{
}
~ScopedPtr()
{
Swap(nullptr);
}
operator T*() { return m_ptr; }
operator const T*() const { return m_ptr; }
T* operator ->() { return m_ptr; }
const T* operator ->() const { return m_ptr; }
void Swap(T* ptr)
{
delete m_ptr;
m_ptr = ptr;
}
};

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/SSemaphore.h"
#include "Emu/System.h"
void SSemaphore::wait()
{
@ -84,4 +85,4 @@ bool SSemaphore::post_and_wait()
wait();
return true;
}
}

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Thread.h"

View File

@ -1,5 +1,4 @@
#pragma once
#include "Array.h"
#include <functional>
#include <thread>
#include <vector>
@ -8,6 +7,13 @@
#include <condition_variable>
#include <Utilities/SSemaphore.h>
static std::thread::id main_thread;
struct rThread
{
static bool IsMain() { std::this_thread::get_id() == main_thread; }
};
class ThreadExec;
class NamedThreadBase

View File

@ -1,41 +0,0 @@
#include "stdafx.h"
rTimer::rTimer()
{
handle = reinterpret_cast<void*>(new wxTimer());
}
rTimer::~rTimer()
{
delete reinterpret_cast<wxTimer*>(handle);
}
void rTimer::Start()
{
reinterpret_cast<wxTimer*>(handle)->Start();
}
void rTimer::Stop()
{
reinterpret_cast<wxTimer*>(handle)->Stop();
}
void rSleep(u32 time)
{
wxSleep(time);
}
void rMicroSleep(u64 time)
{
wxMicroSleep(time);
}
bool rThread::IsMain()
{
return wxThread::IsMain();
}
void rYieldIfNeeded()
{
wxYieldIfNeeded();
}

View File

@ -1,22 +0,0 @@
#pragma once
struct rTimer
{
rTimer();
rTimer(const rTimer& other) = delete;
~rTimer();
void Start();
void Stop();
private:
void *handle;
};
void rSleep(u32 time);
void rMicroSleep(u64 time);
struct rThread
{
static bool IsMain();
};
void rYieldIfNeeded();

View File

@ -2,6 +2,7 @@
#include <memory>
#include "Utilities/rXml.h"
#include <wx/xml/xml.h>
rXmlNode::rXmlNode()

View File

@ -1,3 +1,5 @@
#pragma once
/*
* Copyright 2001-2004 Unicode, Inc.
*

View File

@ -66,8 +66,6 @@ ${wxWidgets_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
"${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/include"
"${RPCS3_SRC_DIR}"
"${RPCS3_SRC_DIR}/Emu"
"${RPCS3_SRC_DIR}/Gui"
"${RPCS3_SRC_DIR}/Loader"
"${RPCS3_SRC_DIR}/Crypto"
"${RPCS3_SRC_DIR}/.."

View File

@ -1,3 +1,5 @@
#pragma once
/**
* \file aes.h
*
@ -174,4 +176,4 @@ void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#include <string.h>
int decode_range(unsigned int *range, unsigned int *code, unsigned char **src);

View File

@ -1,3 +1,4 @@
#pragma once
/**
* \file sha1.h
*
@ -158,4 +159,4 @@ void sha1_hmac( const unsigned char *key, size_t keylen,
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Emu/System.h"
#include "rpcs3/Ini.h"
#include "OpenALThread.h"

View File

@ -1,7 +1,5 @@
#ifndef PPUTHREAD_H
#define PPUTHREAD_H
#pragma once
#include "Emu/Cell/PPCThread.h"
#include "Emu/SysCalls/SysCalls.h"
#include <cmath>
enum
@ -861,4 +859,4 @@ protected:
};
PPUThread& GetCurrentPPUThread();
#endif //PPUTHREAD_H

View File

@ -1,5 +1,7 @@
#pragma once
#include "Emu/Memory/Memory.h"
// SPURS defines.
enum SPURSKernelInterfaces
{

View File

@ -2,6 +2,8 @@
#include "PPCThread.h"
#include "Emu/Event.h"
#include "Emu/SysCalls/lv2/sys_spu.h"
#include "Emu/SysCalls/lv2/sys_event.h"
#include "Emu/SysCalls/lv2/sys_time.h"
#include "MFC.h"
#include "Emu/SysCalls/ErrorCodes.h"
#include <mutex>

View File

@ -4,6 +4,7 @@
#include "VFS.h"
#include "Emu/HDD/HDD.h"
#include "vfsDeviceLocalFile.h"
#include "Ini.h"
int sort_devices(const void* _a, const void* _b)
{

View File

@ -1,4 +1,4 @@
#pragma once
//DynamicMemoryBlockBase
template<typename PT>
DynamicMemoryBlockBase<PT>::DynamicMemoryBlockBase()

View File

@ -3,6 +3,8 @@
#include "Utilities/Log.h"
#include "Memory.h"
#include "Emu/System.h"
#include "Ini.h"
MemoryBase Memory;

View File

@ -5,6 +5,7 @@
#endif
#include "MemoryBlock.h"
#include "Emu/SysCalls/Callback.h"
#include <vector>
using std::nullptr_t;

View File

@ -1,8 +1,6 @@
#pragma once
#include "Emu/Memory/Memory.h"
#define declCPU PPUThread& CPU = GetCurrentPPUThread
#include "Emu/SysCalls/SC_FUNC.h"
//TODO
struct ModuleFunc

View File

@ -1,12 +1,12 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Utilities/rXml.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/FS/vfsDir.h"
#include "wx/xml/xml.h"
#include "sceNp.h"
#include "sceNpTrophy.h"

View File

@ -1,6 +1,8 @@
#pragma once
#include "Emu/Memory/Memory.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SysCalls.h"
#define RESULT(x) SC_ARGS_1 = (x)

View File

@ -3,6 +3,7 @@
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/FS/vfsFile.h"
#include "sys_prx.h"
SysCallBase sys_prx("sys_prx");

View File

@ -3,6 +3,7 @@
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/Cell/PPUThread.h"
#include "sys_semaphore.h"
#include "sys_time.h"

View File

@ -54,7 +54,12 @@ s32 sys_timer_start(u32 timer_id, s64 base_time, u64 period)
timer_data->timer_information_t.period = period;
timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_RUN;
//TODO: ?
timer_data->tmr.Start();
std::function<s32()> task(std::bind(sys_timer_stop, timer_id));
std::thread([period, task]() {
std::this_thread::sleep_for(std::chrono::milliseconds(period));
task();
}).detach();
return CELL_OK;
}
@ -66,7 +71,6 @@ s32 sys_timer_stop(u32 timer_id)
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH;
timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_STOP;
timer_data->tmr.Stop();
return CELL_OK;
}
@ -100,7 +104,7 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id)
s32 sys_timer_sleep(u32 sleep_time)
{
sys_timer.Warning("sys_timer_sleep(sleep_time=%d)", sleep_time);
rSleep(sleep_time);
std::this_thread::sleep_for(std::chrono::seconds(sleep_time));
return CELL_OK;
}
@ -108,6 +112,6 @@ s32 sys_timer_usleep(u64 sleep_time)
{
sys_timer.Log("sys_timer_usleep(sleep_time=%lld)", sleep_time);
if (sleep_time > 0xFFFFFFFFFFFF) sleep_time = 0xFFFFFFFFFFFF; //2^48-1
rMicroSleep(sleep_time); //TODO: If (sleep_time >= 2^32) shit may happen
std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));
return CELL_OK;
}
}

View File

@ -16,7 +16,6 @@ struct sys_timer_information_t
struct timer
{
rTimer tmr;
sys_timer_information_t timer_information_t;
};

View File

@ -9,6 +9,7 @@
#include "Emu/Audio/AudioManager.h"
#include "Emu/FS/VFS.h"
#include "Emu/DbgCommand.h"
#include "Emu/SysCalls/Static.h"
#include "Loader/Loader.h"
#include "SysCalls/Callback.h"

View File

@ -1,3 +1,5 @@
#pragma once
class AboutDialog
: public wxDialog
{

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "GSFrame.h"
#include "Emu/System.h"
#include "rpcs3.h"
BEGIN_EVENT_TABLE(GSFrame, wxFrame)

View File

@ -1,3 +1,5 @@
#pragma once
class InstructionEditorDialog
: public wxDialog
{

View File

@ -1,3 +1,5 @@
#pragma once
class RegisterEditorDialog : public wxDialog
{
u64 pc;

View File

@ -2,6 +2,7 @@
#include "Utilities/Log.h"
#include "VHDDManager.h"
#include "TextInputDialog.h"
#include "Ini.h"
#include <wx/busyinfo.h>
VHDDListDropTarget::VHDDListDropTarget(wxListView* parent) : m_parent(parent)

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Utilities/rXml.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "TROPUSR.h"

View File

@ -210,11 +210,9 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Utilities\Array.h" />
<ClInclude Include="..\Utilities\BEType.h" />
<ClInclude Include="..\Utilities\IdManager.h" />
<ClInclude Include="..\Utilities\MTRingbuffer.h" />
<ClInclude Include="..\Utilities\rConcurrency.h" />
<ClInclude Include="..\Utilities\rFile.h" />
<ClInclude Include="..\Utilities\Log.h" />
<ClInclude Include="..\Utilities\rMsgBox.h" />
@ -562,4 +560,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -940,9 +940,6 @@
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\Array.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\BEType.h">
<Filter>Utilities</Filter>
</ClInclude>
@ -979,9 +976,6 @@
<ClInclude Include="..\Utilities\simpleini\SimpleIni.h">
<Filter>Utilities\SimpleIni</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\rConcurrency.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="Emu\DbgCommand.h">
<Filter>Emu</Filter>
</ClInclude>
@ -1097,4 +1091,4 @@
<Filter>Emu\Memory</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

View File

@ -26,6 +26,8 @@ bool Rpcs3App::OnInit()
SetAppName(_PRGNAME_);
wxInitAllImageHandlers();
main_thread = std::this_thread::get_id();
Ini.Load();
m_MainFrame = new MainFrame();

View File

@ -1,5 +1,7 @@
#pragma once
#include "Gui/MainFrame.h"
#include "Emu/DbgCommand.h"
#include "Utilities/Thread.h"
class CPUThread;

View File

@ -155,7 +155,6 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Utilities\rConcurrency.cpp" />
<ClCompile Include="..\Utilities\rFile.cpp" />
<ClCompile Include="..\Utilities\rMsgBox.cpp" />
<ClCompile Include="..\Utilities\rPlatform.cpp" />
@ -192,12 +191,10 @@
<ResourceCompile Include="rpcs3.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Utilities\Array.h" />
<ClInclude Include="..\Utilities\BEType.h" />
<ClInclude Include="..\Utilities\IdManager.h" />
<ClInclude Include="..\Utilities\MTProgressDialog.h" />
<ClInclude Include="..\Utilities\MTRingbuffer.h" />
<ClInclude Include="..\Utilities\rConcurrency.h" />
<ClInclude Include="..\Utilities\rFile.h" />
<ClInclude Include="..\Utilities\rMsgBox.h" />
<ClInclude Include="..\Utilities\rPlatform.h" />
@ -232,4 +229,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -69,9 +69,6 @@
<ClCompile Include="..\Utilities\StrFmt.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="..\Utilities\rConcurrency.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="..\Utilities\rFile.cpp">
<Filter>Utilities</Filter>
</ClCompile>
@ -104,9 +101,6 @@
<ResourceCompile Include="rpcs3.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Utilities\Array.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\IdManager.h">
<Filter>Utilities</Filter>
</ClInclude>
@ -182,9 +176,6 @@
<ClInclude Include="Gui\AboutDialog.h">
<Filter>Gui</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\rConcurrency.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\rFile.h">
<Filter>Utilities</Filter>
</ClInclude>
@ -213,4 +204,4 @@
<Filter>Utilities</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

View File

@ -26,13 +26,13 @@
#include <wx/menuitem.h>
#include <wx/stattext.h>
#include <wx/msgdlg.h>
#include "wx/gauge.h"
#include <wx/gauge.h>
#include <wx/stattext.h>
#include "wx/scrolbar.h"
#include "wx/frame.h"
#include <wx/scrolbar.h>
#include <wx/frame.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include "wx/app.h"
#include <wx/app.h>
#include <wx/timer.h>
#include <wx/listctrl.h>
#include <wx/aui/auibook.h>
@ -66,27 +66,10 @@ typedef int64_t s64;
#include "Utilities/BEType.h"
#include "Utilities/rFile.h"
#include "Utilities/rTime.h"
#include "Utilities/rXml.h"
#include "Utilities/rConcurrency.h"
#include "Utilities/rMsgBox.h"
#include "Utilities/Thread.h"
#include "Utilities/Array.h"
#include "Utilities/Timer.h"
#include "Utilities/IdManager.h"
#include "Emu/SysCalls/Callback.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/FS/vfsDirBase.h"
#include "Emu/FS/vfsFileBase.h"
#include "Emu/FS/vfsLocalDir.h"
#include "Emu/FS/vfsLocalFile.h"
#include "Emu/FS/vfsStream.h"
#include "Emu/FS/vfsStreamMemory.h"
#include "Emu/FS/vfsFile.h"
#include "Emu/FS/vfsDir.h"
#define _PRGNAME_ "RPCS3"
#define _PRGVER_ "0.0.0.4"