mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 05:51:19 +12:00
Merge branch 'main' of https://github.com/lijunyu-cn/Cemu
This commit is contained in:
commit
f712efafac
17 changed files with 41 additions and 51 deletions
|
@ -108,14 +108,8 @@ uint64 PPCTimer_tscToMicroseconds(uint64 us)
|
||||||
uint128_t r{};
|
uint128_t r{};
|
||||||
r.low = _umul128(us, 1000000ULL, &r.high);
|
r.low = _umul128(us, 1000000ULL, &r.high);
|
||||||
|
|
||||||
|
|
||||||
uint64 remainder;
|
uint64 remainder;
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1923
|
|
||||||
const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder);
|
const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder);
|
||||||
#else
|
|
||||||
const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return microseconds;
|
return microseconds;
|
||||||
}
|
}
|
||||||
|
@ -159,12 +153,7 @@ uint64 PPCTimer_getFromRDTSC()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64 remainder;
|
uint64 remainder;
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1923
|
|
||||||
uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder);
|
uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder);
|
||||||
#else
|
|
||||||
uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
_rdtscAcc.low = remainder;
|
_rdtscAcc.low = remainder;
|
||||||
_rdtscAcc.high = 0;
|
_rdtscAcc.high = 0;
|
||||||
|
|
|
@ -242,7 +242,7 @@ LatteParsedGSCopyShader* LatteGSCopyShaderParser_parse(uint8* programData, uint3
|
||||||
// verify if all registers are exported
|
// verify if all registers are exported
|
||||||
for(sint32 i=0; i<shaderContext->numParam; i++)
|
for(sint32 i=0; i<shaderContext->numParam; i++)
|
||||||
{
|
{
|
||||||
if( shaderContext->paramMapping[i].exportParam == 0xFFFF )
|
if( shaderContext->paramMapping[i].exportParam == 0xFF )
|
||||||
debugBreakpoint();
|
debugBreakpoint();
|
||||||
}
|
}
|
||||||
return shaderContext;
|
return shaderContext;
|
||||||
|
|
|
@ -76,23 +76,23 @@ typedef struct
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
// CPU
|
// CPU
|
||||||
volatile uint64 lastCycleCount;
|
uint64 lastCycleCount;
|
||||||
volatile uint64 skippedCycles;
|
uint64 skippedCycles;
|
||||||
volatile uint32 recompilerLeaveCount; // increased everytime the recompiler switches back to interpreter
|
uint32 recompilerLeaveCount; // increased everytime the recompiler switches back to interpreter
|
||||||
volatile uint32 threadLeaveCount; // increased everytime a thread gives up it's timeslice
|
uint32 threadLeaveCount; // increased everytime a thread gives up it's timeslice
|
||||||
// GPU
|
// GPU
|
||||||
volatile uint32 lastUpdate;
|
uint32 lastUpdate;
|
||||||
volatile uint32 frameCounter;
|
uint32 frameCounter;
|
||||||
volatile uint32 drawCallCounter;
|
uint32 drawCallCounter;
|
||||||
volatile uint32 shaderBindCount;
|
uint32 shaderBindCount;
|
||||||
volatile uint64 vertexDataUploaded; // amount of vertex data uploaded to GPU (bytes)
|
uint64 vertexDataUploaded; // amount of vertex data uploaded to GPU (bytes)
|
||||||
volatile uint64 vertexDataCached; // amount of vertex data reused from GPU cache (bytes)
|
uint64 vertexDataCached; // amount of vertex data reused from GPU cache (bytes)
|
||||||
volatile uint64 uniformBankUploadedData; // amount of uniform buffer data (excluding remapped uniforms) uploaded to GPU
|
uint64 uniformBankUploadedData; // amount of uniform buffer data (excluding remapped uniforms) uploaded to GPU
|
||||||
volatile uint64 uniformBankUploadedCount; // number of separate uploads for uniformBankDataUploaded
|
uint64 uniformBankUploadedCount; // number of separate uploads for uniformBankDataUploaded
|
||||||
volatile uint64 indexDataUploaded;
|
uint64 indexDataUploaded;
|
||||||
volatile uint64 indexDataCached;
|
uint64 indexDataCached;
|
||||||
}cycle[PERFORMANCE_MONITOR_TRACK_CYCLES];
|
}cycle[PERFORMANCE_MONITOR_TRACK_CYCLES];
|
||||||
volatile sint32 cycleIndex;
|
sint32 cycleIndex;
|
||||||
// new stats
|
// new stats
|
||||||
LattePerfStatTimer gpuTime_frameTime;
|
LattePerfStatTimer gpuTime_frameTime;
|
||||||
LattePerfStatTimer gpuTime_shaderCreate;
|
LattePerfStatTimer gpuTime_shaderCreate;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Cafe/Filesystem/fsc.h"
|
#include "Cafe/Filesystem/fsc.h"
|
||||||
#include "Cafe/HW/Espresso/PPCState.h"
|
#include "Cafe/HW/Espresso/PPCState.h"
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
static_assert(sizeof(acpMetaXml_t) == 0x3440);
|
static_assert(sizeof(acpMetaXml_t) == 0x3440);
|
||||||
static_assert(offsetof(acpMetaXml_t, title_id) == 0x0000);
|
static_assert(offsetof(acpMetaXml_t, title_id) == 0x0000);
|
||||||
static_assert(offsetof(acpMetaXml_t, boss_id) == 0x0008);
|
static_assert(offsetof(acpMetaXml_t, boss_id) == 0x0008);
|
||||||
|
@ -85,7 +87,7 @@ namespace iosu
|
||||||
return;
|
return;
|
||||||
const char* text = subElement->GetText();
|
const char* text = subElement->GetText();
|
||||||
uint64 value;
|
uint64 value;
|
||||||
if (sscanf(text, "%llx", &value) == 0)
|
if (sscanf(text, "%" SCNx64, &value) == 0)
|
||||||
return;
|
return;
|
||||||
*v = _swapEndianU64(value);
|
*v = _swapEndianU64(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
|
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
|
||||||
#include "util/helpers/fspinlock.h"
|
#include "util/helpers/fspinlock.h"
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ namespace coreinit
|
||||||
// mark current block as free
|
// mark current block as free
|
||||||
block->isFree = _swapEndianU32(1);
|
block->isFree = _swapEndianU32(1);
|
||||||
// attempt to merge with previous block
|
// attempt to merge with previous block
|
||||||
if (_swapEndianU32(block->previousBlock) != NULL)
|
if (_swapEndianU32(block->previousBlock) != MPTR_NULL)
|
||||||
{
|
{
|
||||||
MPTR previousBlockMPTR = _swapEndianU32(block->previousBlock);
|
MPTR previousBlockMPTR = _swapEndianU32(block->previousBlock);
|
||||||
MEMBlockHeapTrackDEPR* previousBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(previousBlockMPTR);
|
MEMBlockHeapTrackDEPR* previousBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(previousBlockMPTR);
|
||||||
|
@ -494,7 +494,7 @@ namespace coreinit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// attempt to merge with next block
|
// attempt to merge with next block
|
||||||
if (_swapEndianU32(block->nextBlock) != NULL)
|
if (_swapEndianU32(block->nextBlock) != MPTR_NULL)
|
||||||
{
|
{
|
||||||
MPTR nextBlockMPTR = _swapEndianU32(block->nextBlock);
|
MPTR nextBlockMPTR = _swapEndianU32(block->nextBlock);
|
||||||
MEMBlockHeapTrackDEPR* nextBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(nextBlockMPTR);
|
MEMBlockHeapTrackDEPR* nextBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(nextBlockMPTR);
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace coreinit
|
||||||
{
|
{
|
||||||
debug_printf("coreinitVirtualMemory_alloc(): Unable to allocate memory\n");
|
debug_printf("coreinitVirtualMemory_alloc(): Unable to allocate memory\n");
|
||||||
debugBreakpoint();
|
debugBreakpoint();
|
||||||
return NULL;
|
return MPTR_NULL;
|
||||||
}
|
}
|
||||||
// check for overlapping regions
|
// check for overlapping regions
|
||||||
OSVirtMemory* virtMemItr = virtualMemoryList;
|
OSVirtMemory* virtMemItr = virtualMemoryList;
|
||||||
|
@ -66,7 +66,7 @@ namespace coreinit
|
||||||
return currentAddress;
|
return currentAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return MPTR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void coreinitExport_OSGetAvailPhysAddrRange(PPCInterpreter_t* hCPU)
|
void coreinitExport_OSGetAvailPhysAddrRange(PPCInterpreter_t* hCPU)
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace snd_core
|
||||||
}
|
}
|
||||||
coreinit::OSInitMutexEx(__AXAppFrameCallbackMutex.GetPtr(), NULL);
|
coreinit::OSInitMutexEx(__AXAppFrameCallbackMutex.GetPtr(), NULL);
|
||||||
for (sint32 i = 0; i < AX_DEV_COUNT; i++)
|
for (sint32 i = 0; i < AX_DEV_COUNT; i++)
|
||||||
__AXDeviceFinalMixCallback[i] = NULL;
|
__AXDeviceFinalMixCallback[i] = MPTR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint32 AXRegisterAppFrameCallback(MPTR funcAddr)
|
sint32 AXRegisterAppFrameCallback(MPTR funcAddr)
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
// printf-style macros that are only active in non-release builds
|
// printf-style macros that are only active in non-release builds
|
||||||
|
|
||||||
#ifdef PUBLIC_RELEASE
|
#ifdef PUBLIC_RELEASE
|
||||||
#define debug_printf //
|
#define debug_printf(...)
|
||||||
#define debug_puts //
|
|
||||||
static void debugBreakpoint() { }
|
static void debugBreakpoint() { }
|
||||||
#else
|
#else
|
||||||
#define debug_printf printf
|
#define debug_printf(...) printf(__VA_ARGS__)
|
||||||
#define debug_puts puts
|
|
||||||
static void debugBreakpoint() {}
|
static void debugBreakpoint() {}
|
||||||
#endif
|
#endif
|
|
@ -26,7 +26,7 @@ void handler_SIGINT(int sig)
|
||||||
* by any mean ends up with a SIGABRT from the standard library destroying
|
* by any mean ends up with a SIGABRT from the standard library destroying
|
||||||
* threads.
|
* threads.
|
||||||
*/
|
*/
|
||||||
exit(0);
|
_Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExceptionHandler_init()
|
void ExceptionHandler_init()
|
||||||
|
|
|
@ -210,6 +210,15 @@ typedef union _LARGE_INTEGER {
|
||||||
inline T& operator^= (T& a, T b) { return reinterpret_cast<T&>( reinterpret_cast<std::underlying_type<T>::type&>(a) ^= static_cast<std::underlying_type<T>::type>(b) ); }
|
inline T& operator^= (T& a, T b) { return reinterpret_cast<T&>( reinterpret_cast<std::underlying_type<T>::type&>(a) ^= static_cast<std::underlying_type<T>::type>(b) ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__) // clang-cl does not have built-in _udiv128
|
||||||
|
inline uint64 _udiv128(uint64 highDividend, uint64 lowDividend, uint64 divisor, uint64 *remainder)
|
||||||
|
{
|
||||||
|
unsigned __int128 dividend = (((unsigned __int128)highDividend) << 64) | ((unsigned __int128)lowDividend);
|
||||||
|
*remainder = (uint64)((dividend % divisor) & 0xFFFFFFFFFFFFFFFF);
|
||||||
|
return (uint64)((dividend / divisor) & 0xFFFFFFFFFFFFFFFF);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define UNREACHABLE __assume(false)
|
#define UNREACHABLE __assume(false)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern "C" uint64 ATTR_MS_ABI udiv128(uint64 low, uint64 hi, uint64 divisor, uint64 *remainder);
|
|
||||||
extern "C" void recompiler_fres();
|
extern "C" void recompiler_fres();
|
||||||
extern "C" void recompiler_frsqrte();
|
extern "C" void recompiler_frsqrte();
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
.code
|
.code
|
||||||
|
|
||||||
udiv128 PROC
|
|
||||||
mov rax, rcx
|
|
||||||
div r8
|
|
||||||
mov [r9], rdx
|
|
||||||
ret
|
|
||||||
udiv128 ENDP
|
|
||||||
|
|
||||||
recompiler_fres PROC
|
recompiler_fres PROC
|
||||||
; store all modified registers
|
; store all modified registers
|
||||||
push rdx
|
push rdx
|
||||||
|
|
|
@ -142,7 +142,7 @@ int CemuApp::OnExit()
|
||||||
#if BOOST_OS_WINDOWS
|
#if BOOST_OS_WINDOWS
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
#else
|
#else
|
||||||
exit(0);
|
_Exit(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
#if BOOST_OS_WINDOWS
|
#if BOOST_OS_WINDOWS
|
||||||
#define exit(__c) ExitProcess(__c)
|
#define exit(__c) ExitProcess(__c)
|
||||||
|
#else
|
||||||
|
#define exit(__c) _Exit(__c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||||
|
|
|
@ -216,7 +216,7 @@ DefaultControllerSettings::DefaultControllerSettings(wxWindow* parent, const wxP
|
||||||
|
|
||||||
m_timer = new wxTimer(this);
|
m_timer = new wxTimer(this);
|
||||||
Bind(wxEVT_TIMER, &DefaultControllerSettings::on_timer, this);
|
Bind(wxEVT_TIMER, &DefaultControllerSettings::on_timer, this);
|
||||||
m_timer->Start();
|
m_timer->Start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultControllerSettings::~DefaultControllerSettings()
|
DefaultControllerSettings::~DefaultControllerSettings()
|
||||||
|
|
|
@ -234,7 +234,7 @@ WiimoteControllerSettings::WiimoteControllerSettings(wxWindow* parent, const wxP
|
||||||
|
|
||||||
m_timer = new wxTimer(this);
|
m_timer = new wxTimer(this);
|
||||||
Bind(wxEVT_TIMER, &WiimoteControllerSettings::on_timer, this);
|
Bind(wxEVT_TIMER, &WiimoteControllerSettings::on_timer, this);
|
||||||
m_timer->Start();
|
m_timer->Start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
WiimoteControllerSettings::~WiimoteControllerSettings()
|
WiimoteControllerSettings::~WiimoteControllerSettings()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue