id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23,530
|
camera.h
|
cemu-project_Cemu/src/Cafe/OS/libs/camera/camera.h
|
#pragma once
namespace camera
{
sint32 CAMOpen(sint32 camHandle);
sint32 CAMClose(sint32 camHandle);
void load();
};
| 122
|
C++
|
.h
| 7
| 15.714286
| 35
| 0.79646
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,531
|
swkbd.h
|
cemu-project_Cemu/src/Cafe/OS/libs/swkbd/swkbd.h
|
void swkbd_render(bool mainWindow);
bool swkbd_hasKeyboardInputHook();
void swkbd_keyInput(uint32 keyCode);
namespace swkbd
{
void load();
}
| 143
|
C++
|
.h
| 7
| 19.142857
| 36
| 0.814815
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,532
|
GX2_Command.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Command.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
#include "Cafe/HW/Espresso/Const.h"
struct GX2WriteGatherPipeState
{
uint8* gxRingBuffer;
// each core has it's own write gatherer and display list state (writing)
uint8* writeGatherPtrGxBuffer[Espresso::CORE_COUNT];
uint8** writeGatherPtrWrite[Espresso::CORE_COUNT];
uint8* writeGatherPtrDisplayList[Espresso::CORE_COUNT];
MPTR displayListStart[Espresso::CORE_COUNT];
uint32 displayListMaxSize[Espresso::CORE_COUNT];
};
extern GX2WriteGatherPipeState gx2WriteGatherPipe;
void GX2ReserveCmdSpace(uint32 reservedFreeSpaceInU32); // move to GX2 namespace eventually
void gx2WriteGather_submitU32AsBE(uint32 v);
void gx2WriteGather_submitU32AsLE(uint32 v);
void gx2WriteGather_submitU32AsLEArray(uint32* v, uint32 numValues);
uint32 PPCInterpreter_getCurrentCoreIndex();
// gx2WriteGather_submit functions
template <typename ...Targs>
inline void gx2WriteGather_submit_(uint32 coreIndex, uint32be* writePtr)
{
(*gx2WriteGatherPipe.writeGatherPtrWrite[coreIndex]) = (uint8*)writePtr;
}
template <typename T, typename ...Targs>
inline void gx2WriteGather_submit_(uint32 coreIndex, uint32be* writePtr, const betype<T>& arg, Targs... args)
{
static_assert(sizeof(betype<T>) == sizeof(uint32be));
*(betype<T>*)writePtr = arg;
writePtr++;
gx2WriteGather_submit_(coreIndex, writePtr, args...);
}
template <typename T, typename ...Targs>
inline
typename std::enable_if< std::is_floating_point<T>::value, void>::type
gx2WriteGather_submit_(uint32 coreIndex, uint32be* writePtr, const T& arg, Targs... args)
{
static_assert(sizeof(T) == sizeof(uint32));
*writePtr = *(uint32*)&arg;
writePtr++;
gx2WriteGather_submit_(coreIndex, writePtr, args...);
}
template <typename T, typename ...Targs>
inline
typename std::enable_if< std::is_base_of<Latte::LATTEREG, T>::value, void>::type
gx2WriteGather_submit_(uint32 coreIndex, uint32be* writePtr, const T& arg, Targs... args)
{
static_assert(sizeof(Latte::LATTEREG) == sizeof(uint32be));
*writePtr = arg.getRawValue();
writePtr++;
gx2WriteGather_submit_(coreIndex, writePtr, args...);
}
template <typename T, typename ...Targs>
inline
typename std::enable_if< !std::is_base_of<Latte::LATTEREG, T>::value && !std::is_floating_point<T>::value, void>::type
gx2WriteGather_submit_(uint32 coreIndex, uint32be* writePtr, const T& arg, Targs... args)
{
*writePtr = arg;
writePtr++;
gx2WriteGather_submit_(coreIndex, writePtr, args...);
}
template <typename ...Targs>
inline void gx2WriteGather_submit(Targs... args)
{
uint32 coreIndex = PPCInterpreter_getCurrentCoreIndex();
if (gx2WriteGatherPipe.writeGatherPtrWrite[coreIndex] == nullptr)
return;
uint32be* writePtr = (uint32be*)(*gx2WriteGatherPipe.writeGatherPtrWrite[coreIndex]);
gx2WriteGather_submit_(coreIndex, writePtr, std::forward<Targs>(args)...);
}
namespace GX2
{
uint32 GX2WriteGather_getReadWriteDistance();
void GX2WriteGather_checkAndInsertWrapAroundMark();
void GX2BeginDisplayList(MEMPTR<void> displayListAddr, uint32 size);
void GX2BeginDisplayListEx(MEMPTR<void> displayListAddr, uint32 size, bool profiling);
uint32 GX2EndDisplayList(MEMPTR<void> displayListAddr);
void GX2CallDisplayList(MPTR addr, uint32 size);
void GX2DirectCallDisplayList(void* addr, uint32 size);
bool GX2GetDisplayListWriteStatus();
void GX2Init_writeGather();
void GX2CommandInit();
void GX2CommandResetToDefaultState();
}
| 3,409
|
C++
|
.h
| 85
| 38.376471
| 118
| 0.788392
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,533
|
GX2_Streamout.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Streamout.h
|
#pragma once
#include "GX2_Resource.h"
#define GX2_MAX_STREAMOUT_BUFFERS 4
namespace GX2
{
struct GX2StreamOutBuffer
{
/* +0x00 */ uint32be size; // size of buffer (if dataPtr is not NULL)
/* +0x04 */ MEMPTR<void> dataPtr;
/* +0x08 */ uint32be vertexStride;
/* +0x0C */ GX2RBuffer rBuffer; // if dataPtr is NULL, use this as the buffer and size
/* +0x1C */ MEMPTR<void> ctxPtr; // stream out context
};
static_assert(sizeof(GX2StreamOutBuffer) == 0x20, "GX2StreamOutBuffer_t has invalid size");
void GX2SetStreamOutBuffer(uint32 bufferIndex, GX2StreamOutBuffer* streamOutBuffer);
void GX2StreamoutInit();
}
| 626
|
C++
|
.h
| 17
| 34.705882
| 92
| 0.742574
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,534
|
GX2_Misc.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Misc.h
|
#pragma once
namespace GX2
{
extern uint32 sGX2MainCoreIndex;
enum class E_TVRES
{
TODO,
};
enum class E_TVBUFFERMODE
{
DOUBLE_BUFFER = 2,
};
void _GX2DriverReset();
void GX2SetTVBuffer(void* imageBuffePtr, uint32 imageBufferSize, E_TVRES tvResolutionMode, uint32 surfaceFormat, E_TVBUFFERMODE bufferMode);
void GX2SetTVGamma(float gamma);
void GX2Invalidate(uint32 invalidationFlags, MPTR invalidationAddr, uint32 invalidationSize);
void GX2MiscInit();
};
| 479
|
C++
|
.h
| 18
| 24.388889
| 141
| 0.806593
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,535
|
GX2_State.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_State.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
namespace GX2
{
struct GX2AlphaTestReg
{
betype<Latte::LATTE_SX_ALPHA_TEST_CONTROL> regAlphaTestControl;
betype<Latte::LATTE_SX_ALPHA_REF> regAlphaTestRef;
};
static_assert(sizeof(GX2AlphaTestReg) == 8);
struct GX2ColorControlReg
{
betype<Latte::LATTE_CB_COLOR_CONTROL> reg;
};
static_assert(sizeof(GX2ColorControlReg) == 4);
struct GX2PolygonControlReg
{
betype<Latte::LATTE_PA_SU_SC_MODE_CNTL> reg;
};
static_assert(sizeof(GX2PolygonControlReg) == 4);
struct GX2PolygonOffsetReg
{
betype<Latte::LATTE_PA_SU_POLY_OFFSET_FRONT_SCALE> regFrontScale;
betype<Latte::LATTE_PA_SU_POLY_OFFSET_FRONT_OFFSET> regFrontOffset;
betype<Latte::LATTE_PA_SU_POLY_OFFSET_BACK_SCALE> regBackScale;
betype<Latte::LATTE_PA_SU_POLY_OFFSET_BACK_OFFSET> regBackOffset;
betype<Latte::LATTE_PA_SU_POLY_OFFSET_CLAMP> regClamp;
};
static_assert(sizeof(GX2PolygonOffsetReg) == 0x14);
struct GX2DepthStencilControlReg
{
betype<Latte::LATTE_DB_DEPTH_CONTROL> reg;
};
static_assert(sizeof(GX2DepthStencilControlReg) == 4);
struct GX2StencilMaskReg
{
betype<Latte::LATTE_DB_STENCILREFMASK> stencilRefMaskFrontReg;
betype<Latte::LATTE_DB_STENCILREFMASK_BF> stencilRefMaskBackReg;
};
static_assert(sizeof(GX2StencilMaskReg) == 8);
struct GX2TargetChannelMaskReg
{
betype<Latte::LATTE_CB_TARGET_MASK> reg;
};
static_assert(sizeof(GX2TargetChannelMaskReg) == 4);
struct GX2HIStencilInfoData
{
/* +0x00 */ uint32be ukn00;
/* +0x04 */ uint8be ukn04;
/* +0x05 */ uint8be ukn05;
/* +0x06 */ uint8be ukn06; // probably padding?
/* +0x07 */ uint8be ukn07; // probably padding?
/* +0x08 */ uint32be isEnable; // 0 or 1
};
static_assert(sizeof(GX2HIStencilInfoData) == 0xC);
struct GX2HiStencilInfoReg
{
GX2HIStencilInfoData state[2];
uint32be reg[2]; // DB_SRESULTS_COMPARE_STATE0 and DB_SRESULTS_COMPARE_STATE1
};
static_assert(sizeof(GX2HiStencilInfoReg) == 0x20);
struct GX2BlendControlReg
{
uint32be index;
betype<Latte::LATTE_CB_BLENDN_CONTROL> reg;
};
static_assert(sizeof(GX2BlendControlReg) == 8);
struct GX2BlendConstantColorReg
{
betype<Latte::LATTE_CB_BLEND_RED> regRed;
betype<Latte::LATTE_CB_BLEND_GREEN> regGreen;
betype<Latte::LATTE_CB_BLEND_BLUE> regBlue;
betype<Latte::LATTE_CB_BLEND_ALPHA> regAlpha;
};
static_assert(sizeof(GX2BlendConstantColorReg) == 16);
struct GX2PointSizeReg
{
betype<Latte::LATTE_PA_SU_POINT_SIZE> reg;
};
static_assert(sizeof(GX2PointSizeReg) == 4);
struct GX2PointLimitsReg
{
betype<Latte::LATTE_PA_SU_POINT_MINMAX> reg;
};
static_assert(sizeof(GX2PointLimitsReg) == 4);
struct GX2ViewportReg
{
betype<Latte::LATTE_PA_CL_VPORT_XSCALE> xScale;
betype<Latte::LATTE_PA_CL_VPORT_XOFFSET> xOffset;
betype<Latte::LATTE_PA_CL_VPORT_YSCALE> yScale;
betype<Latte::LATTE_PA_CL_VPORT_YOFFSET> yOffset;
betype<Latte::LATTE_PA_CL_VPORT_ZSCALE> zScale;
betype<Latte::LATTE_PA_CL_VPORT_ZOFFSET> zOffset;
uint32 ukn[6]; // clipping registers?
};
static_assert(sizeof(GX2ViewportReg) == 48);
struct GX2ScissorReg
{
betype<Latte::LATTE_PA_SC_GENERIC_SCISSOR_TL> scissorTL;
betype<Latte::LATTE_PA_SC_GENERIC_SCISSOR_BR> scissorBR;
};
static_assert(sizeof(GX2ScissorReg) == 8);
using GX2_ALPHAFUNC = Latte::LATTE_SX_ALPHA_TEST_CONTROL::E_ALPHA_FUNC; // alias Latte::E_COMPAREFUNC
using GX2_LOGICOP = Latte::LATTE_CB_COLOR_CONTROL::E_LOGICOP;
using GX2_CHANNELMASK = uint32;
using GX2_BLENDFACTOR = Latte::LATTE_CB_BLENDN_CONTROL::E_BLENDFACTOR;
using GX2_BLENDFUNC = Latte::LATTE_CB_BLENDN_CONTROL::E_COMBINEFUNC;
void GX2InitAlphaTestReg(GX2AlphaTestReg* reg, uint32 alphaTestEnable, GX2_ALPHAFUNC alphaFunc, float alphaRef);
void GX2SetAlphaTestReg(GX2AlphaTestReg* reg);
void GX2SetAlphaTest(uint32 alphaTestEnable, GX2_ALPHAFUNC alphaFunc, float alphaRef);
void GX2InitColorControlReg(GX2ColorControlReg* reg, GX2_LOGICOP logicOp, uint32 blendMask, uint32 multiwriteEnable, uint32 colorBufferEnable);
void GX2SetColorControl(GX2_LOGICOP logicOp, uint32 blendMask, uint32 multiwriteEnable, uint32 colorBufferEnable);
void GX2SetColorControlReg(GX2ColorControlReg* reg);
void GX2InitPolygonControlReg(GX2PolygonControlReg* reg,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_FRONTFACE frontFace, uint32 cullFront, uint32 cullBack,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_POLYGONMODE usePolygonMode,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_PTYPE polyModeFront,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_PTYPE polyModeBack,
uint32 polygonOffsetFrontEnable, uint32 polygonOffsetBackEnable, uint32 paraOffsetEnable);
void GX2SetPolygonControlReg(GX2PolygonControlReg* reg);
void GX2SetPolygonControl(Latte::LATTE_PA_SU_SC_MODE_CNTL::E_FRONTFACE frontFace, uint32 cullFront, uint32 cullBack,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_POLYGONMODE usePolygonMode,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_PTYPE polyModeFront,
Latte::LATTE_PA_SU_SC_MODE_CNTL::E_PTYPE polyModeBack,
uint32 polygonOffsetFrontEnable, uint32 polygonOffsetBackEnable, uint32 paraOffsetEnable);
void GX2SetCullOnlyControl(Latte::LATTE_PA_SU_SC_MODE_CNTL::E_FRONTFACE frontFace, uint32 cullFront, uint32 cullBack);
void GX2InitPolygonOffsetReg(GX2PolygonOffsetReg* reg, float frontOffset, float frontScale, float backOffset, float backScale, float clampOffset);
void GX2SetPolygonOffsetReg(GX2PolygonOffsetReg* reg);
void GX2SetPolygonOffset(float frontOffset, float frontScale, float backOffset, float backScale, float clampOffset);
void GX2InitPointSizeReg(GX2PointSizeReg* reg, float width, float height);
void GX2SetPointSizeReg(GX2PointSizeReg* reg);
void GX2SetPointSize(float width, float height);
void GX2InitPointLimitsReg(GX2PointLimitsReg* reg, float minSize, float maxSize);
void GX2SetPointLimitsReg(GX2PointLimitsReg* reg);
void GX2SetPointLimits(float minSize, float maxSize);
void GX2SetRasterizerClipControl(bool enableRasterizer, bool enableZClip);
void GX2SetRasterizerClipControlHalfZ(bool enableRasterizer, bool enableZClip, bool enableHalfZ);
void GX2SetRasterizerClipControlEx(bool enableRasterizer, bool enableZClip, bool enableHalfZ);
void GX2SetPrimitiveRestartIndex(uint32 restartIndex);
void GX2InitTargetChannelMasksReg(GX2TargetChannelMaskReg* reg, GX2_CHANNELMASK t0, GX2_CHANNELMASK t1, GX2_CHANNELMASK t2, GX2_CHANNELMASK t3, GX2_CHANNELMASK t4, GX2_CHANNELMASK t5, GX2_CHANNELMASK t6, GX2_CHANNELMASK t7);
void GX2SetTargetChannelMasksReg(GX2TargetChannelMaskReg* reg);
void GX2SetTargetChannelMasks(GX2_CHANNELMASK t0, GX2_CHANNELMASK t1, GX2_CHANNELMASK t2, GX2_CHANNELMASK t3, GX2_CHANNELMASK t4, GX2_CHANNELMASK t5, GX2_CHANNELMASK t6, GX2_CHANNELMASK t7);
void GX2InitBlendControlReg(GX2BlendControlReg* reg, uint32 renderTargetIndex, GX2_BLENDFACTOR colorSrcFactor, GX2_BLENDFACTOR colorDstFactor, GX2_BLENDFUNC colorCombineFunc, uint32 separateAlphaBlend, GX2_BLENDFACTOR alphaSrcFactor, GX2_BLENDFACTOR alphaDstFactor, GX2_BLENDFUNC alphaCombineFunc);
void GX2SetBlendControlReg(GX2BlendControlReg* reg);
void GX2SetBlendControl(uint32 renderTargetIndex, GX2_BLENDFACTOR colorSrcFactor, GX2_BLENDFACTOR colorDstFactor, GX2_BLENDFUNC colorCombineFunc, uint32 separateAlphaBlend, GX2_BLENDFACTOR alphaSrcFactor, GX2_BLENDFACTOR alphaDstFactor, GX2_BLENDFUNC alphaCombineFunc);
void GX2InitBlendConstantColorReg(GX2BlendConstantColorReg* reg, float red, float green, float blue, float alpha);
void GX2SetBlendConstantColorReg(GX2BlendConstantColorReg* reg);
void GX2SetBlendConstantColor(float red, float green, float blue, float alpha);
void GX2StateInit();
}
| 7,602
|
C++
|
.h
| 150
| 48.086667
| 299
| 0.805507
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,536
|
GX2_Memory.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Memory.h
|
#pragma once
namespace GX2
{
void GX2MEMAllocatorsInit();
void GX2MemInit();
};
| 83
|
C++
|
.h
| 6
| 12.333333
| 29
| 0.789474
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,537
|
GX2_Shader.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Shader.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
#include "GX2_Streamout.h"
struct GX2FetchShader
{
enum class FetchShaderType : uint32
{
NO_TESSELATION = 0,
};
/* +0x00 */ betype<FetchShaderType> fetchShaderType;
/* +0x04 */ betype<Latte::LATTE_SQ_PGM_RESOURCES_FS> reg_SQ_PGM_RESOURCES_FS;
/* +0x08 */ uint32 shaderSize;
/* +0x0C */ MPTR shaderPtr;
/* +0x10 */ uint32 attribCount;
/* +0x14 */ uint32 divisorCount;
/* +0x18 */ uint32be divisors[2];
MPTR GetProgramAddr() const
{
return _swapEndianU32(shaderPtr);
}
};
static_assert(sizeof(GX2FetchShader) == 0x20);
static_assert(sizeof(betype<GX2FetchShader::FetchShaderType>) == 4);
namespace GX2
{
void GX2ShaderInit();
}
// code below still needs to be modernized (use betype, enum classes, move to namespace)
// deprecated, use GX2_SHADER_MODE enum class instead
#define GX2_SHADER_MODE_UNIFORM_REGISTER 0
#define GX2_SHADER_MODE_UNIFORM_BLOCK 1
#define GX2_SHADER_MODE_GEOMETRY_SHADER 2
#define GX2_SHADER_MODE_COMPUTE_SHADER 3
enum class GX2_SHADER_MODE : uint32
{
UNIFORM_REGISTER = 0,
UNIFORM_BLOCK = 1,
GEOMETRY_SHADER = 2,
COMPUTE_SHADER = 3,
};
struct GX2VertexShader
{
/* +0x000 */
struct
{
/* +0x00 */ betype<Latte::LATTE_SQ_PGM_RESOURCES_VS> SQ_PGM_RESOURCES_VS; // compatible with SQ_PGM_RESOURCES_ES
/* +0x04 */ betype<Latte::LATTE_VGT_PRIMITIVEID_EN> VGT_PRIMITIVEID_EN;
/* +0x08 */ betype<Latte::LATTE_SPI_VS_OUT_CONFIG> SPI_VS_OUT_CONFIG;
/* +0x0C */ uint32be vsOutIdTableSize;
/* +0x10 */ betype<Latte::LATTE_SPI_VS_OUT_ID_N> LATTE_SPI_VS_OUT_ID_N[10];
/* +0x38 */ betype<Latte::LATTE_PA_CL_VS_OUT_CNTL> PA_CL_VS_OUT_CNTL;
/* +0x3C */ uint32be uknReg15; // ?
/* +0x40 */ uint32be semanticTableSize;
/* +0x44 */ betype<Latte::LATTE_SQ_VTX_SEMANTIC_X> SQ_VTX_SEMANTIC_N[32];
/* +0xC4 */ uint32be uknReg49; // ?
/* +0xC8 */ uint32be uknReg50; // vgt_vertex_reuse_block_cntl
/* +0xCC */ uint32be uknReg51; // vgt_hos_reuse_depth
}regs;
/* +0x0D0 */ uint32be shaderSize;
/* +0x0D4 */ MEMPTR<void> shaderPtr;
/* +0x0D8 */ betype<GX2_SHADER_MODE> shaderMode;
/* +0x0DC */ uint32 uniformBlockCount;
/* +0x0E0 */ MPTR uniformBlockInfo;
/* +0x0E4 */ uint32 uniformVarCount;
/* +0x0E8 */ MPTR uniformVarInfo;
/* +0x0EC */ uint32 uknEC;
/* +0x0F0 */ MPTR uknF0;
/* +0x0F4 */ uint32 uknF4;
/* +0x0F8 */ MPTR uknF8; // each entry has 8 byte?
/* +0x0FC */ uint32 samplerCount;
/* +0x100 */ MPTR samplerInfo;
/* +0x104 */ uint32 attribCount;
/* +0x108 */ MPTR attribInfo;
/* +0x10C */ uint32be ringItemsize; // for GS
/* +0x110 */ uint32be usesStreamOut;
/* +0x114 */ uint32be streamOutVertexStride[GX2_MAX_STREAMOUT_BUFFERS];
/* +0x124 */ GX2RBuffer rBuffer;
MPTR GetProgramAddr() const
{
if (this->shaderPtr)
return this->shaderPtr.GetMPTR();
return this->rBuffer.GetVirtualAddr();
}
};
static_assert(sizeof(GX2VertexShader) == 0x134);
typedef struct _GX2PixelShader
{
uint32 regs[41];
// regs:
// 0 ? Used by GPR count API?
// 1 ?
// 2 mmSPI_PS_IN_CONTROL_0
// 3 mmSPI_PS_IN_CONTROL_1
// 4 numInputs
// 5 mmSPI_PS_INPUT_CNTL_0
// ...
// 36 mmSPI_PS_INPUT_CNTL_31
// 37 mmCB_SHADER_MASK
// 38 mmCB_SHADER_CONTROL
// 39 mmDB_SHADER_CONTROL
// 40 mmSPI_INPUT_Z
/* +0xA4 */ uint32 shaderSize;
/* +0xA8 */ MPTR shaderPtr;
/* +0xAC */ uint32 shaderMode;
/* +0xB0 */ uint32 uniformBlockCount;
/* +0xB4 */ MPTR uniformBlockInfo;
/* +0xB8 */ uint32 uniformVarCount;
/* +0xBC */ MPTR uniformVarInfo;
/* +0xC0 */ uint32 uknC0;
/* +0xC4 */ MPTR uknC4;
/* +0xC8 */ uint32 uknC8;
/* +0xCC */ MPTR uknCC;
/* +0xD0 */ uint32 samplerCount;
/* +0xD4 */ MPTR samplerInfo;
/* +0xD8 */ GX2RBuffer rBuffer;
MPTR GetProgramAddr() const
{
if (_swapEndianU32(shaderPtr) != MPTR_NULL)
return _swapEndianU32(shaderPtr);
return rBuffer.GetVirtualAddr();
}
}GX2PixelShader_t;
static_assert(sizeof(GX2PixelShader_t) == 0xE8);
struct GX2GeometryShader_t
{
union
{
/* +0x00 */ uint32 regs[19];
struct
{
uint32be reg0;
uint32be reg1;
uint32be VGT_GS_MODE;
uint32be reg3;
uint32be reg4;
uint32be reg5;
uint32be reg6;
uint32be reg7;
// todo
}reg;
};
/* +0x4C */ uint32 shaderSize;
/* +0x50 */ MPTR shaderPtr;
/* +0x54 */ uint32 copyShaderSize;
/* +0x58 */ MPTR copyShaderPtr;
/* +0x5C */ uint32 shaderMode;
/* +0x60 */ uint32 uniformBlockCount;
/* +0x64 */ MPTR uniformBlockInfo;
/* +0x68 */ uint32 uniformVarCount;
/* +0x6C */ MPTR uniformVarInfo;
/* +0x70 */ uint32 ukn70;
/* +0x74 */ MPTR ukn74;
/* +0x78 */ uint32 ukn78;
/* +0x7C */ MPTR ukn7C;
/* +0x80 */ uint32 samplerCount;
/* +0x84 */ MPTR samplerInfo;
/* +0x88 */ uint32 ringItemsize;
/* +0x8C */ uint32 useStreamout;
/* +0x90 */ uint32 streamoutStride[GX2_MAX_STREAMOUT_BUFFERS];
/* +0xA0 */ GX2RBuffer rBuffer;
/* +0xB0 */ GX2RBuffer rBufferCopyProgram;
MPTR GetGeometryProgramAddr() const
{
if (_swapEndianU32(shaderPtr) != MPTR_NULL)
return _swapEndianU32(shaderPtr);
return rBuffer.GetVirtualAddr();
}
MPTR GetCopyProgramAddr() const
{
if (_swapEndianU32(copyShaderPtr) != MPTR_NULL)
return _swapEndianU32(copyShaderPtr);
return rBufferCopyProgram.GetVirtualAddr();
}
};
static_assert(sizeof(GX2GeometryShader_t) == 0xC0);
| 5,236
|
C++
|
.h
| 175
| 27.685714
| 114
| 0.69623
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,538
|
GX2_Draw.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Draw.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
namespace GX2
{
using GX2IndexType = Latte::LATTE_VGT_DMA_INDEX_TYPE::E_INDEX_TYPE;
using GX2PrimitiveMode2 = Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE;
void GX2SetAttribBuffer(uint32 bufferIndex, uint32 sizeInBytes, uint32 stride, void* data);
void GX2DrawIndexedEx(GX2PrimitiveMode2 primitiveMode, uint32 count, GX2IndexType indexType, void* indexData, uint32 baseVertex, uint32 numInstances);
void GX2DrawInit();
}
| 486
|
C++
|
.h
| 10
| 46.9
| 151
| 0.814346
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,539
|
GX2_Event.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Event.h
|
#pragma once
namespace GX2
{
void GX2Init_event();
void GX2EventResetToDefaultState();
void GX2EventInit();
void GX2WaitForVsync();
void GX2WaitForFlip();
void GX2DrawDone();
enum class GX2CallbackEventType
{
TIMESTAMP_TOP = 0,
TIMESTAMP_BOTTOM = 1,
VSYNC = 2,
FLIP = 3,
// 4 is buffer overrun?
};
inline constexpr size_t GX2CallbackEventTypeCount = 5;
// notification callbacks for GPU
void __GX2NotifyNewRetirementTimestamp(uint64 tsRetire);
void __GX2NotifyEvent(GX2CallbackEventType eventType);
}
| 528
|
C++
|
.h
| 22
| 21.772727
| 57
| 0.778884
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,540
|
GX2.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2.h
|
#pragma once
#include "Cafe/HW/Latte/Core/LatteConst.h"
// base defines for GX2
#define GX2_TRUE 1
#define GX2_FALSE 0
#define GX2_ENABLE 1
#define GX2_DISABLE 0
#include "GX2_Surface.h"
// general
void gx2_load();
// shader
void gx2Export_GX2SetPixelShader(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetGeometryShader(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetComputeShader(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetVertexUniformBlock(PPCInterpreter_t* hCPU);
void gx2Export_GX2RSetVertexUniformBlock(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetPixelUniformBlock(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetGeometryUniformBlock(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetShaderModeEx(PPCInterpreter_t* hCPU);
void gx2Export_GX2CalcGeometryShaderInputRingBufferSize(PPCInterpreter_t* hCPU);
void gx2Export_GX2CalcGeometryShaderOutputRingBufferSize(PPCInterpreter_t* hCPU);
// write gather / command queue
#define GX2_COMMAND_RING_BUFFER_SIZE (64*1024*1024) // 64MB
void gx2Export_GX2GetContextStateDisplayList(PPCInterpreter_t* hCPU);
#include "GX2_Command.h"
// misc
void gx2Export_GX2AllocateTilingApertureEx(PPCInterpreter_t* hCPU);
void gx2Export_GX2FreeTilingAperture(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetSwapInterval(PPCInterpreter_t* hCPU);
void gx2Export_GX2GetSwapInterval(PPCInterpreter_t* hCPU);
void gx2Export_GX2GetSwapStatus(PPCInterpreter_t* hCPU);
void gx2Export_GX2GetGPUTimeout(PPCInterpreter_t* hCPU);
void gx2Export_GX2SampleTopGPUCycle(PPCInterpreter_t* hCPU);
void gx2Export_GX2SampleBottomGPUCycle(PPCInterpreter_t* hCPU);
// color/depth buffers
#define GX2_SCAN_TARGET_TV 1
#define GX2_SCAN_TARGET_TV_RIGH 2
#define GX2_SCAN_TARGET_DRC_FIRST 4
#define GX2_SCAN_TARGET_DRC_SECOND 8
void gx2Export_GX2InitColorBufferRegs(PPCInterpreter_t* hCPU);
void gx2Export_GX2InitDepthBufferRegs(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetColorBuffer(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetDepthBuffer(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetDRCBuffer(PPCInterpreter_t* hCPU);
void gx2Export_GX2MarkScanBufferCopied(PPCInterpreter_t* hCPU);
// special state
#define GX2_SPECIAL_STATE_COUNT 9
// context state
void gx2Export_GX2SetDefaultState(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetupContextStateEx(PPCInterpreter_t* hCPU);
void gx2Export_GX2SetContextState(PPCInterpreter_t* hCPU);
// command buffer
uint32 _GX2GetUnflushedBytes(uint32 coreIndex);
void _GX2SubmitToTCL();
void GX2ReserveCmdSpace(uint32 reservedFreeSpaceInU32);
| 2,515
|
C++
|
.h
| 55
| 44.363636
| 81
| 0.843852
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,541
|
GX2_Resource.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Resource.h
|
#pragma once
// basic resource flags
#define GX2_RESFLAG_USAGE_TEXTURE (1<<0)
#define GX2_RESFLAG_USAGE_COLOR_BUFFER (1<<1)
#define GX2_RESFLAG_USAGE_DEPTH_BUFFER (1<<2)
#define GX2_RESFLAG_USAGE_SCAN_BUFFER (1<<3)
// extended resource flags used by GX2R API
#define GX2R_RESFLAG_USAGE_VERTEX_BUFFER (1<<4)
#define GX2R_RESFLAG_USAGE_INDEX_BUFFER (1<<5)
#define GX2R_RESFLAG_USAGE_UNIFORM_BLOCK (1<<6)
#define GX2R_RESFLAG_USAGE_SHADER_PROGRAM (1<<7)
#define GX2R_RESFLAG_USAGE_STREAM_OUTPUT (1<<8)
#define GX2R_RESFLAG_USAGE_DISPLAY_LIST (1<<9)
#define GX2R_RESFLAG_USAGE_GS_RINGBUFFER (1<<10)
#define GX2R_RESFLAG_USAGE_CPU_READ (1<<11)
#define GX2R_RESFLAG_USAGE_CPU_WRITE (1<<12)
#define GX2R_RESFLAG_USAGE_GPU_READ (1<<13)
#define GX2R_RESFLAG_USAGE_GPU_WRITE (1<<14)
#define GX2R_RESFLAG_USE_MEM1 (1<<17)
#define GX2R_RESFLAG_UKN_BIT_19 (1<<19)
#define GX2R_RESFLAG_UKN_BIT_20 (1<<20)
#define GX2R_RESFLAG_UKN_BIT_21 (1<<21)
#define GX2R_RESFLAG_UKN_BIT_22 (1<<22)
#define GX2R_RESFLAG_UKN_BIT_23 (1<<23)
#define GX2R_RESFLAG_ALLOCATED_BY_GX2R (1<<29)
#define GX2R_RESFLAG_LOCKED (1<<30)
struct GX2RBuffer
{
/* +0x00 */ uint32be resFlags;
/* +0x04 */ uint32be elementSize;
/* +0x08 */ uint32be elementCount;
/* +0x0C */ MEMPTR<void> ptr;
uint32 GetSize() const
{
return (uint32)elementSize * (uint32)elementCount;
}
MPTR GetVirtualAddr() const
{
return ptr.GetMPTR();
}
void* GetPtr() const
{
return ptr.GetPtr();
}
};
static_assert(sizeof(GX2RBuffer) == 0x10);
namespace GX2
{
void GX2ResourceInit();
void GX2RSetAllocator(MPTR funcAllocMPTR, MPTR funcFreeMPR);
};
| 1,690
|
C++
|
.h
| 51
| 31.490196
| 61
| 0.704364
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,542
|
GX2_Query.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Query.h
|
#pragma once
#define GX2_QUERY_TYPE_OCCLUSION_CPU 0
#define GX2_QUERY_TYPE_OCCLUSION_GPU 2
// 1 and 3 are streamout related?
namespace GX2
{
void GX2QueryInit();
};
| 171
|
C++
|
.h
| 8
| 20.125
| 40
| 0.765432
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,543
|
GX2_Texture.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Texture.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
#include "GX2_Surface.h"
namespace GX2
{
struct GX2Texture
{
/* +0x00 */ GX2Surface surface;
/* +0x74 */ uint32be viewFirstMip;
/* +0x78 */ uint32be viewNumMips;
/* +0x7C */ uint32be viewFirstSlice;
/* +0x80 */ uint32be viewNumSlices;
/* +0x84 */ uint32be compSel;
/* +0x88 */ betype<Latte::LATTE_SQ_TEX_RESOURCE_WORD0_N> regTexWord0;
/* +0x8C */ betype<Latte::LATTE_SQ_TEX_RESOURCE_WORD1_N> regTexWord1;
// word2 and word3 are the base/mip address and are not stored
/* +0x90 */ betype<Latte::LATTE_SQ_TEX_RESOURCE_WORD4_N> regTexWord4;
/* +0x94 */ betype<Latte::LATTE_SQ_TEX_RESOURCE_WORD5_N> regTexWord5;
/* +0x98 */ betype<Latte::LATTE_SQ_TEX_RESOURCE_WORD6_N> regTexWord6;
};
static_assert(sizeof(GX2Texture) == 0x9C);
struct GX2Sampler
{
betype<Latte::LATTE_SQ_TEX_SAMPLER_WORD0_0> word0;
betype<Latte::LATTE_SQ_TEX_SAMPLER_WORD1_0> word1;
betype<Latte::LATTE_SQ_TEX_SAMPLER_WORD2_0> word2;
};
static_assert(sizeof(GX2Sampler) == 12);
void GX2InitTextureRegs(GX2Texture* texture);
void GX2TextureInit();
};
| 1,111
|
C++
|
.h
| 31
| 33.387097
| 71
| 0.72
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,544
|
GX2_Surface.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Surface.h
|
#pragma once
#include "Cafe/HW/Latte/ISA/LatteReg.h"
#include "Cafe/HW/Latte/LatteAddrLib/LatteAddrLib.h"
// todo - move into GX2 namespace
struct GX2Surface
{
/* +0x000 */ betype<Latte::E_DIM> dim;
/* +0x004 */ uint32be width;
/* +0x008 */ uint32be height;
/* +0x00C */ uint32be depth;
/* +0x010 */ uint32be numLevels; // number of mipmap levels including base image. Should be at least 1
/* +0x014 */ betype<Latte::E_GX2SURFFMT> format;
/* +0x018 */ uint32be aa; // anti-aliasing mode
/* +0x01C */ uint32be resFlag; // GX2_RESFLAG_* and GX2R_RESFLAG_*
/* +0x020 */ uint32be imageSize;
/* +0x024 */ uint32be imagePtr;
/* +0x028 */ uint32be mipSize;
/* +0x02C */ uint32be mipPtr;
/* +0x030 */ betype<Latte::E_GX2TILEMODE> tileMode;
/* +0x034 */ uint32be swizzle;
/* +0x038 */ uint32be alignment;
/* +0x03C */ uint32be pitch;
/* +0x040 */ uint32be mipOffset[13];
}; // size: 0x74
static_assert(sizeof(betype<Latte::E_DIM>) == 4);
static_assert(sizeof(betype<Latte::E_GX2TILEMODE>) == 4);
static_assert(sizeof(GX2Surface) == 0x74);
// color and depth buffer
struct GX2ColorBuffer
{
/* +0x00 */ GX2Surface surface;
/* +0x74 */ uint32 viewMip;
/* +0x78 */ uint32 viewFirstSlice;
/* +0x7C */ uint32 viewNumSlices;
/* +0x80 */ MPTR auxData;
/* +0x84 */ uint32 auxSize;
/* +0x88 */ uint32be reg_size; // CB_COLOR*_SIZE
/* +0x8C */ uint32be reg_info; // CB_COLOR*_INFO
/* +0x90 */ uint32be reg_view; // CB_COLOR*_VIEW
/* +0x94 */ uint32be reg_mask; // CB_COLOR*_MASK
/* +0x98 */ uint32be reg4; // ?
};
static_assert(sizeof(GX2ColorBuffer) == 0x9C);
struct GX2DepthBuffer
{
/* +0x00 */ GX2Surface surface;
/* +0x74 */ uint32 viewMip;
/* +0x78 */ uint32 viewFirstSlice;
/* +0x7C */ uint32 viewNumSlices;
/* +0x80 */ MPTR hiZPtr;
/* +0x84 */ uint32 hiZSize;
/* +0x88 */ float clearDepth;
/* +0x8C */ uint32 clearStencil;
/* +0x90 */ uint32be reg_size;
/* +0x94 */ uint32be reg_view;
/* +0x98 */ uint32be reg_base;
/* +0x9C */ uint32be reg_htile_surface;
/* +0xA0 */ uint32be reg_prefetch_limit;
/* +0xA4 */ uint32be reg_preload_control;
/* +0xA8 */ uint32be reg_poly_offset_db_fmt_cntl;
};
static_assert(sizeof(GX2DepthBuffer) == 0xAC);
namespace GX2
{
void GX2CalculateSurfaceInfo(GX2Surface* surfacePtr, uint32 level, LatteAddrLib::AddrSurfaceInfo_OUT* pSurfOut);
Latte::E_ENDIAN_SWAP GetSurfaceFormatSwapMode(Latte::E_GX2SURFFMT fmt);
uint32 GetSurfaceColorBufferExportFormat(Latte::E_GX2SURFFMT fmt);
void GX2CalcSurfaceSizeAndAlignment(GX2Surface* surface);
void GX2SurfaceInit();
};
| 2,564
|
C++
|
.h
| 70
| 34.785714
| 113
| 0.689891
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,545
|
GX2_Blit.h
|
cemu-project_Cemu/src/Cafe/OS/libs/gx2/GX2_Blit.h
|
#pragma once
namespace GX2
{
enum class GX2ClearFlags : uint32
{
CLEAR_DEPTH = 0x01, // clear depth to given clear value
CLEAR_STENCIL = 0x02, // clear stencil to given stencil clear value
SET_DEPTH_REG = 0x04, //
SET_STENCIL_REG = 0x08,
};
void GX2BlitInit();
}
ENABLE_BITMASK_OPERATORS(GX2::GX2ClearFlags);
| 323
|
C++
|
.h
| 13
| 22.769231
| 69
| 0.737864
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,546
|
nn_spm.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_spm/nn_spm.h
|
#pragma once
namespace nn
{
namespace spm
{
void load();
}
}
| 66
|
C++
|
.h
| 8
| 6.625
| 14
| 0.706897
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,547
|
proc_ui.h
|
cemu-project_Cemu/src/Cafe/OS/libs/proc_ui/proc_ui.h
|
namespace proc_ui
{
enum class ProcUIStatus
{
Foreground = 0,
Background = 1,
Releasing = 2,
Exit = 3
};
enum class ProcUICallbackId
{
AcquireForeground = 0,
ReleaseForeground = 1,
Exit = 2,
NetIoStart = 3,
NetIoStop = 4,
HomeButtonDenied = 5,
COUNT = 6
};
void ProcUIInit(MEMPTR<void> callbackReadyToRelease);
void ProcUIInitEx(MEMPTR<void> callbackReadyToReleaseEx, MEMPTR<void> userParam);
void ProcUIShutdown();
bool ProcUIIsRunning();
bool ProcUIInForeground();
bool ProcUIInShutdown();
void ProcUIRegisterCallback(ProcUICallbackId callbackType, void* funcPtr, void* userParam, sint32 priority);
void ProcUIRegisterCallbackCore(ProcUICallbackId callbackType, void* funcPtr, void* userParam, sint32 priority, uint32 coreIndex);
void ProcUIRegisterBackgroundCallback(void* funcPtr, void* userParam, uint64 tickDelay);
void ProcUIClearCallbacks();
void ProcUISetSaveCallback(void* funcPtr, void* userParam);
void ProcUISetCallbackStackSize(uint32 newStackSize);
uint32 ProcUICalcMemorySize(uint32 numCallbacks);
sint32 ProcUISetMemoryPool(void* memBase, uint32 size);
void ProcUISetBucketStorage(void* memBase, uint32 size);
void ProcUISetMEM1Storage(void* memBase, uint32 size);
void ProcUIDrawDoneRelease();
ProcUIStatus ProcUIProcessMessages(bool isBlockingInBackground);
ProcUIStatus ProcUISubProcessMessages(bool isBlockingInBackground);
void load();
}
| 1,411
|
C++
|
.h
| 40
| 33
| 131
| 0.812865
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,548
|
nn_olv_OfflineDB.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_OfflineDB.h
|
#pragma once
#include "Cafe/OS/libs/nn_common.h"
#include "nn_olv_Common.h"
namespace nn
{
namespace olv
{
void OfflineDB_Init();
void OfflineDB_Shutdown();
nnResult OfflineDB_DownloadPostDataListParam_DownloadPostDataList(DownloadedTopicData* downloadedTopicData, DownloadedPostData* downloadedPostData, uint32be* postCountOut, uint32 maxCount, DownloadPostDataListParam* param);
nnResult OfflineDB_DownloadPostDataListParam_DownloadExternalImageData(DownloadedDataBase* _this, void* imageDataOut, uint32be* imageSizeOut, uint32 maxSize);
}
}
| 557
|
C++
|
.h
| 13
| 40.846154
| 225
| 0.837638
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,549
|
nn_olv_DownloadCommunityTypes.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_DownloadCommunityTypes.h
|
#pragma once
#include "Cemu/ncrypto/ncrypto.h"
#include "config/ActiveSettings.h"
#include "Cafe/OS/libs/nn_olv/nn_olv_Common.h"
namespace nn
{
namespace olv
{
class DownloadedCommunityData
{
public:
static const inline uint32 FLAG_HAS_TITLE_TEXT = (1 << 0);
static const inline uint32 FLAG_HAS_DESC_TEXT = (1 << 1);
static const inline uint32 FLAG_HAS_APP_DATA = (1 << 2);
static const inline uint32 FLAG_HAS_ICON_DATA = (1 << 3);
static const inline uint32 FLAG_HAS_MII_DATA = (1 << 4);
DownloadedCommunityData()
{
this->titleTextMaxLen = 0;
this->appDataLen = 0;
this->descriptionMaxLen = 0;
this->pid = 0;
this->communityId = 0;
this->flags = 0;
this->iconDataSize = 0;
this->miiDisplayName[0] = 0;
}
static DownloadedCommunityData* __ctor(DownloadedCommunityData* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) DownloadedCommunityData();
}
static DownloadedCommunityData* Clean(DownloadedCommunityData* data)
{
data->flags = 0;
data->communityId = 0;
data->pid = 0;
data->iconData[0] = 0;
data->titleTextMaxLen = 0;
data->appData[0] = 0;
data->appDataLen = 0;
data->description[0] = 0;
data->descriptionMaxLen = 0;
data->iconDataSize = 0;
data->titleText[0] = 0;
data->miiDisplayName[0] = 0;
return data;
}
bool TestFlags(uint32 flags) const
{
return (this->flags & flags) != 0;
}
static bool __TestFlags(DownloadedCommunityData* _this, uint32 flags)
{
return _this->TestFlags(flags);
}
uint32 GetCommunityId() const
{
return this->communityId;
}
static uint32 __GetCommunityId(DownloadedCommunityData* _this)
{
return _this->GetCommunityId();
}
sint32 GetCommunityCode(char* pBuffer, uint32 bufferSize) const
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize <= 12)
return OLV_RESULT_NOT_ENOUGH_SIZE;
uint32 len = 0;
if (FormatCommunityCode(pBuffer, &len, this->communityId))
return OLV_RESULT_SUCCESS;
return OLV_RESULT_INVALID_PARAMETER;
}
static sint32 __GetCommunityCode(DownloadedCommunityData* _this, char* pBuffer, uint32 bufferSize)
{
return _this->GetCommunityCode(pBuffer, bufferSize);
}
uint32 GetOwnerPid() const
{
return this->pid;
}
static uint32 __GetOwnerPid(DownloadedCommunityData* _this)
{
return _this->GetOwnerPid();
}
sint32 GetTitleText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_TITLE_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
uint32 readSize = this->titleTextMaxLen;
if (numChars < readSize)
readSize = numChars;
olv_wstrncpy(pBuffer, this->titleText, readSize);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetTitleText(DownloadedCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetTitleText(pBuffer, numChars);
}
sint32 GetDescriptionText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_DESC_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
olv_wstrncpy(pBuffer, this->description, numChars);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetDescriptionText(DownloadedCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetDescriptionText(pBuffer, numChars);
}
sint32 GetAppData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
uint32 appDataSize = bufferSize;
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize)
{
if (!this->TestFlags(FLAG_HAS_APP_DATA))
return OLV_RESULT_MISSING_DATA;
if (this->appDataLen < appDataSize)
appDataSize = this->appDataLen;
memcpy(pBuffer, this->appData, appDataSize);
if (pOutSize)
*pOutSize = appDataSize;
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetAppData(DownloadedCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetAppData(pBuffer, pOutSize, bufferSize);
}
uint32 GetAppDataSize() const
{
if (this->TestFlags(FLAG_HAS_APP_DATA))
return this->appDataLen;
return 0;
}
static uint32 __GetAppDataSize(DownloadedCommunityData* _this)
{
return _this->GetAppDataSize();
}
sint32 GetIconData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize < sizeof(this->iconData))
return OLV_RESULT_NOT_ENOUGH_SIZE;
if (!this->TestFlags(FLAG_HAS_ICON_DATA))
return OLV_RESULT_MISSING_DATA;
sint32 decodeRes = DecodeTGA(this->iconData, this->iconDataSize, pBuffer, bufferSize, TGACheckType::CHECK_COMMUNITY_ICON);
if (decodeRes >= 0)
{
if (pOutSize)
*pOutSize = (uint32)decodeRes;
return OLV_RESULT_SUCCESS;
}
if (pOutSize)
*pOutSize = 0;
if (decodeRes == -1)
cemuLog_log(LogType::Force, "OLIVE - icon uncompress failed.\n");
else if (decodeRes == -2)
cemuLog_log(LogType::Force, "OLIVE - icon decode error. NOT TGA.\n");
return OLV_RESULT_INVALID_TEXT_FIELD;
}
static sint32 __GetIconData(DownloadedCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetIconData(pBuffer, pOutSize, bufferSize);
}
sint32 GetOwnerMiiData(/* FFLStoreData* */void* pBuffer) const
{
if (!this->TestFlags(FLAG_HAS_MII_DATA))
return OLV_RESULT_MISSING_DATA;
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
memcpy(pBuffer, this->miiFFLStoreData, sizeof(this->miiFFLStoreData));
return OLV_RESULT_SUCCESS;
}
static sint32 __GetOwnerMiiData(DownloadedCommunityData* _this, /* FFLStoreData* */void* pBuffer)
{
return _this->GetOwnerMiiData(pBuffer);
}
const char16_t* GetOwnerMiiNickname() const
{
if (this->miiDisplayName[0])
return this->miiDisplayName;
return nullptr;
}
static const char16_t* __GetOwnerMiiNickname(DownloadedCommunityData* _this)
{
return _this->GetOwnerMiiNickname();
}
public:
uint32be flags;
uint32be communityId;
uint32be pid;
char16_t titleText[128];
uint32be titleTextMaxLen;
char16_t description[256];
uint32be descriptionMaxLen;
uint8 appData[1024];
uint32be appDataLen;
uint8 iconData[65580];
uint32be iconDataSize;
uint8 miiFFLStoreData[96];
char16_t miiDisplayName[32];
uint8 unk[6168];
};
static_assert(sizeof(nn::olv::DownloadedCommunityData) == 0x12000, "sizeof(nn::olv::DownloadedCommunityData) != 0x12000");
class DownloadCommunityDataListParam
{
public:
static const inline uint32 FLAG_FILTER_FAVORITES = (1 << 0);
static const inline uint32 FLAG_FILTER_OFFICIALS = (1 << 1);
static const inline uint32 FLAG_FILTER_OWNED = (1 << 2);
static const inline uint32 FLAG_QUERY_MII_DATA = (1 << 3);
static const inline uint32 FLAG_QUERY_ICON_DATA = (1 << 4);
DownloadCommunityDataListParam()
{
this->flags = 0;
this->communityDownloadLimit = 0;
this->communityId = 0;
for (int i = 0; i < 20; i++)
this->additionalCommunityIdList[i] = -2;
}
static DownloadCommunityDataListParam* __ctor(DownloadCommunityDataListParam* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) DownloadCommunityDataListParam();
}
sint32 SetFlags(uint32 flags)
{
this->flags = flags;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetFlags(DownloadCommunityDataListParam* _this, uint32 flags)
{
return _this->SetFlags(flags);
}
sint32 SetCommunityId(uint32 communityId)
{
if (communityId == -1)
return OLV_RESULT_INVALID_PARAMETER;
this->communityId = communityId;
if (communityId)
{
if (!this->communityDownloadLimit)
this->communityDownloadLimit = 1;
}
return OLV_RESULT_SUCCESS;
}
static sint32 __SetCommunityId(DownloadCommunityDataListParam* _this, uint32 communityId)
{
return _this->SetCommunityId(communityId);
}
sint32 SetCommunityId(uint32 communityId, uint8 idx)
{
if (communityId == -1)
return OLV_RESULT_INVALID_PARAMETER;
if (idx >= 20)
return OLV_RESULT_INVALID_PARAMETER;
this->additionalCommunityIdList[idx] = communityId;
int validIdsCount = 0;
for (int i = 0; i < 20; i++ )
{
if (this->additionalCommunityIdList[i] != -2)
++validIdsCount;
}
if (validIdsCount > this->communityDownloadLimit)
this->communityDownloadLimit = validIdsCount;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetCommunityId(DownloadCommunityDataListParam* _this, uint32 communityId, uint8 idx)
{
return _this->SetCommunityId(communityId, idx);
}
sint32 SetCommunityDataMaxNum(uint32 num)
{
if (!num)
return OLV_RESULT_INVALID_PARAMETER;
int validIdsCount = 0;
for (int i = 0; i < 20; ++i)
{
if (this->additionalCommunityIdList[i] != -2)
++validIdsCount;
}
if (validIdsCount > num)
return OLV_RESULT_INVALID_PARAMETER;
this->communityDownloadLimit = num;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetCommunityDataMaxNum(DownloadCommunityDataListParam* _this, uint32 num)
{
return _this->SetCommunityDataMaxNum(num);
}
sint32 GetRawDataUrl(char* pBuffer, uint32 bufferSize) const
{
if (!g_IsOnlineMode)
return OLV_RESULT_OFFLINE_MODE_REQUEST;
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (!bufferSize)
return OLV_RESULT_NOT_ENOUGH_SIZE;
char tmpFormatBuffer[64];
char urlBuffer[1024];
memset(urlBuffer, 0, sizeof(urlBuffer));
uint32 communityId;
int validIdsCount = 0;
for (int i = 0; i < 20; ++i)
{
if (this->additionalCommunityIdList[i] != -2)
{
communityId = this->additionalCommunityIdList[i];
++validIdsCount;
}
}
if (validIdsCount)
{
if (this->communityId && this->communityId != -2)
return OLV_RESULT_INVALID_PARAMETER;
uint32 unkFlag = this->flags & 0xFFFFFFE7;
if (unkFlag)
return OLV_RESULT_INVALID_PARAMETER;
// It's how it's done in the real nn_olv, what even the fuck is this, never seen used yet.
snprintf(urlBuffer, sizeof(urlBuffer), "%s/v1/communities/%u.search", g_DiscoveryResults.apiEndpoint, communityId);
for (int i = 0; i < 20; ++i)
{
if (this->additionalCommunityIdList[i] != -2)
{
snprintf(tmpFormatBuffer, 64, "community_id=%u", this->additionalCommunityIdList[i].value());
appendQueryToURL(urlBuffer, tmpFormatBuffer);
++unkFlag;
}
}
}
else
snprintf(urlBuffer, sizeof(urlBuffer), "%s/v1/communities", g_DiscoveryResults.apiEndpoint);
if (this->communityId)
{
snprintf(tmpFormatBuffer, 64, "community_id=%u", this->communityId.value());
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
else
{
uint32 filterBy_favorite = (this->flags & FLAG_FILTER_FAVORITES) != 0;
uint32 filterBy_official = (this->flags & FLAG_FILTER_OFFICIALS) != 0;
uint32 filterBy_selfmade = (this->flags & FLAG_FILTER_OWNED) != 0;
if ((filterBy_favorite + filterBy_official + filterBy_selfmade) != 1)
return OLV_RESULT_INVALID_PARAMETER;
snprintf(tmpFormatBuffer, 64, "limit=%u", this->communityDownloadLimit.value());
appendQueryToURL(urlBuffer, tmpFormatBuffer);
if (filterBy_favorite)
{
strncpy(tmpFormatBuffer, "type=favorite", 64);
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
else if (filterBy_official)
{
strncpy(tmpFormatBuffer, "type=official", 64);
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
else
{
strncpy(tmpFormatBuffer, "type=my", 64);
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
}
if (this->flags & FLAG_QUERY_MII_DATA)
{
strncpy(tmpFormatBuffer, "with_mii=1", 64);
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
if (this->flags & FLAG_QUERY_ICON_DATA)
{
strncpy(tmpFormatBuffer, "with_icon=1", 64);
appendQueryToURL(urlBuffer, tmpFormatBuffer);
}
int res = snprintf(pBuffer, bufferSize, "%s", urlBuffer);
if (res < 0)
return OLV_RESULT_NOT_ENOUGH_SIZE;
return OLV_RESULT_SUCCESS;
}
static sint32 __GetRawDataUrl(DownloadCommunityDataListParam* _this, char* pBuffer, uint32 bufferSize)
{
return _this->GetRawDataUrl(pBuffer, bufferSize);
}
public:
uint32be flags;
uint32be communityId;
uint32be communityDownloadLimit;
uint32be additionalCommunityIdList[20]; // Additional community ID filter list
uint8 unk[4004]; // Looks unused lol, probably reserved data
};
static_assert(sizeof(nn::olv::DownloadCommunityDataListParam) == 0x1000, "sizeof(nn::olv::DownloadCommunityDataListParam) != 0x1000");
sint32 DownloadCommunityDataList(DownloadedCommunityData* pOutList, uint32* pOutNum, uint32 numMaxList, const DownloadCommunityDataListParam* pParam);
static void loadOliveDownloadCommunityTypes()
{
cafeExportRegisterFunc(DownloadedCommunityData::__ctor, "nn_olv", "__ct__Q3_2nn3olv23DownloadedCommunityDataFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__TestFlags, "nn_olv", "TestFlags__Q3_2nn3olv23DownloadedCommunityDataCFUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetCommunityId, "nn_olv", "GetCommunityId__Q3_2nn3olv23DownloadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetCommunityCode, "nn_olv", "GetCommunityCode__Q3_2nn3olv23DownloadedCommunityDataCFPcUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetOwnerPid, "nn_olv", "GetOwnerPid__Q3_2nn3olv23DownloadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetTitleText, "nn_olv", "GetTitleText__Q3_2nn3olv23DownloadedCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetDescriptionText, "nn_olv", "GetDescriptionText__Q3_2nn3olv23DownloadedCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetAppData, "nn_olv", "GetAppData__Q3_2nn3olv23DownloadedCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetAppDataSize, "nn_olv", "GetAppDataSize__Q3_2nn3olv23DownloadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetIconData, "nn_olv", "GetIconData__Q3_2nn3olv23DownloadedCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetOwnerMiiData, "nn_olv", "GetOwnerMiiData__Q3_2nn3olv23DownloadedCommunityDataCFP12FFLStoreData", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadedCommunityData::__GetOwnerMiiNickname, "nn_olv", "GetOwnerMiiNickname__Q3_2nn3olv23DownloadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadCommunityDataListParam::__ctor, "nn_olv", "__ct__Q3_2nn3olv30DownloadCommunityDataListParamFv", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadCommunityDataListParam::__SetFlags, "nn_olv", "SetFlags__Q3_2nn3olv30DownloadCommunityDataListParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadCommunityDataListParam::__SetCommunityDataMaxNum, "nn_olv", "SetCommunityDataMaxNum__Q3_2nn3olv30DownloadCommunityDataListParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadCommunityDataListParam::__GetRawDataUrl, "nn_olv", "GetRawDataUrl__Q3_2nn3olv30DownloadCommunityDataListParamCFPcUi", LogType::NN_OLV);
cafeExportRegisterFunc((sint32 (*)(DownloadCommunityDataListParam*, uint32))DownloadCommunityDataListParam::__SetCommunityId,
"nn_olv", "SetCommunityId__Q3_2nn3olv30DownloadCommunityDataListParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc((sint32(*)(DownloadCommunityDataListParam*, uint32, uint8))DownloadCommunityDataListParam::__SetCommunityId,
"nn_olv", "SetCommunityId__Q3_2nn3olv30DownloadCommunityDataListParamFUiUc", LogType::NN_OLV);
cafeExportRegisterFunc(DownloadCommunityDataList, "nn_olv", "DownloadCommunityDataList__Q2_2nn3olvFPQ3_2nn3olv23DownloadedCommunityDataPUiUiPCQ3_2nn3olv30DownloadCommunityDataListParam", LogType::NN_OLV);
}
}
}
| 17,400
|
C++
|
.h
| 447
| 32.736018
| 208
| 0.696818
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,550
|
nn_olv_InitializeTypes.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_InitializeTypes.h
|
#pragma once
#include "Cemu/ncrypto/ncrypto.h"
#include "config/ActiveSettings.h"
#include "Cafe/OS/libs/nn_olv/nn_olv_Common.h"
#include "Cafe/OS/libs/coreinit/coreinit_MCP.h"
namespace nn
{
namespace olv
{
class InitializeParam
{
public:
static const inline uint32 FLAG_OFFLINE_MODE = (1 << 0);
InitializeParam()
{
this->m_Flags = 0;
this->m_ReportTypes = 7039;
this->m_SysArgsSize = 0;
this->m_Work = MEMPTR<uint8_t>(nullptr);
this->m_SysArgs = MEMPTR<const void>(nullptr);
this->m_WorkSize = 0;
}
static InitializeParam* __ctor(InitializeParam* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) InitializeParam();
}
sint32 SetFlags(uint32 flags)
{
this->m_Flags = flags;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetFlags(InitializeParam* _this, uint32 flags)
{
return _this->SetFlags(flags);
}
sint32 SetWork(MEMPTR<uint8_t> pWorkData, uint32 workDataSize)
{
if (!pWorkData)
return OLV_RESULT_INVALID_PTR;
if (workDataSize < 0x10000)
return OLV_RESULT_NOT_ENOUGH_SIZE;
this->m_Work = pWorkData;
this->m_WorkSize = workDataSize;
return OLV_RESULT_SUCCESS;
}
static uint32 __SetWork(InitializeParam* _this, MEMPTR<uint8> pWorkData, uint32 workDataSize)
{
return _this->SetWork(pWorkData, workDataSize);
}
sint32 SetReportTypes(uint32 reportTypes)
{
this->m_ReportTypes = reportTypes;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetReportTypes(InitializeParam* _this, uint32 reportTypes)
{
return _this->SetReportTypes(reportTypes);
}
sint32 SetSysArgs(MEMPTR<const void> pSysArgs, uint32 sysArgsSize)
{
if (!pSysArgs)
return OLV_RESULT_INVALID_PTR;
if (!sysArgsSize)
return OLV_RESULT_INVALID_PARAMETER;
this->m_SysArgs = pSysArgs;
this->m_SysArgsSize = sysArgsSize;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetSysArgs(InitializeParam* _this, MEMPTR<const void> pSysArgs, uint32 sysArgsSize)
{
return _this->SetSysArgs(pSysArgs, sysArgsSize);
}
uint32be m_Flags;
uint32be m_ReportTypes;
MEMPTR<uint8_t> m_Work;
uint32be m_WorkSize;
MEMPTR<const void> m_SysArgs;
uint32be m_SysArgsSize;
char unk[0x28];
};
static_assert(sizeof(nn::olv::InitializeParam) == 0x40, "sizeof(nn::olv::InitializeParam) != 0x40");
namespace Report
{
uint32 GetReportTypes();
void SetReportTypes(uint32 reportTypes);
}
bool IsInitialized();
sint32 Initialize(nn::olv::InitializeParam* pParam);
static void loadOliveInitializeTypes()
{
cafeExportRegisterFunc(Initialize, "nn_olv", "Initialize__Q2_2nn3olvFPCQ3_2nn3olv15InitializeParam", LogType::NN_OLV);
cafeExportRegisterFunc(IsInitialized, "nn_olv", "IsInitialized__Q2_2nn3olvFv", LogType::NN_OLV);
cafeExportRegisterFunc(Report::GetReportTypes, "nn_olv", "GetReportTypes__Q3_2nn3olv6ReportFv", LogType::NN_OLV);
cafeExportRegisterFunc(Report::SetReportTypes, "nn_olv", "SetReportTypes__Q3_2nn3olv6ReportFUi", LogType::NN_OLV);
cafeExportRegisterFunc(InitializeParam::__ctor, "nn_olv", "__ct__Q3_2nn3olv15InitializeParamFv", LogType::NN_OLV);
cafeExportRegisterFunc(InitializeParam::__SetFlags, "nn_olv", "SetFlags__Q3_2nn3olv15InitializeParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(InitializeParam::__SetWork, "nn_olv", "SetWork__Q3_2nn3olv15InitializeParamFPUcUi", LogType::NN_OLV);
cafeExportRegisterFunc(InitializeParam::__SetReportTypes, "nn_olv", "SetReportTypes__Q3_2nn3olv15InitializeParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(InitializeParam::__SetSysArgs, "nn_olv", "SetSysArgs__Q3_2nn3olv15InitializeParamFPCvUi", LogType::NN_OLV);
}
}
}
| 3,940
|
C++
|
.h
| 108
| 31.138889
| 139
| 0.704456
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,551
|
nn_olv.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv.h
|
#pragma once
#include "Cafe/OS/common/OSCommon.h"
#include "Cafe/OS/libs/nn_common.h"
#include "Cafe/OS/libs/nn_act/nn_act.h"
#include "Cafe/CafeSystem.h"
#include "Cemu/napi/napi.h"
#include "nn_olv_Common.h"
namespace nn
{
namespace olv
{
extern ParamPackStorage g_ParamPack;
extern DiscoveryResultStorage g_DiscoveryResults;
sint32 GetOlvAccessKey(uint32_t* pOutKey);
void load();
void unload();
}
}
| 421
|
C++
|
.h
| 18
| 21.388889
| 51
| 0.768844
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,552
|
nn_olv_Common.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_Common.h
|
#pragma once
#include "Cafe/OS/libs/nn_common.h"
#include "Cafe/OS/common/OSCommon.h"
#include "Cemu/napi/napi_helper.h"
#include "util/helpers/StringHelpers.h"
#include "pugixml.hpp"
// https://github.com/kinnay/NintendoClients/wiki/Wii-U-Error-Codes#act-error-codes
#define OLV_ACT_RESULT_STATUS(code) (BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_OLV, ((code) << 7)))
#define OLV_RESULT_STATUS(code) (BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_OLV, ((code) << 7)))
#define OLV_RESULT_LVL6(code) (BUILD_NN_RESULT(NN_RESULT_LEVEL_LVL6, NN_RESULT_MODULE_NN_OLV, ((code) << 7)))
#define OLV_RESULT_FATAL(code) (BUILD_NN_RESULT(NN_RESULT_LEVEL_FATAL, NN_RESULT_MODULE_NN_OLV, ((code) << 7)))
#define OLV_RESULT_SUCCESS (BUILD_NN_RESULT(0, NN_RESULT_MODULE_NN_OLV, 1 << 7))
#define OLV_RESULT_INVALID_PARAMETER (OLV_RESULT_LVL6(201))
#define OLV_RESULT_INVALID_DATA (OLV_RESULT_LVL6(202))
#define OLV_RESULT_NOT_ENOUGH_SIZE (OLV_RESULT_LVL6(203))
#define OLV_RESULT_INVALID_PTR (OLV_RESULT_LVL6(204))
#define OLV_RESULT_NOT_INITIALIZED (OLV_RESULT_LVL6(205))
#define OLV_RESULT_ALREADY_INITIALIZED (OLV_RESULT_LVL6(206))
#define OLV_RESULT_OFFLINE_MODE_REQUEST (OLV_RESULT_LVL6(207))
#define OLV_RESULT_MISSING_DATA (OLV_RESULT_LVL6(208))
#define OLV_RESULT_INVALID_SIZE (OLV_RESULT_LVL6(209))
#define OLV_RESULT_BAD_VERSION (OLV_RESULT_STATUS(2001))
#define OLV_RESULT_FAILED_REQUEST (OLV_RESULT_STATUS(2003))
#define OLV_RESULT_INVALID_XML (OLV_RESULT_STATUS(2004))
#define OLV_RESULT_INVALID_TEXT_FIELD (OLV_RESULT_STATUS(2006))
#define OLV_RESULT_INVALID_INTEGER_FIELD (OLV_RESULT_STATUS(2007))
#define OLV_CLIENT_ID "87cd32617f1985439ea608c2746e4610"
#define OLV_VERSION_MAJOR 5
#define OLV_VERSION_MINOR 0
#define OLV_VERSION_PATCH 3
namespace nn
{
namespace olv
{
struct ParamPackStorage
{
uint64_t titleId;
uint32_t accessKey;
uint32_t platformId;
uint8_t regionId, languageId, countryId, areaId;
uint8_t networkRestriction, friendRestriction;
uint32_t ratingRestriction;
uint8_t ratingOrganization;
uint64_t transferableId;
char tzName[72];
uint64_t utcOffset;
char encodedParamPack[512];
};
struct DiscoveryResultStorage
{
sint32 has_error;
char serviceToken[512];
char userAgent[64];
char apiEndpoint[256];
char portalEndpoint[256];
};
extern ParamPackStorage g_ParamPack;
extern DiscoveryResultStorage g_DiscoveryResults;
extern uint32_t g_ReportTypes;
extern bool g_IsInitialized;
extern bool g_IsOnlineMode;
extern bool g_IsOfflineDBMode; // use offline cache for posts
static void InitializeOliveRequest(CurlRequestHelper& req)
{
req.addHeaderField("X-Nintendo-ServiceToken", g_DiscoveryResults.serviceToken);
req.addHeaderField("X-Nintendo-ParamPack", g_ParamPack.encodedParamPack);
curl_easy_setopt(req.getCURL(), CURLOPT_USERAGENT, g_DiscoveryResults.userAgent);
}
static void appendQueryToURL(char* url, const char* query)
{
size_t urlLength = strlen(url);
size_t queryLength = strlen(query);
char* delimiter = strchr(url, '?');
if (delimiter)
snprintf(url + urlLength, queryLength + 2, "&%s", query);
else
snprintf(url + urlLength, queryLength + 2, "?%s", query);
}
static sint32 CheckOliveResponse(pugi::xml_document& doc)
{
/*
<result>
<has_error>1</has_error>
<version>1</version>
<code>400</code>
<error_code>4</error_code>
<message>SERVICE_CLOSED</message>
</result>
*/
pugi::xml_node resultNode = doc.child("result");
if (!resultNode)
{
cemuLog_log(LogType::Force, "Discovery response doesn't contain <result>...</result>");
return OLV_RESULT_INVALID_XML;
}
std::string_view has_error = resultNode.child_value("has_error");
std::string_view version = resultNode.child_value("version");
std::string_view code = resultNode.child_value("code");
std::string_view error_code = resultNode.child_value("error_code");
if (has_error.compare("1") == 0)
{
int codeVal = StringHelpers::ToInt(error_code, -1);
if (codeVal < 0)
{
codeVal = StringHelpers::ToInt(code, -1);
return OLV_RESULT_STATUS(codeVal + 4000);
}
return OLV_RESULT_STATUS(codeVal + 5000);
}
if (version.compare("1") != 0)
return OLV_RESULT_BAD_VERSION; // Version mismatch
return OLV_RESULT_SUCCESS;
}
sint32 olv_copy_wstr(char16_t* dest, const char16_t* src, uint32_t maxSize, uint32_t destSize);
size_t olv_wstrnlen(const char16_t* str, size_t max_len);
char16_t* olv_wstrncpy(char16_t* dest, const char16_t* src, size_t n);
#pragma pack(push, 1)
struct TGAHeader
{
uint8 idLength;
uint8 colorMapType;
uint8 imageType;
uint16 first_entry_idx;
uint16 colormap_length;
uint8 bpp;
uint16 x_origin;
uint16 y_origin;
uint16 width;
uint16 height;
uint8 pixel_depth_bpp;
uint8 image_desc_bits;
};
#pragma pack(pop)
static_assert(sizeof(nn::olv::TGAHeader) == 0x12, "sizeof(nn::olv::TGAHeader != 0x12");
enum TGACheckType : uint32
{
CHECK_PAINTING = 0,
CHECK_COMMUNITY_ICON = 1,
CHECK_100x100_200x200 = 2
};
bool CheckTGA(const uint8* pTgaFile, uint32 pTgaFileLen, TGACheckType checkType);
sint32 DecodeTGA(uint8* pInBuffer, uint32 inSize, uint8* pOutBuffer, uint32 outSize, TGACheckType checkType);
sint32 EncodeTGA(uint8* pInBuffer, uint32 inSize, uint8* pOutBuffer, uint32 outSize, TGACheckType checkTyp);
bool CompressTGA(uint8* pOutBuffer, uint32* pOutSize, uint8* pInBuffer, uint32 inSize);
bool DecompressTGA(uint8* pOutBuffer, uint32* pOutSize, uint8* pInBuffer, uint32 inSize);
bool GetCommunityIdFromCode(uint32* pOutId, const char* pCode);
bool FormatCommunityCode(char* pOutCode, uint32* outLen, uint32 communityId);
sint32 olv_curlformcode_to_error(CURLFORMcode code);
// convert and copy utf8 string into UC2 big-endian array
template<size_t TLength>
uint32 SetStringUC2(uint16be(&str)[TLength], std::string_view sv, bool unescape = false)
{
if(unescape)
{
// todo
}
std::wstring ws = boost::nowide::widen(sv);
size_t copyLen = std::min<size_t>(TLength-1, ws.size());
for(size_t i=0; i<copyLen; i++)
str[i] = ws[i];
str[copyLen] = '\0';
return copyLen;
}
// safely copy null-terminated UC2 big-endian string into UC2 big-endian array
template<size_t TLength>
uint32 SetStringUC2(uint16be(&str)[TLength], const uint16be* strIn)
{
size_t copyLen = TLength-1;
for(size_t i=0; i<copyLen; i++)
{
if(strIn[i] == 0)
{
str[i] = 0;
return i;
}
str[i] = strIn[i];
}
str[copyLen] = '\0';
return copyLen;
}
}
}
| 6,887
|
C++
|
.h
| 182
| 33.159341
| 118
| 0.704022
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,553
|
nn_olv_UploadFavoriteTypes.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_UploadFavoriteTypes.h
|
#pragma once
#include "Cemu/ncrypto/ncrypto.h"
#include "config/ActiveSettings.h"
#include "Cafe/OS/libs/nn_olv/nn_olv_Common.h"
namespace nn
{
namespace olv
{
class UploadedFavoriteToCommunityData
{
public:
static const inline uint32 FLAG_HAS_TITLE_TEXT = (1 << 0);
static const inline uint32 FLAG_HAS_DESC_TEXT = (1 << 1);
static const inline uint32 FLAG_HAS_APP_DATA = (1 << 2);
static const inline uint32 FLAG_HAS_ICON_DATA = (1 << 3);
UploadedFavoriteToCommunityData()
{
this->titleTextMaxLen = 0;
this->appDataLen = 0;
this->descriptionMaxLen = 0;
this->pid = 0;
this->communityId = 0;
this->flags = 0;
this->iconDataSize = 0;
}
static UploadedFavoriteToCommunityData* __ctor(UploadedFavoriteToCommunityData* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) UploadedFavoriteToCommunityData();
}
static UploadedFavoriteToCommunityData* Clean(UploadedFavoriteToCommunityData* data)
{
data->appDataLen = 0;
data->pid = 0;
data->titleText[0] = 0;
data->description[0] = 0;
data->appData[0] = 0;
data->titleTextMaxLen = 0;
data->iconData[0] = 0;
data->descriptionMaxLen = 0;
data->communityId = 0;
data->flags = 0;
data->iconDataSize = 0;
return data;
}
bool TestFlags(uint32 flags) const
{
return (this->flags & flags) != 0;
}
static bool __TestFlags(UploadedFavoriteToCommunityData* _this, uint32 flags)
{
return _this->TestFlags(flags);
}
uint32 GetCommunityId() const
{
return this->communityId;
}
static uint32 __GetCommunityId(UploadedFavoriteToCommunityData* _this)
{
return _this->GetCommunityId();
}
sint32 GetCommunityCode(char* pBuffer, uint32 bufferSize) const
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize <= 12)
return OLV_RESULT_NOT_ENOUGH_SIZE;
uint32 len = 0;
if (FormatCommunityCode(pBuffer, &len, this->communityId))
return OLV_RESULT_SUCCESS;
return OLV_RESULT_INVALID_PARAMETER;
}
static sint32 __GetCommunityCode(UploadedFavoriteToCommunityData* _this, char* pBuffer, uint32 bufferSize)
{
return _this->GetCommunityCode(pBuffer, bufferSize);
}
uint32 GetOwnerPid() const
{
return this->pid;
}
static uint32 __GetOwnerPid(UploadedFavoriteToCommunityData* _this)
{
return _this->GetOwnerPid();
}
sint32 GetTitleText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_TITLE_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
uint32 readSize = this->titleTextMaxLen;
if (numChars < readSize)
readSize = numChars;
olv_wstrncpy(pBuffer, this->titleText, readSize);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetTitleText(UploadedFavoriteToCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetTitleText(pBuffer, numChars);
}
sint32 GetDescriptionText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_DESC_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
olv_wstrncpy(pBuffer, this->description, numChars);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetDescriptionText(UploadedFavoriteToCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetDescriptionText(pBuffer, numChars);
}
sint32 GetAppData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
uint32 appDataSize = bufferSize;
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize)
{
if (!this->TestFlags(FLAG_HAS_APP_DATA))
return OLV_RESULT_MISSING_DATA;
if (this->appDataLen < appDataSize)
appDataSize = this->appDataLen;
memcpy(pBuffer, this->appData, appDataSize);
if (pOutSize)
*pOutSize = appDataSize;
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetAppData(UploadedFavoriteToCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetAppData(pBuffer, pOutSize, bufferSize);
}
uint32 GetAppDataSize() const
{
if (this->TestFlags(FLAG_HAS_APP_DATA))
return this->appDataLen;
return 0;
}
static uint32 __GetAppDataSize(UploadedFavoriteToCommunityData* _this)
{
return _this->GetAppDataSize();
}
sint32 GetIconData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize < sizeof(this->iconData))
return OLV_RESULT_NOT_ENOUGH_SIZE;
if (!this->TestFlags(FLAG_HAS_ICON_DATA))
return OLV_RESULT_MISSING_DATA;
sint32 decodeRes = DecodeTGA(this->iconData, this->iconDataSize, pBuffer, bufferSize, TGACheckType::CHECK_COMMUNITY_ICON);
if (decodeRes >= 0)
{
if (pOutSize)
*pOutSize = (uint32)decodeRes;
return OLV_RESULT_SUCCESS;
}
if (pOutSize)
*pOutSize = 0;
if (decodeRes == -1)
cemuLog_log(LogType::Force, "OLIVE - icon uncompress failed.\n");
else if (decodeRes == -2)
cemuLog_log(LogType::Force, "OLIVE - icon decode error. NOT TGA.\n");
return OLV_RESULT_INVALID_TEXT_FIELD;
}
static sint32 __GetIconData(UploadedFavoriteToCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetIconData(pBuffer, pOutSize, bufferSize);
}
public:
uint32be flags;
uint32be communityId;
uint32be pid;
char16_t titleText[128];
uint32be titleTextMaxLen;
char16_t description[256];
uint32be descriptionMaxLen;
uint8 appData[1024];
uint32be appDataLen;
uint8 iconData[65580];
uint32be iconDataSize;
uint8 unk[6328];
};
static_assert(sizeof(nn::olv::UploadedFavoriteToCommunityData) == 0x12000, "sizeof(nn::olv::UploadedFavoriteToCommunityData) != 0x12000");
class UploadFavoriteToCommunityDataParam
{
public:
static const inline uint32 FLAG_DELETION = (1 << 0);
UploadFavoriteToCommunityDataParam()
{
this->communityId = 0;
this->flags = 0;
}
static UploadFavoriteToCommunityDataParam* __ctor(UploadFavoriteToCommunityDataParam* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) UploadFavoriteToCommunityDataParam();
}
sint32 SetFlags(uint32 flags)
{
this->flags = flags;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetFlags(UploadFavoriteToCommunityDataParam* _this, uint32 flags)
{
return _this->SetFlags(flags);
}
sint32 SetCommunityCode(const char* pBuffer)
{
if (strnlen(pBuffer, 13) != 12)
return OLV_RESULT_INVALID_TEXT_FIELD;
uint32_t id;
if (GetCommunityIdFromCode(&id, pBuffer))
{
this->communityId = id;
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_STATUS(1901);
}
static sint32 __SetCommunityCode(UploadFavoriteToCommunityDataParam* _this, char* pBuffer)
{
return _this->SetCommunityCode(pBuffer);
}
sint32 SetCommunityId(uint32 communityId)
{
if (communityId == -1)
return OLV_RESULT_INVALID_PARAMETER;
this->communityId = communityId;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetCommunityId(UploadFavoriteToCommunityDataParam* _this, uint32 communityId)
{
return _this->SetCommunityId(communityId);
}
public:
uint32be flags;
uint32be communityId;
uint8 unk[54]; // Unused
};
static_assert(sizeof(nn::olv::UploadFavoriteToCommunityDataParam) == 64, "sizeof(nn::olv::UploadFavoriteToCommunityDataParam) != 64");
sint32 UploadFavoriteToCommunityData(const UploadFavoriteToCommunityDataParam* pParam);
sint32 UploadFavoriteToCommunityData(UploadedFavoriteToCommunityData* pOutData, const UploadFavoriteToCommunityDataParam* pParam);
static void loadOliveUploadFavoriteTypes()
{
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__ctor, "nn_olv", "__ct__Q3_2nn3olv31UploadedFavoriteToCommunityDataFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__TestFlags, "nn_olv", "TestFlags__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetCommunityId, "nn_olv", "GetCommunityId__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetCommunityCode, "nn_olv", "GetCommunityCode__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFPcUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetOwnerPid, "nn_olv", "GetOwnerPid__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetTitleText, "nn_olv", "GetTitleText__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetDescriptionText, "nn_olv", "GetDescriptionText__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetAppData, "nn_olv", "GetAppData__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetAppDataSize, "nn_olv", "GetAppDataSize__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedFavoriteToCommunityData::__GetIconData, "nn_olv", "GetIconData__Q3_2nn3olv31UploadedFavoriteToCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadFavoriteToCommunityDataParam::__ctor, "nn_olv", "__ct__Q3_2nn3olv34UploadFavoriteToCommunityDataParamFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadFavoriteToCommunityDataParam::__SetFlags, "nn_olv", "SetFlags__Q3_2nn3olv34UploadFavoriteToCommunityDataParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadFavoriteToCommunityDataParam::__SetCommunityCode, "nn_olv", "SetCommunityCode__Q3_2nn3olv34UploadFavoriteToCommunityDataParamFPCc", LogType::NN_OLV);
cafeExportRegisterFunc(UploadFavoriteToCommunityDataParam::__SetCommunityId, "nn_olv", "SetCommunityId__Q3_2nn3olv34UploadFavoriteToCommunityDataParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc((sint32(*)(const UploadFavoriteToCommunityDataParam*))UploadFavoriteToCommunityData,
"nn_olv", "UploadFavoriteToCommunityData__Q2_2nn3olvFPCQ3_2nn3olv34UploadFavoriteToCommunityDataParam", LogType::NN_OLV);
cafeExportRegisterFunc((sint32(*)(UploadedFavoriteToCommunityData*, const UploadFavoriteToCommunityDataParam*))UploadFavoriteToCommunityData,
"nn_olv", "UploadFavoriteToCommunityData__Q2_2nn3olvFPQ3_2nn3olv31UploadedFavoriteToCommunityDataPCQ3_2nn3olv34UploadFavoriteToCommunityDataParam", LogType::NN_OLV);
}
}
}
| 11,613
|
C++
|
.h
| 288
| 34.378472
| 182
| 0.721543
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,554
|
nn_olv_UploadCommunityTypes.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_UploadCommunityTypes.h
|
#pragma once
#include "Cemu/ncrypto/ncrypto.h"
#include "config/ActiveSettings.h"
#include "Cafe/OS/libs/nn_olv/nn_olv_Common.h"
namespace nn
{
namespace olv
{
class UploadedCommunityData
{
public:
static const inline uint32 FLAG_HAS_TITLE_TEXT = (1 << 0);
static const inline uint32 FLAG_HAS_DESC_TEXT = (1 << 1);
static const inline uint32 FLAG_HAS_APP_DATA = (1 << 2);
static const inline uint32 FLAG_HAS_ICON_DATA = (1 << 3);
UploadedCommunityData()
{
this->titleTextMaxLen = 0;
this->appDataLen = 0;
this->descriptionMaxLen = 0;
this->pid = 0;
this->communityId = 0;
this->flags = 0;
this->iconDataSize = 0;
}
static UploadedCommunityData* __ctor(UploadedCommunityData* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) UploadedCommunityData();
}
static UploadedCommunityData* Clean(UploadedCommunityData* data)
{
data->appDataLen = 0;
data->pid = 0;
data->titleText[0] = 0;
data->description[0] = 0;
data->appData[0] = 0;
data->titleTextMaxLen = 0;
data->iconData[0] = 0;
data->descriptionMaxLen = 0;
data->communityId = 0;
data->flags = 0;
data->iconDataSize = 0;
return data;
}
bool TestFlags(uint32 flags) const
{
return (this->flags & flags) != 0;
}
static bool __TestFlags(UploadedCommunityData* _this, uint32 flags)
{
return _this->TestFlags(flags);
}
uint32 GetCommunityId() const
{
return this->communityId;
}
static uint32 __GetCommunityId(UploadedCommunityData* _this)
{
return _this->GetCommunityId();
}
sint32 GetCommunityCode(char* pBuffer, uint32 bufferSize) const
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize <= 12)
return OLV_RESULT_NOT_ENOUGH_SIZE;
uint32 len = 0;
if (FormatCommunityCode(pBuffer, &len, this->communityId))
return OLV_RESULT_SUCCESS;
return OLV_RESULT_INVALID_PARAMETER;
}
static sint32 __GetCommunityCode(UploadedCommunityData* _this, char* pBuffer, uint32 bufferSize)
{
return _this->GetCommunityCode(pBuffer, bufferSize);
}
uint32 GetOwnerPid() const
{
return this->pid;
}
static uint32 __GetOwnerPid(UploadedCommunityData* _this)
{
return _this->GetOwnerPid();
}
sint32 GetTitleText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_TITLE_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
uint32 readSize = this->titleTextMaxLen;
if (numChars < readSize)
readSize = numChars;
olv_wstrncpy(pBuffer, this->titleText, readSize);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetTitleText(UploadedCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetTitleText(pBuffer, numChars);
}
sint32 GetDescriptionText(char16_t* pBuffer, uint32 numChars)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (numChars)
{
if (!this->TestFlags(FLAG_HAS_DESC_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(pBuffer, 0, 2 * numChars);
olv_wstrncpy(pBuffer, this->description, numChars);
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetDescriptionText(UploadedCommunityData* _this, char16_t* pBuffer, uint32 numChars)
{
return _this->GetDescriptionText(pBuffer, numChars);
}
sint32 GetAppData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
uint32 appDataSize = bufferSize;
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize)
{
if (!this->TestFlags(FLAG_HAS_APP_DATA))
return OLV_RESULT_MISSING_DATA;
if (this->appDataLen < appDataSize)
appDataSize = this->appDataLen;
memcpy(pBuffer, this->appData, appDataSize);
if (pOutSize)
*pOutSize = appDataSize;
return OLV_RESULT_SUCCESS;
}
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
static sint32 __GetAppData(UploadedCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetAppData(pBuffer, pOutSize, bufferSize);
}
uint32 GetAppDataSize() const
{
if (this->TestFlags(FLAG_HAS_APP_DATA))
return this->appDataLen;
return 0;
}
static uint32 __GetAppDataSize(UploadedCommunityData* _this)
{
return _this->GetAppDataSize();
}
sint32 GetIconData(uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
if (!pBuffer)
return OLV_RESULT_INVALID_PTR;
if (bufferSize < sizeof(this->iconData))
return OLV_RESULT_NOT_ENOUGH_SIZE;
if (!this->TestFlags(FLAG_HAS_ICON_DATA))
return OLV_RESULT_MISSING_DATA;
sint32 decodeRes = DecodeTGA(this->iconData, this->iconDataSize, pBuffer, bufferSize, TGACheckType::CHECK_COMMUNITY_ICON);
if (decodeRes >= 0)
{
if (pOutSize)
*pOutSize = (uint32)decodeRes;
return OLV_RESULT_SUCCESS;
}
if (pOutSize)
*pOutSize = 0;
if (decodeRes == -1)
cemuLog_log(LogType::Force, "OLIVE - icon uncompress failed.\n");
else if (decodeRes == -2)
cemuLog_log(LogType::Force, "OLIVE - icon decode error. NOT TGA.\n");
return OLV_RESULT_INVALID_TEXT_FIELD;
}
static sint32 __GetIconData(UploadedCommunityData* _this, uint8* pBuffer, uint32be* pOutSize, uint32 bufferSize)
{
return _this->GetIconData(pBuffer, pOutSize, bufferSize);
}
public:
uint32be flags;
uint32be communityId;
uint32be pid;
char16_t titleText[128];
uint32be titleTextMaxLen;
char16_t description[256];
uint32be descriptionMaxLen;
uint8 appData[1024];
uint32be appDataLen;
uint8 iconData[65580];
uint32be iconDataSize;
uint8 unk[6328];
};
static_assert(sizeof(nn::olv::UploadedCommunityData) == 0x12000, "sizeof(nn::olv::UploadedCommunityData) != 0x12000");
class UploadCommunityDataParam
{
public:
static const inline uint32 FLAG_DELETION = (1 << 0);
UploadCommunityDataParam()
{
this->appDataLen = 0;
this->communityId = 0;
this->titleId = 0;
this->iconData = MEMPTR<uint8>(nullptr);
this->appData = MEMPTR<uint8>(nullptr);
this->iconDataLen = 0;
this->flags = 0;
memset(this->titleText, 0, sizeof(this->titleText));
memset(this->description, 0, sizeof(this->description));
for (int i = 0; i < 5; i++)
memset(this->searchKeys[i], 0, sizeof(this->searchKeys[0]));
}
static UploadCommunityDataParam* __ctor(UploadCommunityDataParam* _this)
{
if (!_this)
{
assert_dbg(); // DO NOT CONTINUE, SHOULD NEVER HAPPEN
return nullptr;
}
else
return new (_this) UploadCommunityDataParam();
}
sint32 SetFlags(uint32 flags)
{
this->flags = flags;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetFlags(UploadCommunityDataParam* _this, uint32 flags)
{
return _this->SetFlags(flags);
}
sint32 SetCommunityId(uint32 communityId)
{
if (communityId == -1)
return OLV_RESULT_INVALID_PARAMETER;
this->communityId = communityId;
return OLV_RESULT_SUCCESS;
}
static sint32 __SetCommunityId(UploadCommunityDataParam* _this, uint32 communityId)
{
return _this->SetCommunityId(communityId);
}
sint32 SetAppData(MEMPTR<uint8> pBuffer, uint32 bufferSize)
{
if (!pBuffer.IsNull())
{
if (bufferSize - 1 >= 0x400)
return OLV_RESULT_NOT_ENOUGH_SIZE;
this->appData = pBuffer;
this->appDataLen = bufferSize;
}
else
{
this->appData = MEMPTR<uint8>(nullptr);
this->appDataLen = 0;
}
return OLV_RESULT_SUCCESS;
}
static sint32 __SetAppData(UploadCommunityDataParam* _this, MEMPTR<uint8> pBuffer, uint32 bufferSize)
{
return _this->SetAppData(pBuffer, bufferSize);
}
sint32 SetTitleText(char16_t const* pText)
{
if (pText)
return olv_copy_wstr(this->titleText, pText, 127, 128);
memset(this->titleText, 0, sizeof(this->titleText));
return OLV_RESULT_SUCCESS;
}
static sint32 __SetTitleText(UploadCommunityDataParam* _this, char16_t const* pText)
{
return _this->SetTitleText(pText);
}
sint32 SetDescriptionText(char16_t const* pText)
{
if (pText)
return olv_copy_wstr(this->description, pText, 255, 256);
memset(this->description, 0, sizeof(this->description));
return OLV_RESULT_SUCCESS;
}
static sint32 __SetDescriptionText(UploadCommunityDataParam* _this, char16_t const* pText)
{
return _this->SetDescriptionText(pText);
}
sint32 SetIconData(MEMPTR<uint8> pBuffer, uint32 bufferSize)
{
if (!pBuffer.IsNull())
{
if (bufferSize)
{
if (bufferSize - 0x10012 < 0x1B)
{
if (CheckTGA(pBuffer.GetPtr(), bufferSize, TGACheckType::CHECK_COMMUNITY_ICON))
{
this->iconData = pBuffer;
this->iconDataLen = bufferSize;
return OLV_RESULT_SUCCESS;
}
else
{
cemuLog_log(LogType::Force, "OLIVE - SetIconData: TGA Check Failed.\n");
return OLV_RESULT_INVALID_DATA;
}
}
else
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
else
return OLV_RESULT_NOT_ENOUGH_SIZE;
}
else
{
this->iconData = MEMPTR<uint8>(nullptr);
this->iconDataLen = 0;
return OLV_RESULT_SUCCESS;
}
}
static sint32 __SetIconData(UploadCommunityDataParam* _this, MEMPTR<uint8> pBuffer, uint32 bufferSize)
{
return _this->SetIconData(pBuffer, bufferSize);
}
public:
uint32be flags;
sint32be ___padding_0c;
uint64be titleId;
uint32be communityId;
char16_t titleText[128];
char16_t description[256];
char16_t searchKeys[5][152];
MEMPTR<uint8_t> appData;
uint32be appDataLen;
MEMPTR<uint8_t> iconData;
uint32be iconDataLen;
char unk3[1772];
};
static_assert(sizeof(nn::olv::UploadCommunityDataParam) == 0x1000, "sizeof(nn::olv::UploadCommunityDataParam) != 0x1000");
sint32 UploadCommunityData(UploadCommunityDataParam const* pParam);
sint32 UploadCommunityData(UploadedCommunityData* pOutData, UploadCommunityDataParam const* pParam);
static void loadOliveUploadCommunityTypes()
{
cafeExportRegisterFunc(UploadedCommunityData::__ctor, "nn_olv", "__ct__Q3_2nn3olv21UploadedCommunityDataFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__TestFlags, "nn_olv", "TestFlags__Q3_2nn3olv21UploadedCommunityDataCFUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetCommunityId, "nn_olv", "GetCommunityId__Q3_2nn3olv21UploadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetCommunityCode, "nn_olv", "GetCommunityCode__Q3_2nn3olv21UploadedCommunityDataCFPcUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetOwnerPid, "nn_olv", "GetOwnerPid__Q3_2nn3olv21UploadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetTitleText, "nn_olv", "GetTitleText__Q3_2nn3olv21UploadedCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetDescriptionText, "nn_olv", "GetDescriptionText__Q3_2nn3olv21UploadedCommunityDataCFPwUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetAppData, "nn_olv", "GetAppData__Q3_2nn3olv21UploadedCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetAppDataSize, "nn_olv", "GetAppDataSize__Q3_2nn3olv21UploadedCommunityDataCFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedCommunityData::__GetIconData, "nn_olv", "GetIconData__Q3_2nn3olv21UploadedCommunityDataCFPUcPUiUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__ctor, "nn_olv", "__ct__Q3_2nn3olv24UploadCommunityDataParamFv", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetFlags, "nn_olv", "SetFlags__Q3_2nn3olv24UploadCommunityDataParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetCommunityId, "nn_olv", "SetCommunityId__Q3_2nn3olv24UploadCommunityDataParamFUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetAppData, "nn_olv", "SetAppData__Q3_2nn3olv24UploadCommunityDataParamFPCUcUi", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetTitleText, "nn_olv", "SetTitleText__Q3_2nn3olv24UploadCommunityDataParamFPCw", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetDescriptionText, "nn_olv", "SetDescriptionText__Q3_2nn3olv24UploadCommunityDataParamFPCw", LogType::NN_OLV);
cafeExportRegisterFunc(UploadCommunityDataParam::__SetIconData, "nn_olv", "SetIconData__Q3_2nn3olv24UploadCommunityDataParamFPCUcUi", LogType::NN_OLV);
cafeExportRegisterFunc((sint32(*)(UploadCommunityDataParam const*))UploadCommunityData,
"nn_olv", "UploadCommunityData__Q2_2nn3olvFPCQ3_2nn3olv24UploadCommunityDataParam", LogType::NN_OLV);
cafeExportRegisterFunc((sint32(*)(UploadedCommunityData *, UploadCommunityDataParam const*))UploadCommunityData,
"nn_olv", "UploadCommunityData__Q2_2nn3olvFPQ3_2nn3olv21UploadedCommunityDataPCQ3_2nn3olv24UploadCommunityDataParam", LogType::NN_OLV);
}
}
}
| 13,894
|
C++
|
.h
| 372
| 31.263441
| 166
| 0.694187
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,555
|
nn_olv_PostTypes.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h
|
#pragma once
#include <zlib.h>
#include "nn_olv_Common.h"
namespace nn
{
namespace olv
{
struct DownloadedDataBase
{
enum class FLAGS : uint32
{
HAS_BODY_TEXT = 0x01,
HAS_BODY_MEMO = 0x02,
HAS_EXTERNAL_IMAGE = 0x04,
HAS_EXTERNAL_BINARY_DATA = 0x08,
HAS_MII_DATA = 0x10,
HAS_EXTERNAL_URL = 0x20,
HAS_APP_DATA = 0x40,
HAS_EMPATHY_ADDED = 0x80,
IS_AUTOPOST = 0x100,
IS_SPOILER = 0x200,
IS_NOT_AUTOPOST = 0x400, // autopost flag was explicitly set to false
};
void Reset()
{
memset(this, 0, sizeof(DownloadedDataBase));
}
void SetFlag(FLAGS flag)
{
flags = (FLAGS)((uint32)flags.value() | (uint32)flag);
}
betype<FLAGS> flags;
uint32be userPid;
uint8be postId[32]; // string, up to 22 characters but the buffer is 32 bytes
uint64be postDate;
sint8be feeling;
uint8be _padding0031[3];
uint32be regionId;
uint8be platformId;
uint8be languageId;
uint8be countryId;
uint8be _padding003B;
uint16be bodyText[256];
uint32be bodyTextLength;
uint8be compressedMemoBody[40960];
uint32be compressedMemoBodySize;
uint16be topicTag[152];
uint8be appData[1024];
uint32be appDataLength;
uint8be externalBinaryUrl[256];
uint32be externalBinaryDataSize;
uint8be externalImageDataUrl[256];
uint32be externalImageDataSize;
uint8be externalURL[256];
uint8be miiData[96];
uint16be miiNickname[16];
uint32be _paddingAB00[1344];
uint32be uknC000_someVTableMaybe;
uint32be uknC004;
// getters
// TestFlags__Q3_2nn3olv18DownloadedDataBaseCFUi
static bool TestFlags(DownloadedDataBase* _this, DownloadedDataBase::FLAGS flag)
{
return HAS_FLAG((uint32)_this->flags.value(), (uint32)flag);
}
// GetUserPid__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetUserPid(DownloadedDataBase* _this)
{
return _this->userPid;
}
// GetPostDate__Q3_2nn3olv18DownloadedDataBaseCFv
static uint64 GetPostDate(DownloadedDataBase* _this)
{
return _this->postDate;
}
// GetFeeling__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetFeeling(DownloadedDataBase* _this)
{
if(_this->feeling >= 6)
return 0;
return _this->feeling;
}
// GetRegionId__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetRegionId(DownloadedDataBase* _this)
{
return _this->regionId;
}
// GetPlatformId__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetPlatformId(DownloadedDataBase* _this)
{
return _this->platformId;
}
// GetLanguageId__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetLanguageId(DownloadedDataBase* _this)
{
return _this->languageId;
}
// GetCountryId__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetCountryId(DownloadedDataBase* _this)
{
return _this->countryId;
}
// GetExternalUrl__Q3_2nn3olv18DownloadedDataBaseCFv
static uint8be* GetExternalUrl(DownloadedDataBase* _this)
{
if (!TestFlags(_this, FLAGS::HAS_EXTERNAL_URL))
return nullptr;
return _this->externalURL;
}
// GetMiiData__Q3_2nn3olv18DownloadedDataBaseCFP12FFLStoreData
static nnResult GetMiiData1(DownloadedDataBase* _this, void* miiDataOut)
{
if (!TestFlags(_this, FLAGS::HAS_MII_DATA))
return OLV_RESULT_MISSING_DATA;
if (!miiDataOut)
return OLV_RESULT_INVALID_PTR;
memcpy(miiDataOut, _this->miiData, 96);
return OLV_RESULT_SUCCESS;
}
// GetMiiData__Q3_2nn3olv18DownloadedDataBaseCFv
static uint8be* GetMiiData2(DownloadedDataBase* _this)
{
if (!TestFlags(_this, FLAGS::HAS_MII_DATA))
return nullptr;
return _this->miiData;
}
// GetMiiNickname__Q3_2nn3olv18DownloadedDataBaseCFv
static uint16be* GetMiiNickname(DownloadedDataBase* _this)
{
if (_this->miiNickname[0] == 0)
return nullptr;
return _this->miiNickname;
}
// GetBodyText__Q3_2nn3olv18DownloadedDataBaseCFPwUi
static nnResult GetBodyText(DownloadedDataBase* _this, uint16be* bodyTextOut, uint32 maxLength)
{
if (!bodyTextOut)
return OLV_RESULT_INVALID_PTR;
if (maxLength == 0)
return OLV_RESULT_NOT_ENOUGH_SIZE;
if (!TestFlags(_this, FLAGS::HAS_BODY_TEXT))
return OLV_RESULT_MISSING_DATA;
memset(bodyTextOut, 0, maxLength * sizeof(uint16));
uint32 outputLength = std::min<uint32>(_this->bodyTextLength, maxLength);
olv_wstrncpy((char16_t*)bodyTextOut, (char16_t*)_this->bodyText, outputLength);
return OLV_RESULT_SUCCESS;
}
// GetBodyMemo__Q3_2nn3olv18DownloadedDataBaseCFPUcPUiUi
static nnResult GetBodyMemo(DownloadedDataBase* _this, uint8be* bodyMemoOut, uint32* bodyMemoSizeOut, uint32 maxSize)
{
if (!bodyMemoOut)
return OLV_RESULT_INVALID_PTR;
if (maxSize < 0x2582C)
return OLV_RESULT_NOT_ENOUGH_SIZE;
if (!TestFlags(_this, FLAGS::HAS_BODY_MEMO))
return OLV_RESULT_MISSING_DATA;
// uncompress TGA
uLongf decompressedSize = maxSize;
if (uncompress((uint8*)bodyMemoOut, &decompressedSize, (uint8*)_this->compressedMemoBody, _this->compressedMemoBodySize) != Z_OK)
{
cemuLog_log(LogType::Force, "DownloadedSystemTopicData::GetTitleIconData: uncompress failed");
return OLV_RESULT_INVALID_TEXT_FIELD; // status
}
if(bodyMemoSizeOut)
*bodyMemoSizeOut = decompressedSize;
// todo - verify TGA header
return OLV_RESULT_SUCCESS;
}
// GetTopicTag__Q3_2nn3olv18DownloadedDataBaseCFv
static uint16be* GetTopicTag(DownloadedDataBase* _this)
{
return _this->topicTag;
}
// GetAppData__Q3_2nn3olv18DownloadedDataBaseCFPUcPUiUi
static nnResult GetAppData(DownloadedDataBase* _this, uint8be* appDataOut, uint32* appDataSizeOut, uint32 maxSize)
{
if (!appDataOut)
return OLV_RESULT_INVALID_PTR;
if (!TestFlags(_this, FLAGS::HAS_APP_DATA))
return OLV_RESULT_MISSING_DATA;
uint32 outputSize = std::min<uint32>(maxSize, _this->appDataLength);
memcpy(appDataOut, _this->appData, outputSize);
if(appDataSizeOut)
*appDataSizeOut = outputSize;
return OLV_RESULT_SUCCESS;
}
// GetAppDataSize__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetAppDataSize(DownloadedDataBase* _this)
{
return _this->appDataLength;
}
// GetPostId__Q3_2nn3olv18DownloadedDataBaseCFv
static uint8be* GetPostId(DownloadedDataBase* _this)
{
return _this->postId;
}
// DownloadExternalImageData__Q3_2nn3olv18DownloadedDataBaseCFPvPUiUi
static nnResult DownloadExternalImageData(DownloadedDataBase* _this, void* imageDataOut, uint32be* imageSizeOut, uint32 maxSize);
// GetExternalImageDataSize__Q3_2nn3olv18DownloadedDataBaseCFv
static uint32 GetExternalImageDataSize(DownloadedDataBase* _this)
{
if (!TestFlags(_this, FLAGS::HAS_EXTERNAL_IMAGE))
return 0;
return _this->externalImageDataSize;
}
// todo:
// DownloadExternalImageData__Q3_2nn3olv18DownloadedDataBaseCFPvPUiUi (implement downloading)
// DownloadExternalBinaryData__Q3_2nn3olv18DownloadedDataBaseCFPvPUiUi
// GetExternalBinaryDataSize__Q3_2nn3olv18DownloadedDataBaseCFv
};
static_assert(sizeof(DownloadedDataBase) == 0xC008);
struct DownloadedPostData
{
DownloadedDataBase downloadedDataBase;
uint32be communityId;
uint32be empathyCount;
uint32be commentCount;
uint32be paddingC014[125]; // probably unused?
// getters
// GetCommunityId__Q3_2nn3olv18DownloadedPostDataCFv
static uint32 GetCommunityId(DownloadedPostData* _this)
{
return _this->communityId;
}
// GetEmpathyCount__Q3_2nn3olv18DownloadedPostDataCFv
static uint32 GetEmpathyCount(DownloadedPostData* _this)
{
return _this->empathyCount;
}
// GetCommentCount__Q3_2nn3olv18DownloadedPostDataCFv
static uint32 GetCommentCount(DownloadedPostData* _this)
{
return _this->commentCount;
}
// GetPostId__Q3_2nn3olv18DownloadedPostDataCFv
static uint8be* GetPostId(DownloadedPostData* _this)
{
return _this->downloadedDataBase.postId;
}
};
static_assert(sizeof(DownloadedPostData) == 0xC208);
struct DownloadedTopicData
{
enum class FLAGS
{
IS_RECOMMENDED = 0x01,
HAS_TITLE = 0x02,
HAS_ICON_DATA = 0x04,
};
betype<FLAGS> flags;
uint32be communityId;
int ukn[1022];
void SetFlag(FLAGS flag)
{
flags = (FLAGS)((uint32)flags.value() | (uint32)flag);
}
// GetCommunityId__Q3_2nn3olv19DownloadedTopicDataCFv
static uint32 GetCommunityId(DownloadedTopicData* _this)
{
return _this->communityId;
}
};
static_assert(sizeof(DownloadedTopicData) == 0x1000);
namespace hidden
{
struct DownloadedSystemPostData
{
DownloadedPostData downloadedPostData;
uint64be titleId;
uint32be uknC210[124];
uint32be uknC400;
uint32be uknC404;
// getters
// GetTitleId__Q4_2nn3olv6hidden24DownloadedSystemPostDataCFv
static uint64 GetTitleId(DownloadedSystemPostData* _this)
{
return _this->titleId;
}
};
static_assert(sizeof(DownloadedSystemPostData) == 0xC408);
struct DownloadedSystemTopicData
{
DownloadedTopicData downloadedTopicData;
uint64be titleId;
uint16be titleText[128];
uint8be ukn1108[256];
uint8be iconData[0x1002C];
uint32be iconDataSize;
uint64be titleIds[32];
uint32be titleIdsCount;
uint32be ukn1133C[1841];
// implement getters as static methods for compatibility with CafeExportRegisterFunc()
// TestFlags__Q4_2nn3olv6hidden25DownloadedSystemTopicDataCFUi
static bool TestFlags(DownloadedSystemTopicData* _this, DownloadedTopicData::FLAGS flag)
{
return HAS_FLAG((uint32)_this->downloadedTopicData.flags.value(), (uint32)flag);
}
// GetTitleId__Q4_2nn3olv6hidden25DownloadedSystemTopicDataCFv
static uint64 GetTitleId(DownloadedSystemTopicData* _this)
{
return _this->titleId;
}
// GetTitleIdNum__Q4_2nn3olv6hidden25DownloadedSystemTopicDataCFv
static uint32 GetTitleIdNum(DownloadedSystemTopicData* _this)
{
return _this->titleIdsCount;
}
// GetTitleText__Q4_2nn3olv6hidden25DownloadedSystemTopicDataCFPwUi
static nnResult GetTitleText(DownloadedSystemTopicData* _this, uint16be* titleTextOut, uint32 maxLength)
{
if (!TestFlags(_this, DownloadedTopicData::FLAGS::HAS_TITLE))
return OLV_RESULT_MISSING_DATA;
if (!titleTextOut)
return OLV_RESULT_INVALID_PTR;
memset(titleTextOut, 0, maxLength * sizeof(uint16be));
if (maxLength > 128)
maxLength = 128;
olv_wstrncpy((char16_t*)titleTextOut, (char16_t*)_this->titleText, maxLength);
return OLV_RESULT_SUCCESS;
}
// GetTitleIconData__Q4_2nn3olv6hidden25DownloadedSystemTopicDataCFPUcPUiUi
static nnResult GetTitleIconData(DownloadedSystemTopicData* _this, void* iconDataOut, uint32be* iconSizeOut, uint32 iconDataMaxSize)
{
if (!TestFlags(_this, DownloadedTopicData::FLAGS::HAS_ICON_DATA))
return OLV_RESULT_MISSING_DATA;
if (!iconDataOut)
return OLV_RESULT_INVALID_PTR;
if (iconDataMaxSize < 0x1002C)
return OLV_RESULT_NOT_ENOUGH_SIZE;
uLongf decompressedSize = iconDataMaxSize;
if (uncompress((uint8*)iconDataOut, &decompressedSize, (uint8*)_this->iconData, _this->iconDataSize) != Z_OK)
{
cemuLog_log(LogType::Force, "DownloadedSystemTopicData::GetTitleIconData: uncompress failed");
return OLV_RESULT_INVALID_TEXT_FIELD; // status
}
*iconSizeOut = decompressedSize;
// todo - check for TGA
return OLV_RESULT_SUCCESS;
}
};
static_assert(sizeof(DownloadedSystemTopicData) == 0x13000);
struct DownloadedSystemTopicDataList
{
static constexpr size_t MAX_TOPIC_COUNT = 10;
static constexpr size_t MAX_POSTS_PER_TOPIC = 300;
// 0x134B8 sized wrapper of DownloadedSystemTopicData
struct DownloadedSystemTopicWrapped
{
DownloadedSystemTopicData downloadedSystemTopicData;
uint32be postDataNum;
MEMPTR<DownloadedSystemPostData> postDataList[MAX_POSTS_PER_TOPIC];
uint32 uknPadding;
};
static_assert(offsetof(DownloadedSystemTopicWrapped, postDataNum) == 0x13000);
static_assert(sizeof(DownloadedSystemTopicWrapped) == 0x134B8);
static uint32 GetDownloadedSystemTopicDataNum(DownloadedSystemTopicDataList* _this)
{
return _this->topicDataNum;
};
static uint32 GetDownloadedSystemPostDataNum(DownloadedSystemTopicDataList* _this, uint32 topicIndex)
{
if(topicIndex >= MAX_TOPIC_COUNT)
return 0;
return _this->topicData[topicIndex].postDataNum;
};
static DownloadedSystemTopicData* GetDownloadedSystemTopicData(DownloadedSystemTopicDataList* _this, uint32 topicIndex)
{
if(topicIndex >= MAX_TOPIC_COUNT)
return nullptr;
return &_this->topicData[topicIndex].downloadedSystemTopicData;
};
static DownloadedSystemPostData* GetDownloadedSystemPostData(DownloadedSystemTopicDataList* _this, sint32 topicIndex, sint32 postIndex)
{
if (topicIndex >= MAX_TOPIC_COUNT || postIndex >= MAX_POSTS_PER_TOPIC)
return nullptr;
return _this->topicData[topicIndex].postDataList[postIndex];
}
// member variables
uint32be topicDataNum;
uint32be ukn4;
DownloadedSystemTopicWrapped topicData[MAX_TOPIC_COUNT];
uint32be uknC0F38[50];
};
static_assert(sizeof(DownloadedSystemTopicDataList) == 0xC1000);
}
struct DownloadPostDataListParam
{
static constexpr size_t MAX_NUM_SEARCH_PID = 12;
static constexpr size_t MAX_NUM_SEARCH_KEY = 5;
static constexpr size_t MAX_NUM_POST_ID = 20;
enum class FLAGS
{
FRIENDS_ONLY = 0x01, // friends only
FOLLOWERS_ONLY = 0x02, // followers only
SELF_ONLY = 0x04, // self only
ONLY_TYPE_TEXT = 0x08,
ONLY_TYPE_MEMO = 0x10,
UKN_20 = 0x20,
WITH_MII = 0x40, // with mii
WITH_EMPATHY = 0x80, // with yeahs added
UKN_100 = 0x100,
UKN_200 = 0x200, // "is_delay" parameter
UKN_400 = 0x400, // "is_hot" parameter
};
struct SearchKey
{
uint16be str[152];
};
struct PostId
{
char str[32];
};
betype<FLAGS> flags;
uint32be communityId;
uint32be searchPid[MAX_NUM_SEARCH_PID];
uint8 languageId;
uint8 hasLanguageId_039;
uint8 padding03A[2];
uint32be postDataMaxNum;
SearchKey searchKeyArray[MAX_NUM_SEARCH_KEY];
PostId searchPostId[MAX_NUM_POST_ID];
uint64be postDate; // OSTime?
uint64be titleId; // only used by System posts?
uint32be bodyTextMaxLength;
uint8 padding8C4[1852];
bool _HasFlag(FLAGS flag)
{
return ((uint32)flags.value() & (uint32)flag) != 0;
}
void _SetFlags(FLAGS flag)
{
flags = (FLAGS)((uint32)flags.value() | (uint32)flag);
}
// constructor and getters
// __ct__Q3_2nn3olv25DownloadPostDataListParamFv
static DownloadPostDataListParam* Construct(DownloadPostDataListParam* _this)
{
memset(_this, 0, sizeof(DownloadPostDataListParam));
return _this;
}
// SetFlags__Q3_2nn3olv25DownloadPostDataListParamFUi
static nnResult SetFlags(DownloadPostDataListParam* _this, FLAGS flags)
{
// todo - verify flag combos
_this->flags = flags;
return OLV_RESULT_SUCCESS;
}
// SetLanguageId__Q3_2nn3olv25DownloadPostDataListParamFUc
static nnResult SetLanguageId(DownloadPostDataListParam* _this, uint8 languageId)
{
_this->languageId = languageId;
_this->hasLanguageId_039 = 1;
return OLV_RESULT_SUCCESS;
}
// SetCommunityId__Q3_2nn3olv25DownloadPostDataListParamFUi
static nnResult SetCommunityId(DownloadPostDataListParam* _this, uint32 communityId)
{
_this->communityId = communityId;
return OLV_RESULT_SUCCESS;
}
// SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCwUc
static nnResult SetSearchKey(DownloadPostDataListParam* _this, const uint16be* searchKey, uint8 searchKeyIndex)
{
if( !searchKey )
{
memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey));
return OLV_RESULT_SUCCESS;
}
if (searchKeyIndex >= MAX_NUM_SEARCH_KEY)
return OLV_RESULT_INVALID_PARAMETER;
memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey));
if(olv_wstrnlen((const char16_t*)searchKey, 152) > 50)
{
cemuLog_log(LogType::Force, "DownloadPostDataListParam::SetSearchKey: searchKey is too long\n");
return OLV_RESULT_INVALID_PARAMETER;
}
SetStringUC2(_this->searchKeyArray[searchKeyIndex].str, searchKey);
return OLV_RESULT_SUCCESS;
}
// SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCw
static nnResult SetSearchKeySingle(DownloadPostDataListParam* _this, const uint16be* searchKey)
{
if (searchKey == nullptr)
{
cemuLog_logDebug(LogType::NN_OLV, "DownloadPostDataListParam::SetSearchKeySingle: searchKeySingle is Null\n");
return OLV_RESULT_INVALID_PARAMETER;
}
return SetSearchKey(_this, searchKey, 0);
}
// SetSearchPid__Q3_2nn3olv25DownloadPostDataListParamFUi
static nnResult SetSearchPid(DownloadPostDataListParam* _this, uint32 searchPid)
{
if(_this->_HasFlag(FLAGS::FRIENDS_ONLY) || _this->_HasFlag(FLAGS::FOLLOWERS_ONLY) || _this->_HasFlag(FLAGS::SELF_ONLY))
return OLV_RESULT_INVALID_PARAMETER;
_this->searchPid[0] = searchPid;
return OLV_RESULT_SUCCESS;
}
// SetPostId__Q3_2nn3olv25DownloadPostDataListParamFPCcUi
static nnResult SetPostId(DownloadPostDataListParam* _this, const char* postId, uint32 postIdIndex)
{
if (postIdIndex >= MAX_NUM_POST_ID)
return OLV_RESULT_INVALID_PARAMETER;
memset(&_this->searchPostId[postIdIndex], 0, sizeof(PostId));
if (strlen(postId) > 22)
{
cemuLog_log(LogType::Force, "DownloadPostDataListParam::SetPostId: postId is too long\n");
return OLV_RESULT_INVALID_PARAMETER;
}
strcpy(_this->searchPostId[postIdIndex].str, postId);
return OLV_RESULT_SUCCESS;
}
// SetPostDate__Q3_2nn3olv25DownloadPostDataListParamFL
static nnResult SetPostDate(DownloadPostDataListParam* _this, uint64 postDate)
{
_this->postDate = postDate;
return OLV_RESULT_SUCCESS;
}
// SetPostDataMaxNum__Q3_2nn3olv25DownloadPostDataListParamFUi
static nnResult SetPostDataMaxNum(DownloadPostDataListParam* _this, uint32 postDataMaxNum)
{
if(postDataMaxNum == 0)
return OLV_RESULT_INVALID_PARAMETER;
_this->postDataMaxNum = postDataMaxNum;
return OLV_RESULT_SUCCESS;
}
// SetBodyTextMaxLength__Q3_2nn3olv25DownloadPostDataListParamFUi
static nnResult SetBodyTextMaxLength(DownloadPostDataListParam* _this, uint32 bodyTextMaxLength)
{
if(bodyTextMaxLength >= 256)
return OLV_RESULT_INVALID_PARAMETER;
_this->bodyTextMaxLength = bodyTextMaxLength;
return OLV_RESULT_SUCCESS;
}
// GetRawDataUrl__Q3_2nn3olv25DownloadPostDataListParamCFPcUi
static nnResult GetRawDataUrl(DownloadPostDataListParam* _this, char* urlOut, uint32 urlMaxSize);
};
static_assert(sizeof(DownloadPostDataListParam) == 0x1000);
// parsing functions
bool ParseXML_DownloadedPostData(DownloadedPostData& obj, pugi::xml_node& xmlNode);
void loadOlivePostAndTopicTypes();
}
}
| 19,189
|
C++
|
.h
| 542
| 30.690037
| 139
| 0.73896
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,556
|
vpad.h
|
cemu-project_Cemu/src/Cafe/OS/libs/vpad/vpad.h
|
#pragma once
#include "Cafe/OS/libs/padscore/padscore.h"
namespace vpad
{
void load();
void start();
}
#define VPAD_MAX_CONTROLLERS (2)
struct BtnRepeat
{
sint32 delay, pulse;
};
enum VPADTouchValidity
{
kTpValid = 0,
kTpInvalidX = 1, // only x invalid
kTpInvalidY = 2, // only y invalid
kTpInvalid = kTpInvalidX | kTpInvalidY,
};
enum VPADTouchState
{
kTpTouchOff = 0,
kTpTouchOn = 1,
};
struct VPADDir
{
beVec3D_t x;
beVec3D_t y;
beVec3D_t z;
VPADDir() = default;
VPADDir(const beVec3D_t& x, const beVec3D_t& y, const beVec3D_t& z)
: x(x), y(y), z(z) {}
};
static_assert(sizeof(VPADDir) == 0x24);
struct VPADTPData_t
{
uint16be x;
uint16be y;
uint16be touch;
uint16be validity;
};
static_assert(sizeof(VPADTPData_t) == 8);
typedef struct VPADStatus
{
/* +0x00 */ uint32be hold;
/* +0x04 */ uint32be trig;
/* +0x08 */ uint32be release;
/* +0x0C */ beVec2D_t leftStick;
/* +0x14 */ beVec2D_t rightStick;
/* +0x1C */ beVec3D_t acc;
/* +0x28 */ float32be accMagnitude;
/* +0x2C */ float32be accAcceleration;
/* +0x30 */ beVec2D_t accXY;
/* +0x38 */ beVec3D_t gyroChange;
/* +0x44 */ beVec3D_t gyroOrientation;
/* +0x50 */ sint8 vpadErr;
/* +0x51 */ uint8 padding1[1];
/* +0x52 */ VPADTPData_t tpData;
/* +0x5A */ VPADTPData_t tpProcessed1;
/* +0x62 */ VPADTPData_t tpProcessed2;
/* +0x6A */ uint8 padding2[2];
/* +0x6C */ VPADDir dir;
/* +0x90 */ uint8 headphoneStatus;
/* +0x91 */ uint8 padding3[3];
/* +0x94 */ beVec3D_t magnet;
/* +0xA0 */ uint8 slideVolume;
/* +0xA1 */ uint8 batteryLevel;
/* +0xA2 */ uint8 micStatus;
/* +0xA3 */ uint8 slideVolume2;
/* +0xA4 */ uint8 padding4[8];
}VPADStatus_t;
static_assert(sizeof(VPADStatus) == 0xAC);
| 1,702
|
C++
|
.h
| 72
| 21.805556
| 68
| 0.684406
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,557
|
nsysnet.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsysnet/nsysnet.h
|
#pragma once
#include <set>
#include <vector>
#if BOOST_OS_WINDOWS
#include <WinSock2.h>
#else
#include <sys/socket.h>
#define SOCKET int
#define closesocket close
#endif
typedef signed int WUSOCKET;
void nsysnet_load();
WUSOCKET nsysnet_createVirtualSocketFromExistingSocket(SOCKET existingSocket);
void nsysnet_notifyCloseSharedSocket(SOCKET existingSocket);
struct wu_fd_set
{
uint32be mask;
};
void _translateFDSet(fd_set* hostSet, struct wu_fd_set* fdset, sint32 nfds);
void _translateFDSetRev(struct wu_fd_set* fdset, fd_set* hostSet, sint32 nfds);
sint32 nsysnet_getVirtualSocketHandleFromHostHandle(SOCKET s);
namespace nsysnet
{
#define NSSL_OK (0)
#define NSSL_INVALID_CTX (0xFFD7FFFF)
struct NSSLInternalState_t
{
bool destroyed;
uint32 sslVersion;
uint32 clientPKI;
std::set<uint32> serverPKIs;
std::vector<std::vector<uint8>> serverCustomPKIs;
};
NSSLInternalState_t* GetNSSLContext(sint32 index);
void wuResetFD(struct wu_fd_set* fdset);
void wuSetFD(struct wu_fd_set* fdset, sint32 fd);
}
| 1,031
|
C++
|
.h
| 37
| 26.135135
| 79
| 0.804878
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,558
|
nn_save.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_save/nn_save.h
|
#pragma once
namespace nn
{
namespace save
{
void load();
void ResetToDefaultState();
bool GetPersistentIdEx(uint8 accountSlot, uint32* persistentId);
}
}
| 163
|
C++
|
.h
| 10
| 14.5
| 65
| 0.794702
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,559
|
nn_acp.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_acp/nn_acp.h
|
#pragma once
#include "Cafe/IOSU/legacy/iosu_acp.h"
namespace nn
{
namespace acp
{
enum ACPStatus : uint32
{
SUCCESS = 0,
};
using ACPDeviceType = iosu::acp::ACPDeviceType;
ACPStatus ACPGetApplicationBox(uint32be* applicationBox, uint64 titleId);
ACPStatus ACPMountSaveDir();
ACPStatus ACPUnmountSaveDir();
ACPStatus ACPCreateSaveDir(uint32 persistentId, iosu::acp::ACPDeviceType type);
ACPStatus ACPUpdateSaveTimeStamp(uint32 persistentId, uint64 titleId, iosu::acp::ACPDeviceType deviceType);
void load();
}
}
| 531
|
C++
|
.h
| 19
| 25.947368
| 108
| 0.80315
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,560
|
nn_pdm.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_pdm/nn_pdm.h
|
namespace nn
{
namespace pdm
{
void Initialize();
};
};
| 60
|
C++
|
.h
| 7
| 7
| 20
| 0.685185
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,561
|
coreinit_OSScreen_font.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_OSScreen_font.h
|
// font 'More Perfect DOS VGA' 20pts
const uint8 osscreenBitmapFont[] =
{
// @0 '!' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @50 '"' (14 pixels wide)
0x00, 0x00, //
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x18, 0xC0, // ## ##
0x18, 0xC0, // ## ##
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @100 '#' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @150 '$' (14 pixels wide)
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0x60, // ### ##
0xE0, 0x60, // ### ##
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0x3F, 0x80, // #######
0x38, 0xA0, // ### # #
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0xC0, 0xE0, // ## ###
0xC0, 0xE0, // ## ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
// @200 '%' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x20, // ### #
0xF0, 0xF0, // #### ####
0xF0, 0xF0, // #### ####
0x01, 0xE0, // ####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1E, 0x00, // ####
0x38, 0x00, // ###
0x38, 0x00, // ###
0xF0, 0xE0, // #### ###
0xC0, 0xF0, // ## ####
0xC0, 0xF0, // ## ####
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @250 '&' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0x00, // #####
0x1F, 0x00, // #####
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x1F, 0x00, // #####
0x1F, 0x00, // #####
0x3E, 0xE0, // ##### ###
0xB7, 0xE0, // # ## ######
0xE7, 0xC0, // ### #####
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3E, 0xE0, // ##### ###
0x3E, 0xE0, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @300 ''' (14 pixels wide)
0x00, 0x00, //
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @350 '(' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @400 ')' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @450 '*' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x1F, 0xC0, // #######
0xFF, 0xF8, // #############
0xFF, 0xF8, // #############
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @500 '+' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x3F, 0xE0, // #########
0x3F, 0xE0, // #########
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @550 ',' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @600 '-' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @650 '.' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @700 '/' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x20, // #
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xF0, 0x00, // ####
0xC0, 0x00, // ##
0xC0, 0x00, // ##
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @750 '0' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x38, 0xE0, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x38, 0xE0, // ### ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @800 '1' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x03, 0x80, // ###
0x03, 0x80, // ###
0x0F, 0x80, // #####
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @850 '2' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x00, 0xE0, // ###
0x03, 0x80, // ###
0x03, 0x80, // ###
0x07, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0xE0, // ### ###
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @900 '3' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x1F, 0xC0, // #######
0x1C, 0x50, // ### # #
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @950 '4' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0xC0, // #####
0x07, 0xC0, // #####
0x1F, 0xC0, // #######
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0xF0, // #######
0x07, 0xF0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1000 '5' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xFF, 0x80, // #########
0xF0, 0xA0, // #### # #
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1050 '6' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0x80, // ######
0x1F, 0x80, // ######
0x38, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xFF, 0xC0, // ##########
0xFF, 0xC0, // ##########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1100 '7' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0xE0, 0xE0, // ### ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x03, 0x80, // ###
0x07, 0x80, // ####
0x07, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1150 '8' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0xA7, 0xC0, // # # #####
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1200 '9' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1250 ':' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1300 ';' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1350 '<' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x1C, 0x00, // ###
0x0E, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xC0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1400 '=' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1450 '>' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x38, 0x00, // ###
0x38, 0x00, // ###
0x0E, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xC0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x00, 0xE0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x0E, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1500 '?' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1550 '@' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE7, 0xC0, // ### #####
0xE7, 0xC0, // ### #####
0xE0, 0x00, // ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1600 'A' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x06, 0x00, // ##
0x06, 0x00, // ##
0x1F, 0x80, // ######
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1650 'B' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xC0, // ##########
0xFF, 0xC0, // ##########
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0xFF, 0xC0, // ##########
0xFF, 0xC0, // ##########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1700 'C' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x38, 0x70, // ### ###
0xE0, 0x30, // ### ##
0xE0, 0x30, // ### ##
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x30, // ### ##
0xE0, 0x30, // ### ##
0x38, 0x70, // ### ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1750 'D' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0x80, // #########
0xFF, 0x80, // #########
0x39, 0xC0, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x39, 0xC0, // ### ###
0xFF, 0x80, // #########
0xFF, 0x80, // #########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1800 'E' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x38, 0x70, // ### ###
0x38, 0x30, // ### ##
0x38, 0x30, // ### ##
0x39, 0x80, // ### ##
0x39, 0x80, // ### ##
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x39, 0x80, // ### ##
0x39, 0x80, // ### ##
0x38, 0x00, // ###
0x38, 0x30, // ### ##
0x38, 0x30, // ### ##
0x38, 0x70, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1850 'F' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x38, 0x70, // ### ###
0x38, 0x30, // ### ##
0x38, 0x30, // ### ##
0x39, 0x80, // ### ##
0x39, 0x80, // ### ##
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x39, 0x80, // ### ##
0x39, 0x80, // ### ##
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xFE, 0x00, // #######
0xFE, 0x00, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1900 'G' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x38, 0xF0, // ### ####
0xE0, 0x30, // ### ##
0xE0, 0x20, // ### #
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE0, 0xF0, // ### ####
0xE0, 0xF0, // ### ####
0xE0, 0xF0, // ### ####
0xE0, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x1F, 0x20, // ##### #
0x1F, 0x20, // ##### #
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @1950 'H' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2000 'I' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2050 'J' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0xF0, // #######
0x07, 0xF0, // #######
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3F, 0x00, // ######
0x3F, 0x00, // ######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2100 'K' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xF8, 0x70, // ##### ###
0xF8, 0x70, // ##### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0xF8, 0x70, // ##### ###
0xF8, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2150 'L' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFE, 0x00, // #######
0xFE, 0x00, // #######
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x30, // ### ##
0x38, 0x30, // ### ##
0x38, 0x70, // ### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2200 'M' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xF8, 0xF8, // ##### #####
0xF8, 0xF8, // ##### #####
0xFF, 0xF8, // #############
0xFF, 0xF8, // #############
0xFF, 0xF8, // #############
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2250 'N' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xF8, 0x70, // ##### ###
0xFE, 0x70, // ####### ###
0xFE, 0x70, // ####### ###
0xFF, 0xF0, // ############
0xFF, 0xF0, // ############
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0xE1, 0xF0, // ### #####
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2300 'O' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2350 'P' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xC0, // ##########
0xFF, 0xC0, // ##########
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xFE, 0x00, // #######
0xFE, 0x00, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2400 'Q' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE6, 0x70, // ### ## ###
0xE7, 0xF0, // ### #######
0xE7, 0xF0, // ### #######
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x01, 0xC0, // ###
0x01, 0xF0, // #####
0x01, 0xF0, // #####
0x00, 0x00, //
0x00, 0x00, //
// @2450 'R' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xC0, // ##########
0xFF, 0xC0, // ##########
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x39, 0xC0, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0xF8, 0x70, // ##### ###
0xF8, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2500 'S' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x1F, 0x80, // ######
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2550 'T' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xFC, // ##############
0xFF, 0xFC, // ##############
0xE7, 0x3C, // ### ### ####
0xE7, 0x0C, // ### ### ##
0xC7, 0x0C, // ## ### ##
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2600 'U' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2650 'V' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x1F, 0xC0, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2700 'W' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xFF, 0xF8, // #############
0xFF, 0xF8, // #############
0xF8, 0xF8, // ##### #####
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2750 'X' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2800 'Y' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x3C, // ### ####
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x38, 0xF0, // ### ####
0x38, 0xF0, // ### ####
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2850 'Z' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xFC, // ##############
0xFF, 0xF8, // #############
0xE0, 0x38, // ### ###
0xE0, 0xF0, // ### ####
0xC0, 0xF0, // ## ####
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1E, 0x00, // ####
0x38, 0x00, // ###
0x38, 0x00, // ###
0xE0, 0x0C, // ### ##
0xE0, 0x0C, // ### ##
0xE0, 0x3C, // ### ####
0xFF, 0xFC, // ##############
0xFF, 0xFC, // ##############
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2900 '[' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x0F, 0xE0, // #######
0x0F, 0xE0, // #######
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0F, 0xE0, // #######
0x0F, 0xE0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @2950 '\' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xC0, 0x00, // ##
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xF8, 0x00, // #####
0xF8, 0x00, // #####
0x3E, 0x00, // #####
0x3F, 0x80, // #######
0x1F, 0x80, // ######
0x07, 0xC0, // #####
0x07, 0xC0, // #####
0x01, 0xF0, // #####
0x01, 0xF0, // #####
0x00, 0x70, // ###
0x00, 0x30, // ##
0x00, 0x30, // ##
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3000 ']' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3050 '^' (14 pixels wide)
0x06, 0x00, // ##
0x06, 0x00, // ##
0x1F, 0x80, // ######
0x39, 0xC0, // ### ###
0xA9, 0x60, // # # # # ##
0xE0, 0x70, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3100 '_' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xFC, // ##############
0xFF, 0xFC, // ##############
0x00, 0x00, //
// @3150 '`' (14 pixels wide)
0x00, 0x00, //
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3200 'a' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x01, 0xC0, // ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3250 'b' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xF8, 0x00, // #####
0xF8, 0x00, // #####
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x39, 0xC0, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3300 'c' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3350 'd' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0xC0, // #####
0x07, 0xC0, // #####
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x39, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3400 'e' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0x00, // ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3450 'f' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0xC0, // #####
0x07, 0xC0, // #####
0x0E, 0x70, // ### ###
0x0E, 0x30, // ### ##
0x0E, 0x30, // ### ##
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3500 'g' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x01, 0xC0, // ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
// @3550 'h' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xF8, 0x00, // #####
0xF8, 0x00, // #####
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0xF8, 0x70, // ##### ###
0xF8, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3600 'i' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0x00, // #####
0x1F, 0x00, // #####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3650 'j' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x00, //
0x00, 0x00, //
0x01, 0xF0, // #####
0x01, 0xF0, // #####
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x00, 0x70, // ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x0F, 0xC0, // ######
0x0F, 0xC0, // ######
// @3700 'k' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xF8, 0x00, // #####
0xF8, 0x00, // #####
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x39, 0xC0, // ### ###
0x3F, 0xC0, // ########
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x39, 0xC0, // ### ###
0x39, 0xC0, // ### ###
0x38, 0x70, // ### ###
0xF8, 0x70, // ##### ###
0xF8, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3750 'l' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x1F, 0x00, // #####
0x1F, 0x00, // #####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3800 'm' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xF8, 0xE0, // ##### ###
0xF8, 0xE0, // ##### ###
0xFF, 0xF8, // #############
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3850 'n' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE7, 0xC0, // ### #####
0xE7, 0xC0, // ### #####
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3900 'o' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0xE0, 0xE0, // ### ###
0x3F, 0x80, // #######
0x3F, 0x80, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @3950 'p' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE7, 0xC0, // ### #####
0xE7, 0xC0, // ### #####
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xFE, 0x00, // #######
0xFE, 0x00, // #######
// @4000 'q' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x01, 0xC0, // ###
0x07, 0xF0, // #######
0x07, 0xF0, // #######
// @4050 'r' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE7, 0xC0, // ### #####
0xE7, 0xC0, // ### #####
0x3E, 0x70, // ##### ###
0x38, 0x70, // ### ###
0x38, 0x70, // ### ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xFE, 0x00, // #######
0xFE, 0x00, // #######
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4100 's' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x38, 0x00, // ###
0x1F, 0x80, // ######
0x1F, 0x80, // ######
0x01, 0xC0, // ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xC0, // ########
0x3F, 0xC0, // ########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4150 't' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x06, 0x00, // ##
0x06, 0x00, // ##
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x7F, 0xC0, // #########
0x7F, 0xC0, // #########
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x00, // ###
0x0E, 0x70, // ### ###
0x0E, 0x70, // ### ###
0x07, 0xC0, // #####
0x07, 0xC0, // #####
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4200 'u' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0xE1, 0xC0, // ### ###
0x3E, 0x70, // ##### ###
0x3E, 0x70, // ##### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4250 'v' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0xE0, 0x3C, // ### ####
0x38, 0xF0, // ### ####
0x38, 0xF0, // ### ####
0x1F, 0xC0, // #######
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4300 'w' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xE7, 0x38, // ### ### ###
0xFF, 0xF8, // #############
0x38, 0xE0, // ### ###
0x38, 0xE0, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4350 'x' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x38, 0x70, // ### ###
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x1F, 0xC0, // #######
0x38, 0x70, // ### ###
0xE0, 0x38, // ### ###
0xE0, 0x38, // ### ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4400 'y' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0xE0, 0x70, // ### ###
0x3F, 0xF0, // ##########
0x3F, 0xF0, // ##########
0x00, 0x70, // ###
0x00, 0x70, // ###
0x01, 0xC0, // ###
0xFF, 0x80, // #########
0xFF, 0x80, // #########
// @4450 'z' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0xE3, 0x80, // ### ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x1C, 0x00, // ###
0x1C, 0x00, // ###
0x38, 0x00, // ###
0x38, 0x00, // ###
0xE0, 0xE0, // ### ###
0xFF, 0xE0, // ###########
0xFF, 0xE0, // ###########
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4500 '{' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x01, 0xF0, // #####
0x01, 0xF0, // #####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x3E, 0x00, // #####
0x3E, 0x00, // #####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xF0, // #####
0x01, 0xF0, // #####
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4550 '|' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4600 '}' (14 pixels wide)
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x3E, 0x00, // #####
0x3E, 0x00, // #####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x01, 0xE0, // ####
0x01, 0xE0, // ####
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x07, 0x00, // ###
0x3E, 0x00, // #####
0x3E, 0x00, // #####
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
// @4650 '~' (14 pixels wide)
0x00, 0x00, //
0x3C, 0xE0, // #### ###
0x3C, 0xE0, // #### ###
0xE7, 0x80, // ### ####
0xE7, 0x80, // ### ####
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
0x00, 0x00, //
};
| 73,468
|
C++
|
.h
| 2,448
| 20.606618
| 36
| 0.287581
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,562
|
coreinit_Time.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Time.h
|
#pragma once
#include "Cafe/HW/Espresso/Const.h"
namespace coreinit
{
typedef struct
{
/* +0x00 */ sint32be second; // 0-59
/* +0x04 */ sint32be minute; // 0-59
/* +0x08 */ sint32be hour; // 0-23
/* +0x0C */ sint32be dayOfMonth; // 1-31
/* +0x10 */ sint32be month; // 0-11
/* +0x14 */ sint32be year; // 2000-...
/* +0x18 */ sint32be dayOfWeek; // 0-6
/* +0x1C */ sint32be dayOfYear; // 0-365
/* +0x20 */ sint32be millisecond; // 0-999
/* +0x24 */ sint32be microsecond; // 0-999
}OSCalendarTime_t;
static_assert(sizeof(OSCalendarTime_t) == 0x28);
namespace EspressoTime
{
typedef sint64 TimerTicks;
constexpr sint64 GetCoreClock()
{
return Espresso::CORE_CLOCK;
}
constexpr sint64 GetBusClock()
{
return Espresso::BUS_CLOCK;
}
constexpr sint64 GetTimerClock()
{
return Espresso::TIMER_CLOCK;
}
inline TimerTicks ConvertNsToTimerTicks(uint64 ns)
{
return ((GetTimerClock() / 31250LL) * ((TimerTicks)ns) / 32000LL);
}
inline TimerTicks ConvertMsToTimerTicks(uint64 ms)
{
return (TimerTicks)ms * GetTimerClock() / 1000LL;
}
};
void OSTicksToCalendarTime(uint64 ticks, OSCalendarTime_t* calenderStruct);
uint64 OSGetTime();
uint64 coreinit_getOSTime();
uint64 coreinit_getTimerTick();
static uint64 OSGetSystemTime()
{
return coreinit_getTimerTick();
}
void InitializeTimeAndCalendar();
};
| 1,401
|
C++
|
.h
| 52
| 24.096154
| 76
| 0.691099
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,563
|
coreinit_MEM_BlockHeap.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_MEM.h"
namespace coreinit
{
struct MEMBlockHeapTrack2_t
{
/* +0x00 */ MEMPTR<void> addrStart;
/* +0x04 */ MEMPTR<void> addrEnd;
/* +0x08 */ uint32be isFree; // if 0 -> block is used
/* +0x0C */ MEMPTR<void> previousBlock;
/* +0x10 */ MEMPTR<void> nextBlock;
};
static_assert(sizeof(MEMBlockHeapTrack2_t) == 0x14);
struct MEMBlockHeap2_t : MEMHeapBase
{
/* +0x34 */ uint8 ukn[0x50 - 0x34];
/* +0x50 */ MEMBlockHeapTrack2_t track;
/* +0x64 */ MEMPTR<void> headBlock;
/* +0x68 */ MEMPTR<void> tailBlock;
/* +0x6C */ MEMPTR<void> nextFreeBlock;
/* +0x70 */ uint32be freeBlocksLeft;
/* +0x74 */ uint8 padding[0x80 - 0x74];
};
static_assert(sizeof(MEMBlockHeap2_t) == 0x80);
MEMHeapHandle MEMInitBlockHeap(MEMBlockHeap2_t* memStart, void* startAddr, void* endAddr, void* initTrackMem, uint32 initTrackMemSize, uint32 createFlags);
void* MEMDestroyBlockHeap(MEMHeapHandle hHeap);
sint32 MEMAddBlockHeapTracking(MPTR heap, MPTR trackMem, uint32 trackMemSize);
void InitializeMEMBlockHeap();
}
| 1,080
|
C++
|
.h
| 29
| 34.827586
| 156
| 0.724665
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,564
|
coreinit_IPCBuf.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_IPCBuf.h
|
#pragma once
namespace coreinit
{
struct FIFOEntry_t
{
MEMPTR<uint8> p;
};
struct IPCFifo_t
{
uint32be writeIndex;
uint32be readIndex;
uint32be availableEntries; // number of available entries
uint32be entryCount;
MEMPTR<FIFOEntry_t> entryArray;
};
struct IPCBufPool_t
{
/* +0x00 */ uint32be magic;
/* +0x04 */ MEMPTR<void> fullBufferPtr;
/* +0x08 */ uint32be fullBufferSize;
/* +0x0C */ uint32be uknFromParamR7; // boolean?
/* +0x10 */ uint32be ukn10; // set to zero on init
/* +0x14 */ uint32be entrySize1;
/* +0x18 */ uint32be entrySize2; // set to same value as entrySize1
/* +0x1C */ uint32be entryCount; // actual number of used entries
/* +0x20 */ MEMPTR<uint8> entryStartPtr;
/* +0x24 */ uint32be entryCountMul4;
/* +0x28 */ IPCFifo_t fifo;
/* +0x3C */ coreinit::OSMutex mutex;
/* +0x68 */ uint32 ukn68;
// full size is 0x6C
};
static_assert(sizeof(IPCBufPool_t) == 0x6C);
uint8* IPCBufPoolAllocate(IPCBufPool_t* ipcBufPool, uint32 size);
IPCBufPool_t* IPCBufPoolCreate(uint8* bufferArea, uint32 bufferSize, uint32 entrySize, uint32be* entryCountOutput, uint32 uknR7);
sint32 IPCBufPoolFree(IPCBufPool_t* ipcBufPool, uint8* entry);
void InitializeIPCBuf();
} // namespace coreinit
| 1,254
|
C++
|
.h
| 38
| 30.421053
| 130
| 0.719835
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,565
|
coreinit_MEM.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Spinlock.h"
struct MEMLink_t
{
MPTR prevObject;
MPTR nextObject;
};
static_assert(sizeof(MEMLink_t) == 8);
struct MEMList_t
{
MPTR headObject;
MPTR tailObject;
uint16 numObjects;
uint16 offset;
};
static_assert(sizeof(MEMList_t) == 0xC);
struct MEMAllocatorFunc
{
MEMPTR<void> funcAlloc;
MEMPTR<void> funcFree;
};
static_assert(sizeof(MEMAllocatorFunc) == 8);
struct MEMAllocator
{
/* +0x000 */ MEMPTR<MEMAllocatorFunc> func;
/* +0x004 */ MEMPTR<void> heap;
/* +0x00C */ uint32be param1;
/* +0x010 */ uint32be param2;
};
static_assert(sizeof(MEMAllocator) == 0x10);
MPTR coreinit_allocFromSysArea(uint32 size, uint32 alignment);
void coreinit_freeToSysArea(MPTR mem);
// mem exports
void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU);
void coreinitExport_MEMGetBaseHeapHandle(PPCInterpreter_t* hCPU);
/* legacy stuff above */
namespace coreinit
{
#define MEM_HEAP_INVALID_HANDLE (nullptr)
#define MEM_HEAP_DEFAULT_ALIGNMENT 4
#define MIN_ALIGNMENT 4
#define MIN_ALIGNMENT_MINUS_ONE (MIN_ALIGNMENT-1)
#define MEM_HEAP_OPTION_NONE (0)
#define MEM_HEAP_OPTION_CLEAR (1 << 0)
#define MEM_HEAP_OPTION_FILL (1 << 1)
#define MEM_HEAP_OPTION_THREADSAFE (1 << 2)
enum class MEMHeapMagic : uint32
{
UNIT_HEAP = 'UNTH',
BLOCK_HEAP = 'BLKH',
FRAME_HEAP = 'FRMH',
EXP_HEAP = 'EXPH',
USER_HEAP = 'USRH',
};
struct MEMLink
{
MEMPTR<void> prev;
MEMPTR<void> next;
};
static_assert(sizeof(MEMLink) == 0x8);
struct MEMList
{
/* 0x00 */ MEMPTR<void> head;
/* 0x04 */ MEMPTR<void> tail;
/* 0x08 */ uint16be numObjects;
/* 0x0A */ uint16be offset;
};
static_assert(sizeof(MEMList) == 0xC);
void MEMInitList(MEMList* list, uint32 offset);
void MEMAppendListObject(MEMList* list, void* object);
void MEMRemoveListObject(MEMList* list, void* object);
void* MEMGetFirstListObject(MEMList* list);
void* MEMGetNextListObject(MEMList* list, void* object);
struct MEMHeapBase
{
/* +0x00 */ betype<MEMHeapMagic> magic;
/* +0x04 */ MEMLink link;
/* +0x0C */ MEMList childList;
/* +0x18 */ MEMPTR<void> heapStart;
/* +0x1C */ MEMPTR<void> heapEnd; // heap end + 1
/* +0x20 */ OSSpinLock spinlock;
/* +0x30 */ uint8 _ukn[3];
/* +0x33 */ uint8 flags;
void AcquireLock()
{
if (flags & MEM_HEAP_OPTION_THREADSAFE)
OSUninterruptibleSpinLock_Acquire(&spinlock);
}
void ReleaseLock()
{
if (flags & MEM_HEAP_OPTION_THREADSAFE)
OSUninterruptibleSpinLock_Release(&spinlock);
}
// if set, memset allocations to zero
bool HasOptionClear() const
{
return (flags & MEM_HEAP_OPTION_CLEAR) != 0;
}
// if set, memset allocations/releases to specific fill values
bool HasOptionFill() const
{
return (flags & MEM_HEAP_OPTION_FILL) != 0;
}
};
static_assert(offsetof(MEMHeapBase, childList) == 0xC);
static_assert(offsetof(MEMHeapBase, spinlock) == 0x20);
static_assert(offsetof(MEMHeapBase, flags) == 0x33);
static_assert(sizeof(MEMHeapBase) == 0x34); // heap base is actually 0x40 but bytes 0x34 to 0x40 are padding?
typedef MEMHeapBase* MEMHeapHandle;
/* Heap base */
void MEMInitHeapBase(MEMHeapBase* heap, MEMHeapMagic magic, void* heapStart, void* heapEnd, uint32 createFlags);
void MEMBaseDestroyHeap(MEMHeapBase* heap);
MEMHeapBase* MEMGetBaseHeapHandle(uint32 index);
MEMHeapBase* MEMSetBaseHeapHandle(uint32 index, MEMHeapBase* heapBase);
/* Heap list */
bool MEMHeapTable_Add(MEMHeapBase* heap);
bool MEMHeapTable_Remove(MEMHeapBase* heap);
MEMHeapBase* _MEMList_FindContainingHeap(MEMList* list, MEMHeapBase* heap);
bool MEMList_ContainsHeap(MEMList* list, MEMHeapBase* heap);
MEMList* MEMList_FindContainingHeap(MEMHeapBase* head);
/* Heap settings */
enum class HEAP_FILL_TYPE : uint32
{
ON_HEAP_CREATE = 0,
ON_ALLOC = 1,
ON_FREE = 2,
};
uint32 MEMGetFillValForHeap(HEAP_FILL_TYPE type);
uint32 MEMSetFillValForHeap(HEAP_FILL_TYPE type, uint32 value);
MEMHeapHandle MEMFindContainHeap(const void* memBlock);
/* Heap default allocators */
void InitDefaultHeaps(MEMPTR<MEMHeapBase>& mem1Heap, MEMPTR<MEMHeapBase>& memFGHeap, MEMPTR<MEMHeapBase>& mem2Heap);
void* default_MEMAllocFromDefaultHeap(uint32 size);
void* default_MEMAllocFromDefaultHeapEx(uint32 size, sint32 alignment);
void default_MEMFreeToDefaultHeap(void* mem);
void* _weak_MEMAllocFromDefaultHeapEx(uint32 size, sint32 alignment);
void* _weak_MEMAllocFromDefaultHeap(uint32 size);
void _weak_MEMFreeToDefaultHeap(void* ptr);
/* Unit heap */
void InitializeMEMUnitHeap();
void InitializeMEM();
}
| 4,600
|
C++
|
.h
| 142
| 29.992958
| 117
| 0.750962
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,566
|
coreinit_Alarm.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Alarm.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
namespace coreinit
{
class OSHostAlarm;
OSHostAlarm* OSHostAlarmCreate(uint64 nextFire, uint64 period, void(*callbackFunc)(uint64 currentTick, void* context), void* context);
void OSHostAlarmDestroy(OSHostAlarm* hostAlarm);
struct OSAlarm_t
{
/* +0x00 */ betype<uint32> magic;
/* +0x04 */ MEMPTR<const char> name;
/* +0x08 */ uint32 ukn08;
/* +0x0C */ MPTR handler;
/* +0x10 */ uint32 ukn10;
/* +0x14 */ uint32 padding14;
/* +0x18 */ uint64 nextTime; // next fire time
/* +0x20 */ MPTR prev; // pointer to OSAlarm
/* +0x24 */ MPTR next; // pointer to OSAlarm
/* +0x28 */ uint64 period; // period (zero for non-periodic timer)
/* +0x30 */ uint64 startTime; // period start
/* +0x38 */ uint32be userData;
/* +0x3C */ uint32 ukn3C;
/* +0x40 */ OSThreadQueue uknThreadQueue;
/* +0x50 */ MPTR alarmQueue;
/* +0x54 */ MPTR ukn54;
void setMagic()
{
magic = (uint32)'aLrM';
}
bool checkMagic()
{
return magic == (uint32)'aLrM';
}
};
static_assert(sizeof(OSAlarm_t) == 0x58);
void OSCreateAlarm(OSAlarm_t* alarm);
bool OSCancelAlarm(OSAlarm_t* alarm);
void OSSetAlarm(OSAlarm_t* alarm, uint64 time, MPTR handlerFunc);
void OSSetAlarmUserData(OSAlarm_t* alarm, uint32 userData);
void OSSetPeriodicAlarm(OSAlarm_t* OSAlarm, uint64 startTick, uint64 periodTick, MPTR OSAlarmHandler);
void OSAlarm_Shutdown();
void alarm_update();
void InitializeAlarm();
}
| 1,551
|
C++
|
.h
| 44
| 32.590909
| 135
| 0.671114
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,567
|
coreinit_Coroutine.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Coroutine.h
|
#pragma once
namespace coreinit
{
struct OSCoroutine
{
/* +0x00 */ uint32 lr;
/* +0x04 */ uint32 cr;
/* +0x08 */ uint32 gqr1;
/* +0x0C */ uint32 r1; // stack pointer
/* +0x10 */ uint32 r2;
/* +0x14 */ uint32 r13;
/* +0x18 */ uint32 gpr[18];
uint64 fpr[18];
uint64 psr[18];
};
static_assert(sizeof(OSCoroutine) == 0x180);
void InitializeCoroutine();
}
| 378
|
C++
|
.h
| 18
| 18.555556
| 45
| 0.630252
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,568
|
coreinit_MPQueue.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MPQueue.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit.h"
#include "Cafe/OS/libs/coreinit/coreinit_Spinlock.h"
namespace coreinit
{
enum MPTaskState
{
MP_TASK_STATE_INIT = (1 << 0),
MP_TASK_STATE_READY = (1 << 1),
MP_TASK_STATE_RUN = (1 << 2),
MP_TASK_STATE_DONE = (1 << 3)
};
enum MPTaskQState
{
MP_TASKQ_STATE_INIT = (1 << 0),
MP_TASKQ_STATE_RUN = (1 << 1),
MP_TASKQ_STATE_STOPPING = (1 << 2),
MP_TASKQ_STATE_STOP = (1 << 3),
MP_TASKQ_STATE_DONE = (1 << 4)
};
struct MPTaskFunction
{
/* +0x00 */ MEMPTR<void> func;
/* +0x04 */ MEMPTR<void> data;
/* +0x08 */ uint32be size;
/* +0x0C */ uint32be result;
};
static_assert(sizeof(MPTaskFunction) == 0x10);
#pragma pack(1)
struct MPTask
{
/* +0x00 */ MEMPTR<void> thisptr;
/* +0x04 */ MEMPTR<struct MPTaskQ> taskQ;
/* +0x08 */ uint32be taskState;
/* +0x0C */ MPTaskFunction taskFunc;
/* +0x1C */ uint32be coreIndex;
/* +0x20 */ sint64be runtime;
/* +0x28 */ MEMPTR<void> userdata;
};
static_assert(sizeof(MPTask) == 0x2C);
#pragma pack()
struct MPTaskQ
{
/* +0x00 */ MEMPTR<void> thisptr;
/* +0x04 */ uint32be state;
/* +0x08 */ uint32be taskCount;
/* +0x0C */ uint32be taskReadyCount;
/* +0x10 */ uint32be taskRunCount;
/* +0x14 */ uint32be taskDoneCount[PPC_CORE_COUNT];
/* +0x20 */ sint32be nextIndex[PPC_CORE_COUNT];
/* +0x2C */ sint32be endIndex[PPC_CORE_COUNT];
/* +0x38 */ MEMPTR<MEMPTR<MPTask>> taskQueue;
/* +0x3C */ uint32be taskQueueSize;
/* +0x40 */ OSSpinLock spinlock;
};
static_assert(sizeof(MPTaskQ) == 0x50);
struct MPTaskQInfo
{
/* +0x00 */ uint32be state;
/* +0x04 */ uint32be taskCount;
/* +0x08 */ uint32be taskReadyCount;
/* +0x0C */ uint32be taskRunCount;
/* +0x10 */ uint32be taskDoneCount;
};
static_assert(sizeof(MPTaskQInfo) == 0x14);
struct MPTaskInfo
{
/* +0x00 */ uint32be state;
/* +0x04 */ uint32be funcResult;
/* +0x08 */ uint32be coreIndex;
/* +0x0C */ sint64be runtime;
};
static_assert(sizeof(MPTaskQInfo) == 0x14);
void MPInitTask(MPTask* task, void* func, void* data, uint32 size);
bool MPTermTask(MPTask* task);
bool MPRunTask(MPTask* task);
bool MPGetTaskInfo(MPTask* task, MPTaskInfo* info);
void* MPGetTaskUserData(MPTask* task);
void MPSetTaskUserData(MPTask* task, void* userdata);
void MPInitTaskQ(MPTaskQ* taskq, MPTask** tasks, uint32 taskCount);
bool MPEnqueTask(MPTaskQ* taskq, MPTask* task);
bool MPTermTaskQ(MPTaskQ* taskq);
bool MPGetTaskQInfo(MPTaskQ* taskq, MPTaskQInfo* info);
bool MPStartTaskQ(MPTaskQ* taskq);
bool MPRunTasksFromTaskQ(MPTaskQ* taskq, int granularity);
bool MPStopTaskQ(MPTaskQ* taskq);
bool MPWaitTaskQ(MPTaskQ* taskq, uint32 waitState);
bool MPWaitTaskQWithTimeout(MPTaskQ* taskq, uint32 waitState, sint64 timeout);
MPTask* MPDequeTask(MPTaskQ* taskq);
uint32 MPDequeTasks(MPTaskQ* taskq, MPTask** tasks, sint32 maxTasks);
bool MPResetTaskQ(MPTaskQ* taskq);
void InitializeMP();
}
| 2,943
|
C++
|
.h
| 93
| 29.129032
| 79
| 0.697248
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,569
|
coreinit_MEM_ExpHeap.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Spinlock.h"
#include "Cafe/OS/libs/coreinit/coreinit_MEM.h"
namespace coreinit
{
void expheap_load();
#define MEM_EXPHEAP_ALLOC_MODE_FIRST (0)
#define MEM_EXPHEAP_ALLOC_MODE_NEAR (1)
#define MEM_EXPHEAP_USE_ALIGN_MARGIN (2)
enum class MEMExpHeapAllocDirection : uint32
{
HEAD = 0,
TAIL = 1
};
struct MBlockChain2_t
{
MEMPTR<struct MBlock2_t> headMBlock; // 0x00
MEMPTR<struct MBlock2_t> tailMBlock; // 0x04
};
static_assert(sizeof(MBlockChain2_t) == 8);
struct MEMExpHeapHead40_t
{
/* +0x00 */ MBlockChain2_t chainFreeBlocks; // 0x00
/* +0x08 */ MBlockChain2_t chainUsedBlocks; // 0x08
/* +0x10 */ uint16 groupID;
/* +0x12 */ uint16 fields; // Bit 0 -> Alloc mode, Bit 1 -> Allocate within alignment (create free blocks inside alignment padding)
};
static_assert(sizeof(MEMExpHeapHead40_t) == 0x14);
struct MEMExpHeapHead2 : MEMHeapBase
{
// Base
/* +0x34 */ uint32be ukn34;
/* +0x38 */ uint32be ukn38;
/* +0x3C */ uint32be ukn3C;
/* +0x40 */ MEMExpHeapHead40_t expHeapHead;
};
static_assert(sizeof(MEMExpHeapHead2) == 0x54);
MEMHeapHandle MEMCreateExpHeapEx(void* startAddress, uint32 size, uint32 createFlags);
void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, uint32 size, sint32 alignment);
void MEMFreeToExpHeap(MEMHeapHandle heap, void* mem);
uint32 MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, sint32 alignment);
}
| 1,440
|
C++
|
.h
| 42
| 31.952381
| 133
| 0.747839
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,570
|
coreinit_Thread.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Thread.h
|
#pragma once
#include "Cafe/HW/Espresso/Const.h"
#include "Cafe/OS/libs/coreinit/coreinit_Scheduler.h"
struct OSThread_t;
struct OSContextRegFPSCR_t
{
// FPSCR is a 32bit register but it's stored as a 64bit double
/* +0x00 */ uint32be padding;
/* +0x04 */ uint32be fpscr;
};
struct OSContext_t
{
static constexpr uint32 OS_CONTEXT_MAGIC_0 = 0x4f53436f; // "OSCo"
static constexpr uint32 OS_CONTEXT_MAGIC_1 = 0x6e747874; // "ntxt"
/* +0x000 */ betype<uint32> magic0;
/* +0x004 */ betype<uint32> magic1;
/* +0x008 */ uint32 gpr[32];
/* +0x088 */ uint32 cr;
/* +0x08C */ uint32 lr;
/* +0x090 */ uint32 ctr;
/* +0x094 */ uint32 xer;
/* +0x098 */ uint32 srr0;
/* +0x09C */ uint32 srr1;
/* +0x0A0 */ uint32 dsi_dsisr;
/* +0x0A4 */ uint32 dsi_dar;
/* +0x0A8 */ uint32 ukn0A8;
/* +0x0AC */ uint32 ukn0AC;
/* +0x0B0 */ OSContextRegFPSCR_t fpscr;
/* +0x0B8 */ uint64be fp_ps0[32];
/* +0x1B8 */ uint16be boostCount;
/* +0x1BA */ uint16 state; // OS_CONTEXT_STATE_*
/* +0x1BC */ uint32 gqr[8]; // GQR/UGQR
/* +0x1DC */ uint32be upir; // set to current core index
/* +0x1E0 */ uint64be fp_ps1[32];
/* +0x2E0 */ uint64be coretime[3];
/* +0x2F8 */ uint64be starttime;
/* +0x300 */ uint32be ghs_errno; // returned by __gh_errno_ptr() (used by socketlasterr)
/* +0x304 */ uint32be affinity;
/* +0x308 */ uint32be upmc1;
/* +0x30C */ uint32be upmc2;
/* +0x310 */ uint32be upmc3;
/* +0x314 */ uint32be upmc4;
/* +0x318 */ uint32be ummcr0;
/* +0x31C */ uint32be ummcr1;
bool checkMagic()
{
return magic0 == (uint32)OS_CONTEXT_MAGIC_0 && magic1 == (uint32)OS_CONTEXT_MAGIC_1;
}
void SetContextMagic()
{
magic0 = OS_CONTEXT_MAGIC_0;
magic1 = OS_CONTEXT_MAGIC_1;
}
bool hasCoreAffinitySet(uint32 coreIndex) const
{
return (((uint32)affinity >> coreIndex) & 1) != 0;
}
void setAffinity(uint32 mask)
{
affinity = mask & 7;
}
uint32 getAffinity() const
{
return affinity;
}
};
static_assert(sizeof(OSContext_t) == 0x320);
typedef struct
{
/* +0x000 | +0x3A0 */ uint32 ukn000[0x68 / 4];
/* +0x068 | +0x408 */ MEMPTR<void> eh_globals;
/* +0x06C | +0x40C */ uint32 eh_mem_manage[9]; // struct
/* +0x090 | +0x430 */ MPTR eh_store_globals[6];
/* +0x0A8 | +0x448 */ MPTR eh_store_globals_tdeh[76];
}crt_t; // size: 0x1D8
static_assert(sizeof(crt_t) == 0x1D8, "");
#pragma pack(1)
namespace coreinit
{
/********* OSThreadQueue *********/
struct OSThreadLink
{
MEMPTR<struct OSThread_t> next;
MEMPTR<struct OSThread_t> prev;
};
static_assert(sizeof(OSThreadLink) == 8);
struct OSThreadQueueInternal
{
MEMPTR<OSThread_t> head;
MEMPTR<OSThread_t> tail;
bool isEmpty() const
{
cemu_assert_debug((!head.IsNull() == !tail.IsNull()) || (head.IsNull() == tail.IsNull()));
return head.IsNull();
}
void addThread(OSThread_t* thread, OSThreadLink* threadLink);
void addThreadByPriority(OSThread_t* thread, OSThreadLink* threadLink);
void removeThread(OSThread_t* thread, OSThreadLink* threadLink);
// puts the thread on the waiting queue and changes state to WAITING
// relinquishes timeslice
// always uses thread->waitQueueLink
void queueAndWait(OSThread_t* thread);
void queueOnly(OSThread_t* thread);
// counterparts for queueAndWait
void cancelWait(OSThread_t* thread);
void wakeupEntireWaitQueue(bool reschedule, bool sharedPriorityAndAffinityWorkaround = false);
void wakeupSingleThreadWaitQueue(bool reschedule, bool sharedPriorityAndAffinityWorkaround = false);
private:
OSThread_t* takeFirstFromQueue(size_t linkOffset)
{
cemu_assert_debug(__OSHasSchedulerLock());
if (head == nullptr)
return nullptr;
OSThread_t* thread = head.GetPtr();
OSThreadLink* link = _getThreadLink(thread, linkOffset);
removeThread(thread, link);
return thread;
}
static size_t getLinkOffset(OSThread_t* thread, OSThreadLink* threadLink)
{
cemu_assert_debug((void*)threadLink >= (void*)thread && (void*)threadLink < (void*)((uint8*)thread + 0x680));
return (uint8*)threadLink - (uint8*)thread;
}
static OSThreadLink* _getThreadLink(OSThread_t* thread, size_t linkOffset)
{
return (OSThreadLink*)((uint8*)thread + linkOffset);
}
void _debugCheckChain(OSThread_t* thread, OSThreadLink* threadLink)
{
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug(tail.IsNull() == head.IsNull());
size_t linkOffset = getLinkOffset(thread, threadLink);
// expects thread to be in the chain
OSThread_t* threadItr = head.GetPtr();
while (threadItr)
{
if (threadItr == thread)
return;
threadItr = _getThreadLink(threadItr, linkOffset)->next.GetPtr();
}
cemu_assert_debug(false); // thread not in list!
#endif
}
};
static_assert(sizeof(OSThreadQueueInternal) == 0x8);
struct OSThreadQueueSmall : public OSThreadQueueInternal
{
// no extra members
};
static_assert(sizeof(OSThreadQueueSmall) == 8);
static_assert(offsetof(OSThreadQueueSmall, head) == 0x0);
static_assert(offsetof(OSThreadQueueSmall, tail) == 0x4);
struct OSThreadQueue : public OSThreadQueueInternal
{
MEMPTR<void> userData;
uint32be ukn0C;
};
static_assert(sizeof(OSThreadQueue) == 0x10);
static_assert(offsetof(OSThreadQueue, head) == 0x0);
static_assert(offsetof(OSThreadQueue, tail) == 0x4);
static_assert(offsetof(OSThreadQueue, userData) == 0x8);
static_assert(offsetof(OSThreadQueue, ukn0C) == 0xC);
/********* OSMutex *********/
struct OSMutex
{
/* +0x00 */ uint32 magic;
/* +0x04 */ MEMPTR<void> userData;
/* +0x08 */ uint32be ukn08;
/* +0x0C */ OSThreadQueue threadQueue;
/* +0x1C */ MEMPTR<OSThread_t> owner;
/* +0x20 */ sint32be lockCount;
/* +0x24 */ MEMPTR<OSMutex> next;
/* +0x28 */ MEMPTR<OSMutex> prev;
}; // size: 0x2C
static_assert(sizeof(OSMutex) == 0x2C);
struct OSMutexQueue
{
MEMPTR<OSMutex> head;
MEMPTR<OSMutex> tail;
MEMPTR<void> ukn08;
uint32be ukn0C;
bool isEmpty() const
{
cemu_assert_debug((!head.IsNull() == !tail.IsNull()) || (head.IsNull() == tail.IsNull()));
return head.IsNull();
}
void addMutex(OSMutex* mutex)
{
cemu_assert_debug(__OSHasSchedulerLock());
// insert at end
if (tail.IsNull())
{
mutex->next = nullptr;
mutex->prev = nullptr;
head = mutex;
tail = mutex;
}
else
{
tail->next = mutex;
mutex->prev = tail;
mutex->next = nullptr;
tail = mutex;
}
}
void removeMutex(OSMutex* mutex)
{
cemu_assert_debug(__OSHasSchedulerLock());
cemu_assert_debug(!head.IsNull() && !tail.IsNull());
if (mutex->prev)
mutex->prev->next = mutex->next;
else
head = mutex->next;
if (mutex->next)
mutex->next->prev = mutex->prev;
else
tail = mutex->prev;
mutex->next = nullptr;
mutex->prev = nullptr;
}
OSMutex* getFirst()
{
return head.GetPtr();
}
};
static_assert(sizeof(OSMutexQueue) == 0x10);
/********* OSFastMutex *********/
struct OSFastMutexLink
{
/* +0x00 */ MEMPTR<struct OSMutex> next;
/* +0x04 */ MEMPTR<struct OSMutex> prev;
};
struct OSFastMutex
{
/* +0x00 */ uint32be magic;
/* +0x04 */ MEMPTR<void> userData;
/* +0x08 */ uint32be contendedState; // tracks current contention state
/* +0x0C */ OSThreadQueueSmall threadQueueSmall;
/* +0x14 */ OSFastMutexLink ownedLink; // part of thread->fastMutexOwnedQueue
/* +0x1C */ MEMPTR<OSThread_t> owner;
/* +0x20 */ uint32be lockCount;
/* +0x24 */ OSFastMutexLink contendedLink;
};
static_assert(sizeof(OSFastMutex) == 0x2C);
/********* OSEvent *********/
struct OSEvent
{
enum class EVENT_MODE : uint32
{
MODE_MANUAL = 0,
MODE_AUTO = 1,
};
enum class EVENT_STATE : uint32
{
STATE_NOT_SIGNALED = 0,
STATE_SIGNALED = 1
};
/* +0x00 */ uint32be magic; // 'eVnT'
/* +0x04 */ MEMPTR<void> userData;
/* +0x08 */ uint32be ukn08;
/* +0x0C */ betype<EVENT_STATE> state; // 0 -> not signaled, 1 -> signaled
/* +0x10 */ OSThreadQueue threadQueue;
/* +0x20 */ betype<EVENT_MODE> mode;
};
static_assert(sizeof(OSEvent) == 0x24);
/********* OSRendezvous *********/
struct OSRendezvous
{
/* +0x00 */ uint32be coreHit[3];
/* +0x0C */ MEMPTR<void> userData;
};
static_assert(sizeof(OSRendezvous) == 0x10);
/********* OSCond *********/
struct OSCond
{
uint32be magic;
MEMPTR<void> userData;
uint32be ukn08;
OSThreadQueue threadQueue;
};
static_assert(sizeof(OSCond) == 0x1C);
/********* OSSemaphore *********/
struct OSSemaphore
{
uint32be magic;
MEMPTR<void> userData;
uint32be ukn08;
sint32be count;
OSThreadQueue threadQueue;
};
static_assert(sizeof(OSSemaphore) == 0x20);
/********* OSFastCond *********/
struct OSFastCond
{
uint32be magic;
MEMPTR<void> userData;
uint32be ukn08;
OSThreadQueue threadQueue;
};
static_assert(sizeof(OSFastCond) == 0x1C);
};
struct OSThread_t
{
static constexpr uint32 MAGIC_THREAD = 0x74487244; // "tHrD"
enum class THREAD_TYPE : uint32
{
TYPE_DRIVER = 0,
TYPE_IO = 1,
TYPE_APP = 2
};
enum class THREAD_STATE : uint8
{
STATE_NONE = 0,
STATE_READY = 1,
STATE_RUNNING = 2,
STATE_WAITING = 4,
STATE_MORIBUND = 8,
};
enum ATTR_BIT : uint32
{
ATTR_AFFINITY_CORE0 = 0x1,
ATTR_AFFINITY_CORE1 = 0x2,
ATTR_AFFINITY_CORE2 = 0x4,
ATTR_DETACHED = 0x8,
ATTR_UKN_010 = 0x10,
};
enum REQUEST_FLAG_BIT : uint32
{
REQUEST_FLAG_NONE = 0,
REQUEST_FLAG_SUSPEND = 1,
REQUEST_FLAG_CANCEL = 2,
};
static sint32 GetTypePriorityBase(THREAD_TYPE threadType)
{
if (threadType == OSThread_t::THREAD_TYPE::TYPE_DRIVER)
return 0;
else if (threadType == OSThread_t::THREAD_TYPE::TYPE_IO)
return 32;
else if (threadType == OSThread_t::THREAD_TYPE::TYPE_APP)
return 64;
return 0;
}
void SetThreadMagic()
{
magic = MAGIC_THREAD;
}
bool IsValidMagic() const
{
return magic == MAGIC_THREAD && context.magic0 == OSContext_t::OS_CONTEXT_MAGIC_0 && context.magic1 == OSContext_t::OS_CONTEXT_MAGIC_1;
}
/* +0x000 */ OSContext_t context;
/* +0x320 */ uint32be magic; // "tHrD" (0x74487244)
/* +0x324 */ betype<THREAD_STATE> state;
/* +0x325 */ uint8 attr;
/* +0x326 */ uint16be id; // Warriors Orochi 3 uses this to identify threads
/* +0x328 */ betype<sint32> suspendCounter;
/* +0x32C */ sint32be effectivePriority; // effective priority (lower is higher)
/* +0x330 */ sint32be basePriority; // base priority (lower is higher)
/* +0x334 */ uint32be exitValue; // set by OSExitThread() or by returning from the thread entrypoint
/* +0x338 */ MEMPTR<coreinit::OSThreadQueue> currentRunQueue[Espresso::CORE_COUNT]; // points to the OSThreadQueue on which this thread is (null if not in queue)
/* +0x344 */ coreinit::OSThreadLink linkRun[Espresso::CORE_COUNT];
// general wait queue / thread dependency queue
/* +0x35C */ MEMPTR<coreinit::OSThreadQueueInternal> currentWaitQueue; // shared between OSThreadQueue and OSThreadQueueSmall
/* +0x360 */ coreinit::OSThreadLink waitQueueLink;
/* +0x368 */ coreinit::OSThreadQueue joinQueue;
/* +0x378 */ MEMPTR<coreinit::OSMutex> waitingForMutex; // set when thread is waiting for OSMutex to unlock
/* +0x37C */ coreinit::OSMutexQueue mutexQueue;
/* +0x38C */ coreinit::OSThreadLink activeThreadChain; // queue of active threads (g_activeThreadQueue)
/* +0x394 */ MEMPTR<void> stackBase; // upper limit of stack
/* +0x398 */ MEMPTR<void> stackEnd; // lower limit of stack
/* +0x39C */ MEMPTR<void> entrypoint;
/* +0x3A0 */ crt_t crt;
/* +0x578 */ sint32 alarmRelatedUkn;
/* +0x57C */ std::array<MEMPTR<void>, 16> specificArray;
/* +0x5BC */ betype<THREAD_TYPE> type;
/* +0x5C0 */ MEMPTR<const char> threadName;
/* +0x5C4 */ MEMPTR<void> waitAlarm; // used only by OSWaitEventWithTimeout/OSSignalEvent ?
/* +0x5C8 */ uint32 userStackPointer;
/* +0x5CC */ MEMPTR<void> cleanupCallback;
/* +0x5D0 */ MEMPTR<void> deallocatorFunc;
/* +0x5D4 */ uint32 stateFlags; // 0x5D4 | various flags? Controls if canceling/suspension is allowed (at cancel points) or not? If 1 -> Cancel/Suspension not allowed, if 0 -> Cancel/Suspension allowed
/* +0x5D8 */ betype<REQUEST_FLAG_BIT> requestFlags;
/* +0x5DC */ sint32 pendingSuspend;
/* +0x5E0 */ sint32 suspendResult;
/* +0x5E4 */ coreinit::OSThreadQueue suspendQueue;
/* +0x5F4 */ uint32 _padding5F4;
/* +0x5F8 */ uint64be quantumTicks;
/* +0x600 */ uint64 coretimeSumQuantumStart;
/* +0x608 */ uint64be wakeUpCount; // number of times the thread entered running state
/* +0x610 */ uint64be totalCycles; // sum of cycles this thread was active since it was created
/* +0x618 */ uint64be wakeUpTime; // time when thread first became active (Should only be set once(?) but we currently set this on every timeslice since thats more useful for debugging)
/* +0x620 */ uint64 wakeTimeRelatedUkn1;
/* +0x628 */ uint64 wakeTimeRelatedUkn2;
// set via OSSetExceptionCallback
/* +0x630 */ MPTR dsiCallback[Espresso::CORE_COUNT];
/* +0x63C */ MPTR isiCallback[Espresso::CORE_COUNT];
/* +0x648 */ MPTR programCallback[Espresso::CORE_COUNT];
/* +0x654 */ MPTR perfMonCallback[Espresso::CORE_COUNT];
/* +0x660 */ uint32 ukn660;
// todo - some of the members towards the end of the struct were only added in later COS versions. Figure out the mapping between version and members
// TLS
/* +0x664 */ uint16 numAllocatedTLSBlocks;
/* +0x666 */ sint16 tlsStatus;
/* +0x668 */ MPTR tlsBlocksMPTR;
/* +0x66C */ MEMPTR<coreinit::OSFastMutex> waitingForFastMutex;
/* +0x670 */ coreinit::OSFastMutexLink contendedFastMutex;
/* +0x678 */ coreinit::OSFastMutexLink ownedFastMutex;
/* +0x680 */ MEMPTR<void> alignmentExceptionCallback[Espresso::CORE_COUNT];
/* +0x68C */ uint32 padding68C[20 / 4];
};
static_assert(sizeof(OSThread_t) == 0x6A0);
namespace coreinit
{
void InitializeThread();
void InitializeConcurrency();
bool __CemuIsMulticoreMode();
OSThread_t* OSGetDefaultThread(sint32 coreIndex);
void* OSGetDefaultThreadStack(sint32 coreIndex, uint32& size);
bool OSCreateThreadType(OSThread_t* thread, MPTR entryPoint, sint32 numParam, void* ptrParam, void* stackTop2, sint32 stackSize, sint32 priority, uint32 attr, OSThread_t::THREAD_TYPE threadType);
bool __OSCreateThreadType(OSThread_t* thread, MPTR entryPoint, sint32 numParam, void* ptrParam, void* stackTop, sint32 stackSize, sint32 priority, uint32 attr, OSThread_t::THREAD_TYPE threadType);
void OSCreateThreadInternal(OSThread_t* thread, uint32 entryPoint, MPTR stackLowerBaseAddr, uint32 stackSize, uint8 affinityMask, OSThread_t::THREAD_TYPE threadType);
bool OSRunThread(OSThread_t* thread, MPTR funcAddress, sint32 numParam, void* ptrParam);
void OSExitThread(sint32 exitValue);
void OSDetachThread(OSThread_t* thread);
OSThread_t* OSGetCurrentThread();
void OSSetCurrentThread(uint32 coreIndex, OSThread_t* thread);
void __OSSetThreadBasePriority(OSThread_t* thread, sint32 newPriority);
void __OSUpdateThreadEffectivePriority(OSThread_t* thread);
bool OSSetThreadPriority(OSThread_t* thread, sint32 newPriority);
uint32 OSGetThreadAffinity(OSThread_t* thread);
void OSSetThreadName(OSThread_t* thread, const char* name);
const char* OSGetThreadName(OSThread_t* thread);
sint32 __OSResumeThreadInternal(OSThread_t* thread, sint32 resumeCount);
sint32 OSResumeThread(OSThread_t* thread);
void OSContinueThread(OSThread_t* thread);
void __OSSuspendThreadInternal(OSThread_t* thread);
void __OSSuspendThreadNolock(OSThread_t* thread);
void OSSuspendThread(OSThread_t* thread);
void OSSleepThread(OSThreadQueue* threadQueue);
void OSWakeupThread(OSThreadQueue* threadQueue);
bool OSJoinThread(OSThread_t* thread, uint32be* exitValue);
void OSTestThreadCancelInternal();
void OSYieldThread();
void OSSleepTicks(uint64 ticks);
bool OSIsThreadTerminated(OSThread_t* thread);
bool OSIsThreadSuspended(OSThread_t* thread);
bool OSIsThreadRunningNoLock(OSThread_t* thread);
bool OSIsThreadRunning(OSThread_t* thread);
// OSThreadQueue
void OSInitThreadQueue(OSThreadQueue* threadQueue);
void OSInitThreadQueueEx(OSThreadQueue* threadQueue, void* userData);
// OSEvent
void OSInitEvent(OSEvent* event, OSEvent::EVENT_STATE initialState, OSEvent::EVENT_MODE mode);
void OSInitEventEx(OSEvent* event, OSEvent::EVENT_STATE initialState, OSEvent::EVENT_MODE mode, void* userData);
void OSResetEvent(OSEvent* event);
void OSWaitEventInternal(OSEvent* event); // assumes lock is already held
void OSWaitEvent(OSEvent* event);
bool OSWaitEventWithTimeout(OSEvent* event, uint64 timeout);
void OSSignalEventInternal(OSEvent* event); // assumes lock is already held
void OSSignalEvent(OSEvent* event);
void OSSignalEventAllInternal(OSEvent* event); // assumes lock is already held
void OSSignalEventAll(OSEvent* event);
// OSRendezvous
void OSInitRendezvous(OSRendezvous* rendezvous);
bool OSWaitRendezvous(OSRendezvous* rendezvous, uint32 coreMask);
// OSMutex
void OSInitMutex(OSMutex* mutex);
void OSInitMutexEx(OSMutex* mutex, void* userData);
void OSLockMutex(OSMutex* mutex);
bool OSTryLockMutex(OSMutex* mutex);
void OSUnlockMutex(OSMutex* mutex);
void OSUnlockMutexInternal(OSMutex* mutex);
// OSCond
void OSInitCond(OSCond* cond);
void OSInitCondEx(OSCond* cond, void* userData);
void OSSignalCond(OSCond* cond);
void OSWaitCond(OSCond* cond, OSMutex* mutex);
// OSSemaphore
void OSInitSemaphore(OSSemaphore* semaphore, sint32 initialCount);
void OSInitSemaphoreEx(OSSemaphore* semaphore, sint32 initialCount, void* userData);
sint32 OSWaitSemaphoreInternal(OSSemaphore* semaphore);
sint32 OSWaitSemaphore(OSSemaphore* semaphore);
sint32 OSTryWaitSemaphore(OSSemaphore* semaphore);
sint32 OSSignalSemaphore(OSSemaphore* semaphore);
sint32 OSSignalSemaphoreInternal(OSSemaphore* semaphore, bool reschedule);
sint32 OSGetSemaphoreCount(OSSemaphore* semaphore);
// OSFastMutex
void OSFastMutex_Init(OSFastMutex* fastMutex, void* userData);
void OSFastMutex_Lock(OSFastMutex* fastMutex);
bool OSFastMutex_TryLock(OSFastMutex* fastMutex);
void OSFastMutex_Unlock(OSFastMutex* fastMutex);
// OSFastCond
void OSFastCond_Init(OSFastCond* fastCond, void* userData);
void OSFastCond_Wait(OSFastCond* fastCond, OSFastMutex* fastMutex);
void OSFastCond_Signal(OSFastCond* fastCond);
// scheduler
void OSSchedulerBegin(sint32 numCPUEmulationThreads);
void OSSchedulerEnd();
// internal
void __OSAddReadyThreadToRunQueue(OSThread_t* thread);
bool __OSCoreShouldSwitchToThread(OSThread_t* currentThread, OSThread_t* newThread, bool sharedPriorityAndAffinityWorkaround);
void __OSQueueThreadDeallocation(OSThread_t* thread);
bool __OSIsThreadActive(OSThread_t* thread);
void __OSDeleteAllActivePPCThreads();
}
#pragma pack()
// deprecated / clean up required
extern MPTR activeThread[256];
extern sint32 activeThreadCount;
extern SlimRWLock srwlock_activeThreadList;
| 19,172
|
C++
|
.h
| 510
| 34.843137
| 214
| 0.711189
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,571
|
coreinit_GHS.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_GHS.h
|
#pragma once
namespace coreinit
{
void PrepareGHSRuntime();
void InitializeGHS();
};
| 88
|
C++
|
.h
| 6
| 13.166667
| 26
| 0.802469
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,572
|
coreinit_MEM_FrmHeap.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM_FrmHeap.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_MEM.h"
namespace coreinit
{
struct MEMFrmHeapRecordedState
{
uint32be id;
MEMPTR<void> allocationHead;
MEMPTR<void> allocationTail;
MEMPTR<MEMFrmHeapRecordedState> prevRecordedState;
};
static_assert(sizeof(MEMFrmHeapRecordedState) == 0x10);
struct MEMFrmHeap : MEMHeapBase
{
/* +0x34 */ uint32be ukn34;
/* +0x38 */ uint32be ukn38;
/* +0x3C */ uint32be ukn3C;
/* +0x40 */ MEMPTR<void> allocationHead;
/* +0x44 */ MEMPTR<void> allocationTail;
/* +0x48 */ MEMPTR<MEMFrmHeapRecordedState> recordedStates;
};
static_assert(sizeof(MEMFrmHeap) == 0x4C);
enum class FrmHeapMode : uint32
{
Head = (1 << 0),
Tail = (1 << 1),
All = (Head | Tail),
};
MEMFrmHeap* MEMCreateFrmHeapEx(void* memStart, uint32 size, uint32 createFlags);
void* MEMDestroyFrmHeap(MEMFrmHeap* frmHeap);
void* MEMAllocFromFrmHeapEx(MEMFrmHeap* frmHeap, uint32 size, sint32 alignment);
void MEMFreeToFrmHeap(MEMFrmHeap* frmHeap, FrmHeapMode mode);
void InitializeMEMFrmHeap();
}
ENABLE_BITMASK_OPERATORS(coreinit::FrmHeapMode);
| 1,091
|
C++
|
.h
| 35
| 28.828571
| 81
| 0.75452
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,573
|
coreinit_DynLoad.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h
|
#pragma once
namespace coreinit
{
enum class RplEntryReason
{
Loaded = 1,
Unloaded = 2,
};
uint32 OSDynLoad_SetAllocator(MPTR allocFunc, MPTR freeFunc);
void OSDynLoad_SetTLSAllocator(MPTR allocFunc, MPTR freeFunc);
uint32 OSDynLoad_GetAllocator(betype<MPTR>* funcAlloc, betype<MPTR>* funcFree);
void OSDynLoad_GetTLSAllocator(betype<MPTR>* funcAlloc, betype<MPTR>* funcFree);
void* OSDynLoad_AllocatorAlloc(sint32 size, sint32 alignment);
void OSDynLoad_AllocatorFree(void* mem);
uint32 OSDynLoad_Acquire(const char* libName, uint32be* moduleHandleOut);
void OSDynLoad_Release(uint32 moduleHandle);
uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype<MPTR>* addrOut);
void InitializeDynLoad();
}
| 761
|
C++
|
.h
| 19
| 37.947368
| 112
| 0.807588
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,574
|
coreinit_Scheduler.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Scheduler.h
|
#pragma once
void __OSLockScheduler(void* obj = nullptr);
bool __OSHasSchedulerLock();
bool __OSTryLockScheduler(void* obj = nullptr);
void __OSUnlockScheduler(void* obj = nullptr);
namespace coreinit
{
uint32 OSIsInterruptEnabled();
uint32 OSDisableInterrupts();
uint32 OSRestoreInterrupts(uint32 interruptMask);
uint32 OSEnableInterrupts();
void InitializeSchedulerLock();
}
| 384
|
C++
|
.h
| 13
| 28
| 50
| 0.810298
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,575
|
coreinit_IOS.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_IOS.h
|
// IOS
typedef struct _ioBufferVector_t ioBufferVector_t;
sint32 __depr__IOS_Open(char* path, uint32 mode);
sint32 __depr__IOS_Ioctl(uint32 fd, uint32 request, void* inBuffer, uint32 inSize, void* outBuffer, uint32 outSize);
sint32 __depr__IOS_Ioctlv(uint32 fd, uint32 request, uint32 countIn, uint32 countOut, ioBufferVector_t* ioBufferVectors);
sint32 __depr__IOS_Close(uint32 fd);
// superseded by coreinit_IPC.h
| 417
|
C++
|
.h
| 7
| 58.428571
| 121
| 0.775061
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,576
|
coreinit_Spinlock.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Spinlock.h
|
#pragma once
namespace coreinit
{
struct OSSpinLock
{
/* +0x00 */ MEMPTR<struct OSThread_t> ownerThread;
/* +0x04 */ MEMPTR<void> userData;
/* +0x08 */ uint32be count;
/* +0x0C */ uint32be interruptMask;
};
static_assert(sizeof(OSSpinLock) == 0x10);
void InitializeSpinlock();
void OSInitSpinLock(OSSpinLock* spinlock);
bool OSAcquireSpinLock(OSSpinLock* spinlock);
bool OSTryAcquireSpinLock(OSSpinLock* spinlock);
bool OSTryAcquireSpinLockWithTimeout(OSSpinLock* spinlock, uint64 timeout);
bool OSReleaseSpinLock(OSSpinLock* spinlock);
bool OSUninterruptibleSpinLock_Acquire(OSSpinLock* spinlock);
bool OSUninterruptibleSpinLock_TryAcquire(OSSpinLock* spinlock);
bool OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock* spinlock, uint64 timeout);
bool OSUninterruptibleSpinLock_Release(OSSpinLock* spinlock);
}
| 847
|
C++
|
.h
| 22
| 36.272727
| 92
| 0.810976
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,577
|
coreinit_FS.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_FS.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "Cafe/IOSU/iosu_ipc_common.h"
#include "Cafe/IOSU/fsa/fsa_types.h"
#include "Cafe/IOSU/fsa/iosu_fsa.h"
#include "coreinit_MessageQueue.h"
typedef MEMPTR<betype<FSFileHandle2>> FSFileHandlePtr;
typedef MEMPTR<betype<FSDirHandle2>> FSDirHandlePtr;
typedef uint32 FSAClientHandle;
struct FSAsyncParams
{
MEMPTR<void> userCallback;
MEMPTR<void> userContext;
MEMPTR<coreinit::OSMessageQueue> ioMsgQueue;
};
static_assert(sizeof(FSAsyncParams) == 0xC);
namespace coreinit
{
struct FSCmdBlockBody;
struct FSCmdQueue
{
enum class QUEUE_FLAG : uint32
{
IS_FULL = (1 << 0), // waiting for Ioctl(v) result
CANCEL_ALL = (1 << 4),
};
/* +0x00 */ MEMPTR<FSCmdBlockBody> first;
/* +0x04 */ MEMPTR<FSCmdBlockBody> last;
/* +0x08 */ OSFastMutex fastMutex;
/* +0x34 */ MPTR dequeueHandlerFuncMPTR;
/* +0x38 */ uint32be numCommandsInFlight;
/* +0x3C */ uint32 numMaxCommandsInFlight;
/* +0x40 */ betype<QUEUE_FLAG> queueFlags;
};
DEFINE_ENUM_FLAG_OPERATORS(FSCmdQueue::QUEUE_FLAG);
static_assert(sizeof(FSCmdQueue) == 0x44);
#define FS_CLIENT_BUFFER_SIZE (5888)
#define FS_CMD_BLOCK_SIZE (2688)
struct FSClient_t
{
uint8 buffer[FS_CLIENT_BUFFER_SIZE];
};
struct FSCmdBlock_t
{
union
{
uint8 buffer[FS_CMD_BLOCK_SIZE];
struct
{
uint32 mount_it;
} data;
};
};
static_assert(sizeof(FSCmdBlock_t) == FS_CMD_BLOCK_SIZE);
struct FSClientBody_t
{
uint8 ukn0000[0x100];
uint8 ukn0100[0x100];
uint8 ukn0200[0x100];
uint8 ukn0300[0x100];
uint8 ukn0400[0x100];
uint8 ukn0500[0x100];
uint8 ukn0600[0x100];
uint8 ukn0700[0x100];
uint8 ukn0800[0x100];
uint8 ukn0900[0x100];
uint8 ukn0A00[0x100];
uint8 ukn0B00[0x100];
uint8 ukn0C00[0x100];
uint8 ukn0D00[0x100];
uint8 ukn0E00[0x100];
uint8 ukn0F00[0x100];
uint8 ukn1000[0x100];
uint8 ukn1100[0x100];
uint8 ukn1200[0x100];
uint8 ukn1300[0x100];
uint8 ukn1400[0x10];
uint8 ukn1410[0x10];
uint8 ukn1420[0x10];
uint8 ukn1430[0x10];
uint32 ukn1440;
betype<IOSDevHandle> iosuFSAHandle;
uint32 ukn1448;
uint32 ukn144C;
uint8 ukn1450[0x10];
uint8 ukn1460[0x10];
uint8 ukn1470[0x10];
FSCmdQueue fsCmdQueue;
/* +0x14C4 */ MEMPTR<struct FSCmdBlockBody> currentCmdBlockBody; // set to currently active cmd
uint32 ukn14C8;
uint32 ukn14CC;
uint8 ukn14D0[0x10];
uint8 ukn14E0[0x10];
uint8 ukn14F0[0x10];
uint8 ukn1500[0x100];
uint32 ukn1600;
uint32 ukn1604;
uint32 ukn1608;
uint32 ukn160C;
uint32 ukn1610;
MEMPTR<FSClientBody_t> fsClientBodyNext; // next FSClientBody_t* in list of registered clients (list is circular, the last element points to the first element)
uint32 ukn1618;
/* +0x161C */ MEMPTR<FSClient_t> selfClient; // pointer to FSClient struct which holds this FSClientBody
uint32 ukn1620;
};
struct FSAsyncResult
{
/* +0x00 */ FSAsyncParams fsAsyncParamsNew;
// fs message storage
struct FSMessage
{
/* +0x0C / 0x0978 */ MEMPTR<FSAsyncResult> fsAsyncResult;
/* +0x10 */ MPTR fsClientMPTR2; // 0x097C
/* +0x14 */ MPTR fsCmdBlockMPTR; // 0x0980
/* +0x18 */ MPTR commandType; // 0x0984
};
union
{
OSMessage osMsg;
FSMessage fsMsg;
} msgUnion;
/* +0x1C */ MEMPTR<FSClient_t> fsClient; // 0x0988
/* +0x20 */ MEMPTR<FSCmdBlock_t> fsCmdBlock; // 0x98C
/* +0x24 */ uint32be fsStatusNew; // 0x990
};
static_assert(sizeof(FSAsyncResult) == 0x28);
struct FSCmdBlockReturnValues_t
{
union
{
uint8 ukn0[0x14];
struct
{
MEMPTR<betype<FSResHandle>> handlePtr;
} cmdOpenFile;
struct
{
MEMPTR<uint32be> filePosPtr;
} cmdGetPosFile;
struct
{
uint32be transferSize;
uint32be uknVal094C;
uint32be transferElemSize;
uint32be uknVal0954;
} cmdReadFile;
struct
{
uint32be transferSize;
uint32be uknVal094C;
uint32be transferElemSize;
uint32be uknVal0954;
} cmdWriteFile;
struct
{
MEMPTR<uint32be> handlePtr;
} cmdOpenDir;
struct
{
MEMPTR<FSDirEntry_t> dirEntryPtr;
} cmdReadDir;
struct
{
MEMPTR<char> pathPtr;
uint32be transferSize;
} cmdGetCwd;
struct
{
MEMPTR<void> queryResultPtr;
} cmdQueryInfo;
struct
{
MEMPTR<void> resultPtr;
} cmdStatFile;
};
};
static_assert(sizeof(FSCmdBlockReturnValues_t) == 0x14);
struct FSCmdBlockBody
{
iosu::fsa::FSAShimBuffer fsaShimBuffer;
/* +0x0938 */ MEMPTR<FSClientBody_t> fsClientBody;
/* +0x093C */ uint32 statusCode; // not a status code but rather the state? Uses weird values for some reason
/* +0x0940 */ uint32be cancelState; // bitmask. Bit 0 -> If set command has been canceled
FSCmdBlockReturnValues_t returnValues;
// link for cmd queue
MEMPTR<FSCmdBlockBody> next;
MEMPTR<FSCmdBlockBody> previous;
/* +0x960 */ betype<FSA_RESULT> lastFSAStatus;
uint32 ukn0964;
/* +0x0968 */ uint8 errHandling; // return error flag mask
/* +0x096C */ FSAsyncResult asyncResult;
/* +0x0994 */ MEMPTR<void> userData;
/* +0x0998 */ OSMessageQueue syncTaskMsgQueue; // this message queue is used when mapping asynchronous tasks to synchronous API
/* +0x09D4 */ OSMessage _syncTaskMsg[1];
/* +0x09E4 */ MPTR cmdFinishFuncMPTR;
/* +0x09E8 */ uint8 priority;
uint8 uknStatusGuessed09E9;
uint8 ukn09EA;
uint8 ukn09EB;
uint32 ukn09EC;
uint32 ukn9F0;
uint32be ukn9F4_lastErrorRelated;
/* +0x9F8 */ MEMPTR<FSCmdBlock_t> selfCmdBlock;
uint32 ukn9FC;
};
static_assert(sizeof(FSCmdBlock_t) == 0xA80);
#define FSA_CMD_FLAG_SET_POS (1 << 0)
#define FSA_CMD_STATUS_CODE_D900A21 0xD900A21 // cmd block is initialized
#define FSA_CMD_STATUS_CODE_D900A22 0xD900A22 // cmd block is queued
#define FSA_CMD_STATUS_CODE_D900A24 0xD900A24 // cmd block was processed and is available again
#define FSA_CMD_STATUS_CODE_D900A26 0xD900A26 // cmd block result is being processed
enum FS_VOLSTATE : sint32
{
FS_VOLSTATE_READY = 1,
};
// internal interface
sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errHandling, FSAsyncParams* fsAsyncParams);
// coreinit exports
FS_RESULT FSAddClientEx(FSClient_t* fsClient, uint32 uknR4, uint32 errHandling);
FS_RESULT FSAddClient(FSClient_t* fsClient, uint32 errHandling);
FS_RESULT FSDelClient(FSClient_t* fsClient, uint32 errHandling);
void FSInitCmdBlock(FSCmdBlock_t* fsCmdBlock);
sint32 FSOpenFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, uint32 errHandling, FSAsyncParams* asyncParams);
sint32 FSOpenFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, char* mode, FSFileHandlePtr outFileHandle, uint32 errHandling);
sint32 FSReadFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask);
sint32 FSReadFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* dst, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask);
sint32 FSWriteFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSWriteFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 fileHandle, uint32 flag, uint32 errorMask);
sint32 FSWriteFileWithPosAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSWriteFileWithPos(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, void* src, uint32 size, uint32 count, uint32 filePos, uint32 fileHandle, uint32 flag, uint32 errorMask);
sint32 FSSetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSSetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 filePos, uint32 errorMask);
sint32 FSGetPosFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetPosFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32be* returnedFilePos, uint32 errorMask);
sint32 FSAppendFileAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSAppendFile(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 size, uint32 count, uint32 errorMask);
sint32 FSIsEofAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSIsEof(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint32 fileHandle, uint32 errorMask);
sint32 FSRenameAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSRename(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* srcPath, char* dstPath, uint32 errorMask);
sint32 FSRemoveAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSRemove(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* filePath, uint32 errorMask);
sint32 FSMakeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* dirPath, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSMakeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, uint32 errorMask);
sint32 FSChangeDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSChangeDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask);
sint32 FSGetCwdAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetCwd(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* dirPathOut, sint32 dirPathMaxLen, uint32 errorMask);
sint32 FSGetFreeSpaceSizeAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSGetFreeSpaceSize(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, const char* path, FSLargeSize* returnedFreeSize, uint32 errorMask);
sint32 FSOpenDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSOpenDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, FSDirHandlePtr dirHandleOut, uint32 errorMask);
sint32 FSReadDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask);
sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask);
FS_VOLSTATE FSGetVolumeState(FSClient_t* fsClient);
void InitializeFS();
}; // namespace coreinit
| 12,188
|
C++
|
.h
| 263
| 43.395437
| 214
| 0.774272
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,578
|
coreinit_MEM_UnitHeap.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM_UnitHeap.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_MEM.h"
namespace coreinit
{
struct MEMUnitHeapBlock
{
MEMPTR<MEMUnitHeapBlock> nextBlock;
};
static_assert(sizeof(MEMUnitHeapBlock) == 4);
struct MEMUnitHeap : public MEMHeapBase
{
/* +0x34 */ uint32 padding034;
/* +0x38 */ uint32 padding038;
/* +0x3C */ uint32 padding03C;
/* +0x40 */ MEMPTR<MEMUnitHeapBlock> firstFreeBlock;
/* +0x44 */ uint32be blockSize;
};
static_assert(sizeof(MEMUnitHeap) == 0x48);
MEMHeapBase* MEMCreateUnitHeapEx(void* memStart, uint32 heapSize, uint32 memBlockSize, uint32 alignment, uint32 createFlags);
void* MEMDestroyUnitHeap(MEMHeapHandle hHeap);
}
| 660
|
C++
|
.h
| 21
| 29.238095
| 126
| 0.764151
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,579
|
coreinit_Misc.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Misc.h
|
#pragma once
namespace coreinit
{
uint32 OSGetUPID();
uint32 OSGetPFID();
uint64 OSGetTitleID();
uint32 __OSGetProcessSDKVersion();
uint32 OSLaunchTitleByPathl(const char* path, uint32 pathLength, uint32 argc);
uint32 OSRestartGame(uint32 argc, MEMPTR<char>* argv);
void OSReleaseForeground();
void StartBackgroundForegroundTransition();
struct OSDriverInterface
{
MEMPTR<void> getDriverName;
MEMPTR<void> init;
MEMPTR<void> onAcquireForeground;
MEMPTR<void> onReleaseForeground;
MEMPTR<void> done;
};
static_assert(sizeof(OSDriverInterface) == 0x14);
uint32 OSDriver_Register(uint32 moduleHandle, sint32 priority, OSDriverInterface* driverCallbacks, sint32 driverId, uint32be* outUkn1, uint32be* outUkn2, uint32be* outUkn3);
uint32 OSDriver_Deregister(uint32 moduleHandle, sint32 driverId);
enum class COSReportModule
{
coreinit = 0,
};
enum class COSReportLevel
{
Error = 0,
Warn = 1,
Info = 2
};
sint32 ppc_vprintf(const char* formatStr, char* strOut, sint32 maxLength, ppc_va_list* vargs);
void miscInit();
};
| 1,062
|
C++
|
.h
| 35
| 27.971429
| 174
| 0.787046
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,580
|
coreinit_IPC.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_IPC.h
|
#include "Cafe/IOSU/iosu_ipc_common.h"
#include "Cafe/IOSU/iosu_types_common.h"
namespace coreinit
{
void IPCDriver_NotifyResponses(uint32 ppcCoreIndex, IPCCommandBody** responseArray, uint32 numResponses);
IOSDevHandle IOS_Open(const char* devicePath, uint32 flags);
IOS_ERROR IOS_Close(IOSDevHandle devHandle);
IOS_ERROR IOS_Ioctl(IOSDevHandle devHandle, uint32 requestId, void* ptrIn, uint32 sizeIn, void* ptrOut, uint32 sizeOut);
IOS_ERROR IOS_IoctlAsync(IOSDevHandle devHandle, uint32 requestId, void* ptrIn, uint32 sizeIn, void* ptrOut, uint32 sizeOut, MEMPTR<void> asyncResultFunc, MEMPTR<void> asyncResultUserParam);
IOS_ERROR IOS_Ioctlv(IOSDevHandle devHandle, uint32 requestId, uint32 numIn, uint32 numOut, IPCIoctlVector* vec);
IOS_ERROR IOS_IoctlvAsync(IOSDevHandle devHandle, uint32 requestId, uint32 numIn, uint32 numOut, IPCIoctlVector* vec, MEMPTR<void> asyncResultFunc, MEMPTR<void> asyncResultUserParam);
void InitializeIPC();
};
| 958
|
C++
|
.h
| 13
| 71.923077
| 191
| 0.815483
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,581
|
coreinit_FG.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_FG.h
|
#pragma once
namespace coreinit
{
void __OSClearCopyData();
uint32 __OSGetCopyDataSize();
uint8* __OSGetCopyDataPtr();
bool __OSAppendCopyData(uint8* data, sint32 length);
bool __OSResizeCopyData(sint32 length);
bool OSGetForegroundBucket(MEMPTR<void>* offset, uint32be* size);
bool OSGetForegroundBucketFreeArea(MEMPTR<void>* offset, uint32be* size);
void InitForegroundBucket();
void InitializeFG();
}
| 416
|
C++
|
.h
| 13
| 30.076923
| 74
| 0.7925
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,582
|
coreinit_SysHeap.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_SysHeap.h
|
#pragma once
namespace coreinit
{
void InitSysHeap();
void* OSAllocFromSystem(uint32 size, uint32 alignment);
void OSFreeToSystem(void* ptr);
void InitializeSysHeap();
}
| 176
|
C++
|
.h
| 8
| 20.25
| 56
| 0.807229
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,583
|
coreinit_Atomic.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Atomic.h
|
#pragma once
#include <atomic>
namespace coreinit
{
uint32 OSSwapAtomic(std::atomic<uint32be>* mem, uint32 newValue);
bool OSCompareAndSwapAtomic(std::atomic<uint32be>* mem, uint32 compareValue, uint32 swapValue);
bool OSCompareAndSwapAtomicEx(std::atomic<uint32be>* mem, uint32 compareValue, uint32 swapValue, uint32be* previousValue);
uint32 OSAddAtomic(std::atomic<uint32be>* mem, uint32 adder);
uint64 OSSwapAtomic64(std::atomic<uint64be>* mem, uint64 newValue);
uint64 OSSetAtomic64(std::atomic<uint64be>* mem, uint64 newValue);
uint64 OSGetAtomic64(std::atomic<uint64be>* mem);
uint64 OSAddAtomic64(std::atomic<uint64be>* mem, uint64 adder);
uint64 OSAndAtomic64(std::atomic<uint64be>* mem, uint64 val);
uint64 OSOrAtomic64(std::atomic<uint64be>* mem, uint64 val);
bool OSCompareAndSwapAtomic64(std::atomic<uint64be>* mem, uint64 compareValue, uint64 swapValue);
bool OSCompareAndSwapAtomicEx64(std::atomic<uint64be>* mem, uint64 compareValue, uint64 swapValue, uint64be* previousValue);
void InitializeAtomic();
}
| 1,037
|
C++
|
.h
| 18
| 55.722222
| 125
| 0.804134
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,584
|
coreinit_MCP.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MCP.h
|
#pragma once
struct SysProdSettings
{
uint8 ukn00; // 0x00
uint8 ukn01; // 0x01
uint8 ukn02; // 0x02
uint8 platformRegion; // 0x03
uint8 ukn04;
uint8 ukn05;
uint8 ukn06;
uint8 ukn07;
uint8 prevBlock;
uint8 ukn09;
uint8 ukn0A;
uint8 gameRegion; // game region?
uint8 nextBlock;
uint8 ukn0D;
uint8 ukn0E;
uint8 ukn0F;
uint8 ukn10;
uint8 ukn11;
uint8 ukn12;
uint8 ukn13;
uint8 ukn14[4];
uint8 ukn18[4];
uint8 ukn1C[4];
uint8 ukn20[4];
uint8 ukn24[4];
uint8 ukn28[4];
uint8 ukn2C[4];
uint8 ukn30[4];
uint8 ukn34[4];
uint8 ukn38[4];
uint8 ukn3C[4];
uint8 ukn40[4];
uint8 ukn44;
uint8 ukn45;
};
static_assert(sizeof(SysProdSettings) == 0x46);
typedef uint32 MCPHANDLE;
MCPHANDLE MCP_Open();
void MCP_Close(MCPHANDLE mcpHandle);
sint32 MCP_GetSysProdSettings(MCPHANDLE mcpHandle, SysProdSettings* sysProdSettings);
void coreinitExport_UCReadSysConfig(PPCInterpreter_t* hCPU);
namespace coreinit
{
void InitializeMCP();
}
| 961
|
C++
|
.h
| 48
| 18.1875
| 85
| 0.767621
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,585
|
coreinit_SystemInfo.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_SystemInfo.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit.h"
namespace coreinit
{
struct OSSystemInfo
{
uint32be busClock;
uint32be coreClock;
uint64be ticksSince2000;
uint32be l2cacheSize[PPC_CORE_COUNT];
uint32be coreClockToBusClockRatio;
};
static_assert(sizeof(OSSystemInfo) == 0x20);
const OSSystemInfo& OSGetSystemInfo();
void InitializeSystemInfo();
};
| 379
|
C++
|
.h
| 16
| 21.25
| 45
| 0.80618
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,586
|
coreinit.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit.h
|
#pragma once
#include "Cafe/HW/Espresso/Const.h"
#define PPC_CORE_COUNT (Espresso::CORE_COUNT)
#include "Cafe/OS/libs/coreinit/coreinit_MessageQueue.h"
// async callback helper
void InitializeAsyncCallback();
void coreinitAsyncCallback_add(MPTR functionMPTR, uint32 numParameters, uint32 r3 = 0, uint32 r4 = 0, uint32 r5 = 0, uint32 r6 = 0, uint32 r7 = 0, uint32 r8 = 0, uint32 r9 = 0, uint32 r10 = 0);
void coreinitAsyncCallback_addWithLock(MPTR functionMPTR, uint32 numParameters, uint32 r3 = 0, uint32 r4 = 0, uint32 r5 = 0, uint32 r6 = 0, uint32 r7 = 0, uint32 r8 = 0, uint32 r9 = 0, uint32 r10 = 0);
// misc
void coreinit_load();
// coreinit shared memory
struct CoreinitSharedData
{
MEMPTR<void> MEMAllocFromDefaultHeap;
MEMPTR<void> MEMAllocFromDefaultHeapEx;
MEMPTR<void> MEMFreeToDefaultHeap;
MPTR __atexit_cleanup;
MPTR __cpp_exception_init_ptr;
MPTR __cpp_exception_cleanup_ptr;
MPTR __stdio_cleanup;
};
extern CoreinitSharedData* gCoreinitData;
// coreinit init
void coreinit_start(PPCInterpreter_t* hCPU);
MPTR OSAllocFromSystem(uint32 size, uint32 alignment);
void OSFreeToSystem(MPTR mem);
// above is all the legacy stuff. New code uses namespaces
namespace coreinit
{
sint32 OSGetCoreId();
uint32 OSGetCoreCount();
uint32 OSGetStackPointer();
};
| 1,288
|
C++
|
.h
| 33
| 37.393939
| 201
| 0.776527
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,587
|
coreinit_Memory.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_Memory.h
|
#pragma once
namespace coreinit
{
void InitializeMemory();
void OSGetMemBound(sint32 memType, MEMPTR<void>* offsetOutput, uint32be* sizeOutput);
void* OSBlockMove(MEMPTR<void> dst, MEMPTR<void> src, uint32 size, bool flushDC);
void* OSBlockSet(MEMPTR<void> dst, uint32 value, uint32 size);
void OSMemoryBarrier();
}
| 324
|
C++
|
.h
| 9
| 34.111111
| 86
| 0.788462
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,588
|
coreinit_MessageQueue.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_MessageQueue.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
namespace coreinit
{
enum class SysMessageId : uint32
{
MsgAcquireForeground = 0xFACEF000,
MsgReleaseForeground = 0xFACEBACC,
MsgExit = 0xD1E0D1E0,
HomeButtonDenied = 0xCCC0FFEE,
NetIoStartOrStop = 0xAAC0FFEE,
};
struct OSMessage
{
uint32be message;
uint32be data0;
uint32be data1;
uint32be data2;
};
struct OSMessageQueue
{
/* +0x00 */ uint32be magic;
/* +0x04 */ MEMPTR<void> userData;
/* +0x08 */ uint32be ukn08;
/* +0x0C */ OSThreadQueue threadQueueSend;
/* +0x1C */ OSThreadQueue threadQueueReceive;
/* +0x2C */ MEMPTR<OSMessage> msgArray;
/* +0x30 */ uint32be msgCount;
/* +0x34 */ uint32be firstIndex;
/* +0x38 */ uint32be usedCount;
};
static_assert(sizeof(OSMessageQueue) == 0x3C);
// flags
#define OS_MESSAGE_BLOCK 1 // blocking send/receive
#define OS_MESSAGE_HIGH_PRIORITY 2 // put message in front of all queued messages
void OSInitMessageQueueEx(OSMessageQueue* msgQueue, OSMessage* msgArray, uint32 msgCount, void* userData);
void OSInitMessageQueue(OSMessageQueue* msgQueue, OSMessage* msgArray, uint32 msgCount);
bool OSReceiveMessage(OSMessageQueue* msgQueue, OSMessage* msg, uint32 flags);
bool OSPeekMessage(OSMessageQueue* msgQueue, OSMessage* msg);
sint32 OSSendMessage(OSMessageQueue* msgQueue, OSMessage* msg, uint32 flags);
OSMessageQueue* OSGetSystemMessageQueue();
void InitializeMessageQueue();
};
| 1,483
|
C++
|
.h
| 43
| 32.023256
| 107
| 0.75157
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,589
|
coreinit_CodeGen.h
|
cemu-project_Cemu/src/Cafe/OS/libs/coreinit/coreinit_CodeGen.h
|
#pragma once
namespace coreinit
{
void OSGetCodegenVirtAddrRangeInternal(uint32& rangeStart, uint32& rangeSize);
void codeGenHandleICBI(uint32 ea);
bool codeGenShouldAvoid();
void InitializeCodeGen();
}
| 208
|
C++
|
.h
| 8
| 24.375
| 79
| 0.839196
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,590
|
nlibcurlDebug.hpp
|
cemu-project_Cemu/src/Cafe/OS/libs/nlibcurl/nlibcurlDebug.hpp
|
uint32 _curlDebugSessionId = 0;
// begin a new request if one is not already active
void curlDebug_markActiveRequest(CURL_t* curl)
{
if (!ActiveSettings::DumpLibcurlRequestsEnabled())
return;
if (curl->debug.activeRequestIndex != 0)
return; // already tracking request
if (_curlDebugSessionId == 0)
{
_curlDebugSessionId = (uint32)std::chrono::seconds(std::time(NULL)).count();
if (_curlDebugSessionId == 0)
_curlDebugSessionId = 1;
wchar_t filePath[256];
swprintf(filePath, sizeof(filePath), L"dump//curl//session%u", _curlDebugSessionId);
fs::create_directories(fs::path(filePath));
}
static uint32 _nextRequestIndex = 1;
curl->debug.activeRequestIndex = _nextRequestIndex;
_nextRequestIndex++;
wchar_t filePath[256];
swprintf(filePath, sizeof(filePath) / sizeof(wchar_t), L"dump//curl//session%u//request%04d_param.txt", _curlDebugSessionId, (sint32)curl->debug.activeRequestIndex);
curl->debug.file_requestParam = FileStream::createFile(filePath);
auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
if (curl->debug.file_requestParam)
{
auto t = std::localtime(&now);
curl->debug.file_requestParam->writeStringFmt("Request %d %d-%d-%d %d:%02d:%02d\r\n", (sint32)curl->debug.activeRequestIndex, t->tm_year+1900, t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
}
}
void curlDebug_notifySubmitRequest(CURL_t* curl)
{
// start new response
curl->debug.responseRequestIndex = curl->debug.activeRequestIndex;
if (curl->debug.file_responseRaw)
{
delete curl->debug.file_responseRaw;
curl->debug.file_responseRaw = nullptr;
}
if (curl->debug.file_responseHeaders)
{
delete curl->debug.file_responseHeaders;
curl->debug.file_responseHeaders = nullptr;
}
curl->debug.hasDumpedResultInfo = false;
// end current request
curl->debug.activeRequestIndex = 0;
if (curl->debug.file_requestParam)
{
delete curl->debug.file_requestParam;
curl->debug.file_requestParam = nullptr;
}
}
void curlDebug_logEasySetOptStr(CURL_t* curl, const char* optName, const char* optValue)
{
curlDebug_markActiveRequest(curl);
if (curl->debug.file_requestParam)
{
curl->debug.file_requestParam->writeStringFmt("SetOpt %s: ", optName, optValue ? optValue : "NULL");
if(optValue)
curl->debug.file_requestParam->writeString(optValue);
else
curl->debug.file_requestParam->writeString("NULL");
curl->debug.file_requestParam->writeString("\r\n");
}
}
void curlDebug_logEasySetOptPtr(CURL_t* curl, const char* optName, uint32 ppcPtr)
{
curlDebug_markActiveRequest(curl);
if (curl->debug.file_requestParam)
{
curl->debug.file_requestParam->writeStringFmt("SetOpt %s: 0x%08x\r\n", optName, ppcPtr);
}
}
void curlDebug_resultWrite(CURL_t* curl, char* ptr, size_t size, size_t nmemb)
{
if (!ActiveSettings::DumpLibcurlRequestsEnabled())
return;
if (curl->debug.responseRequestIndex == 0)
return;
if (curl->debug.file_responseRaw == nullptr)
{
wchar_t filePath[256];
swprintf(filePath, sizeof(filePath) / sizeof(wchar_t), L"dump//curl//session%u//request%04d_responseRaw.bin", _curlDebugSessionId, (sint32)curl->debug.responseRequestIndex);
curl->debug.file_responseRaw = FileStream::createFile(filePath);
}
if (curl->debug.file_responseRaw)
{
curl->debug.file_responseRaw->writeData(ptr, size*nmemb);
}
}
void curlDebug_headerWrite(CURL_t* curl, char* ptr, size_t size, size_t nmemb)
{
if (!ActiveSettings::DumpLibcurlRequestsEnabled())
return;
if (curl->debug.responseRequestIndex == 0)
return;
if (curl->debug.file_responseHeaders == nullptr)
{
wchar_t filePath[256];
swprintf(filePath, sizeof(filePath) / sizeof(wchar_t), L"dump//curl//session%u//request%04d_responseHeaders.txt", _curlDebugSessionId, (sint32)curl->debug.responseRequestIndex);
curl->debug.file_responseHeaders = FileStream::createFile(filePath);
}
if (curl->debug.file_responseHeaders)
{
curl->debug.file_responseHeaders->writeData(ptr, size*nmemb);
}
}
void curlDebug_cleanup(CURL_t* curl)
{
if (curl->debug.file_requestParam)
{
delete curl->debug.file_requestParam;
curl->debug.file_requestParam = nullptr;
}
if (curl->debug.file_responseRaw)
{
delete curl->debug.file_responseRaw;
curl->debug.file_responseRaw = nullptr;
}
if (curl->debug.file_responseHeaders)
{
delete curl->debug.file_responseHeaders;
curl->debug.file_responseHeaders = nullptr;
}
}
| 4,382
|
C++
|
.h
| 126
| 32.52381
| 202
| 0.751943
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,591
|
mic.h
|
cemu-project_Cemu/src/Cafe/OS/libs/mic/mic.h
|
bool mic_isActive(uint32 drcIndex);
void mic_updateOnAXFrame();
namespace mic
{
void Initialize();
};
| 103
|
C++
|
.h
| 6
| 16
| 35
| 0.793814
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,592
|
nn_fp.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_fp/nn_fp.h
|
#pragma once
namespace nn
{
namespace fp
{
void load();
}
}
| 64
|
C++
|
.h
| 8
| 6.5
| 14
| 0.701754
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,593
|
snd_user.h
|
cemu-project_Cemu/src/Cafe/OS/libs/snd_user/snd_user.h
|
#pragma once
#include "Cafe/OS/libs/snd_core/ax.h"
namespace snd
{
namespace user
{
struct MixControl;
void MIXInit();
void MIXInitInputControl(snd_core::AXVPB* voice, uint16 input, uint32 mode);
void MIXInitDeviceControl(snd_core::AXVPB* voice, uint32 device_type, uint32 index, MixControl* control, uint32 mode);
void MIXSetDeviceSoundMode(uint32 device, uint32 mode);
void MIXUpdateSettings();
void MIXSetInput(snd_core::AXVPB* voice, uint16 input);
void MIXDRCInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 vol1, uint16 vol2, uint16 vol3);
void MIXAssignChannel(snd_core::AXVPB* voice);
void MIXInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 input, uint16 aux1, uint16 aux2, uint16 aux3, uint16 pan, uint16 span, uint16 fader);
uint32 MIXGetSoundMode();
void MIXSetSoundMode(uint32 sound_mode);
void Initialize();
}
}
| 874
|
C++
|
.h
| 21
| 39
| 151
| 0.772674
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,594
|
ntag.h
|
cemu-project_Cemu/src/Cafe/OS/libs/ntag/ntag.h
|
#pragma once
#include "Cafe/OS/libs/nfc/nfc.h"
#define NTAG_RESULT_SUCCESS (0)
#define NTAG_RESULT_UNINITIALIZED (-0x3E7)
#define NTAG_RESULT_INVALID_STATE (-0x3E6)
#define NTAG_RESULT_NO_TAG (-0x3E5)
#define NTAG_RESULT_INVALID (-0x3E1)
#define NTAG_RESULT_UID_MISMATCH (-0x3DB)
namespace ntag
{
struct NTAGFormatSettings
{
/* +0x00 */ uint8 version;
/* +0x04 */ uint32 makerCode;
/* +0x08 */ uint32 identifyCode;
/* +0x0C */ uint8 reserved[0x1C];
};
static_assert(sizeof(NTAGFormatSettings) == 0x28);
#pragma pack(1)
struct NTAGNoftHeader
{
/* +0x00 */ uint32 magic;
/* +0x04 */ uint8 version;
/* +0x05 */ uint16 writeCount;
/* +0x07 */ uint8 unknown;
};
static_assert(sizeof(NTAGNoftHeader) == 0x8);
#pragma pack()
struct NTAGInfoHeader
{
/* +0x00 */ uint16 rwHeaderOffset;
/* +0x02 */ uint16 rwSize;
/* +0x04 */ uint16 roHeaderOffset;
/* +0x06 */ uint16 roSize;
/* +0x08 */ nfc::NFCUid uid;
/* +0x0F */ uint8 formatVersion;
};
static_assert(sizeof(NTAGInfoHeader) == 0x10);
struct NTAGAreaHeader
{
/* +0x00 */ uint16 magic;
/* +0x02 */ uint16 offset;
/* +0x04 */ uint16 size;
/* +0x06 */ uint16 padding;
/* +0x08 */ uint32 makerCode;
/* +0x0C */ uint32 identifyCode;
};
static_assert(sizeof(NTAGAreaHeader) == 0x10);
struct NTAGAreaInfo
{
/* +0x00 */ MPTR data;
/* +0x04 */ uint16 size;
/* +0x06 */ uint16 padding;
/* +0x08 */ uint32 makerCode;
/* +0x0C */ uint32 identifyCode;
/* +0x10 */ uint8 reserved[0x20];
};
static_assert(sizeof(NTAGAreaInfo) == 0x30);
struct NTAGData
{
/* +0x00 */ nfc::NFCUid uid;
/* +0x07 */ uint8 readOnly;
/* +0x08 */ uint8 formatVersion;
/* +0x09 */ uint8 padding[3];
/* +0x0C */ NTAGAreaInfo rwInfo;
/* +0x3C */ NTAGAreaInfo roInfo;
/* +0x6C */ uint8 reserved[0x20];
};
static_assert(sizeof(NTAGData) == 0x8C);
sint32 NTAGInit(uint32 chan);
sint32 NTAGInitEx(uint32 chan);
sint32 NTAGShutdown(uint32 chan);
bool NTAGIsInit(uint32 chan);
void NTAGProc(uint32 chan);
void NTAGSetFormatSettings(NTAGFormatSettings* formatSettings);
void NTAGSetTagDetectCallback(uint32 chan, MPTR callback, void* context);
sint32 NTAGAbort(uint32 chan, MPTR callback, void* context);
sint32 NTAGRead(uint32 chan, uint32 timeout, nfc::NFCUid* uid, nfc::NFCUid* uidMask, MPTR callback, void* context);
sint32 NTAGWrite(uint32 chan, uint32 timeout, nfc::NFCUid* uid, uint32 rwSize, void* rwData, MPTR callback, void* context);
sint32 NTAGFormat(uint32 chan, uint32 timeout, nfc::NFCUid* uid, uint32 rwSize, void* rwData, MPTR callback, void* context);
void Initialize();
}
| 2,609
|
C++
|
.h
| 82
| 29.341463
| 125
| 0.702951
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,595
|
Whitelist.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/Whitelist.h
|
#ifndef CEMU_NSYSHID_WHITELIST_H
#define CEMU_NSYSHID_WHITELIST_H
namespace nsyshid
{
class Whitelist {
public:
static Whitelist& GetInstance();
Whitelist(const Whitelist&) = delete;
Whitelist& operator=(const Whitelist&) = delete;
bool IsDeviceWhitelisted(uint16 vendorId, uint16 productId);
void AddDevice(uint16 vendorId, uint16 productId);
void RemoveDevice(uint16 vendorId, uint16 productId);
std::list<std::tuple<uint16, uint16>> GetDevices();
void RemoveAllDevices();
private:
Whitelist();
// vendorId, productId
std::list<std::tuple<uint16, uint16>> m_devices;
};
} // namespace nsyshid
#endif // CEMU_NSYSHID_WHITELIST_H
| 671
|
C++
|
.h
| 21
| 29
| 62
| 0.763693
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,596
|
Backend.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/Backend.h
|
#ifndef CEMU_NSYSHID_BACKEND_H
#define CEMU_NSYSHID_BACKEND_H
#include <list>
#include <memory>
#include <mutex>
#include "Common/precompiled.h"
namespace nsyshid
{
typedef struct
{
/* +0x00 */ uint32be handle;
/* +0x04 */ uint32 ukn04;
/* +0x08 */ uint16 vendorId; // little-endian ?
/* +0x0A */ uint16 productId; // little-endian ?
/* +0x0C */ uint8 ifIndex;
/* +0x0D */ uint8 subClass;
/* +0x0E */ uint8 protocol;
/* +0x0F */ uint8 paddingGuessed0F;
/* +0x10 */ uint16be maxPacketSizeRX;
/* +0x12 */ uint16be maxPacketSizeTX;
} HID_t;
struct TransferCommand
{
uint8* data;
sint32 length;
TransferCommand(uint8* data, sint32 length)
: data(data), length(length)
{
}
virtual ~TransferCommand() = default;
};
struct ReadMessage final : TransferCommand
{
sint32 bytesRead;
ReadMessage(uint8* data, sint32 length, sint32 bytesRead)
: bytesRead(bytesRead), TransferCommand(data, length)
{
}
using TransferCommand::TransferCommand;
};
struct WriteMessage final : TransferCommand
{
sint32 bytesWritten;
WriteMessage(uint8* data, sint32 length, sint32 bytesWritten)
: bytesWritten(bytesWritten), TransferCommand(data, length)
{
}
using TransferCommand::TransferCommand;
};
struct ReportMessage final : TransferCommand
{
uint8* reportData;
sint32 length;
uint8* originalData;
sint32 originalLength;
ReportMessage(uint8* reportData, sint32 length, uint8* originalData, sint32 originalLength)
: reportData(reportData), length(length), originalData(originalData),
originalLength(originalLength), TransferCommand(reportData, length)
{
}
using TransferCommand::TransferCommand;
};
static_assert(offsetof(HID_t, vendorId) == 0x8, "");
static_assert(offsetof(HID_t, productId) == 0xA, "");
static_assert(offsetof(HID_t, ifIndex) == 0xC, "");
static_assert(offsetof(HID_t, protocol) == 0xE, "");
class Device {
public:
Device() = delete;
Device(uint16 vendorId,
uint16 productId,
uint8 interfaceIndex,
uint8 interfaceSubClass,
uint8 protocol);
Device(const Device& device) = delete;
Device& operator=(const Device& device) = delete;
virtual ~Device() = default;
HID_t* m_hid; // this info is passed to applications and must remain intact
uint16 m_vendorId;
uint16 m_productId;
uint8 m_interfaceIndex;
uint8 m_interfaceSubClass;
uint8 m_protocol;
uint16 m_maxPacketSizeRX;
uint16 m_maxPacketSizeTX;
virtual void AssignHID(HID_t* hid);
virtual bool Open() = 0;
virtual void Close() = 0;
virtual bool IsOpened() = 0;
enum class ReadResult
{
Success,
Error,
ErrorTimeout,
};
virtual ReadResult Read(ReadMessage* message) = 0;
enum class WriteResult
{
Success,
Error,
ErrorTimeout,
};
virtual WriteResult Write(WriteMessage* message) = 0;
virtual bool GetDescriptor(uint8 descType,
uint8 descIndex,
uint8 lang,
uint8* output,
uint32 outputMaxLength) = 0;
virtual bool SetProtocol(uint8 ifIndex, uint8 protocol) = 0;
virtual bool SetReport(ReportMessage* message) = 0;
};
class Backend {
public:
Backend();
Backend(const Backend& backend) = delete;
Backend& operator=(const Backend& backend) = delete;
virtual ~Backend() = default;
void DetachAllDevices();
// called from nsyshid when this backend is attached - do not call this yourself!
void OnAttach();
// called from nsyshid when this backend is detached - do not call this yourself!
void OnDetach();
bool IsBackendAttached();
virtual bool IsInitialisedOk() = 0;
protected:
// try to attach a device - only works if this backend is attached
bool AttachDevice(const std::shared_ptr<Device>& device);
void DetachDevice(const std::shared_ptr<Device>& device);
std::shared_ptr<Device> FindDevice(std::function<bool(const std::shared_ptr<Device>&)> isWantedDevice);
bool FindDeviceById(uint16 vendorId, uint16 productId);
bool IsDeviceWhitelisted(uint16 vendorId, uint16 productId);
// called from OnAttach() - attach devices that your backend can see here
virtual void AttachVisibleDevices() = 0;
private:
std::list<std::shared_ptr<Device>> m_devices;
std::recursive_mutex m_devicesMutex;
bool m_isAttached;
};
namespace backend
{
void AttachDefaultBackends();
}
} // namespace nsyshid
#endif // CEMU_NSYSHID_BACKEND_H
| 4,408
|
C++
|
.h
| 144
| 27.118056
| 105
| 0.729364
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,597
|
Dimensions.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/Dimensions.h
|
#include <mutex>
#include "nsyshid.h"
#include "Backend.h"
#include "Common/FileStream.h"
namespace nsyshid
{
class DimensionsToypadDevice final : public Device
{
public:
DimensionsToypadDevice();
~DimensionsToypadDevice() = default;
bool Open() override;
void Close() override;
bool IsOpened() override;
ReadResult Read(ReadMessage* message) override;
WriteResult Write(WriteMessage* message) override;
bool GetDescriptor(uint8 descType,
uint8 descIndex,
uint8 lang,
uint8* output,
uint32 outputMaxLength) override;
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
bool SetReport(ReportMessage* message) override;
private:
bool m_IsOpened;
};
class DimensionsUSB
{
public:
struct DimensionsMini final
{
std::unique_ptr<FileStream> dimFile;
std::array<uint8, 0x2D * 0x04> data{};
uint8 index = 255;
uint8 pad = 255;
uint32 id = 0;
void Save();
};
void SendCommand(std::span<const uint8, 32> buf);
std::array<uint8, 32> GetStatus();
void GenerateRandomNumber(std::span<const uint8, 8> buf, uint8 sequence,
std::array<uint8, 32>& replyBuf);
void InitializeRNG(uint32 seed);
void GetChallengeResponse(std::span<const uint8, 8> buf, uint8 sequence,
std::array<uint8, 32>& replyBuf);
void QueryBlock(uint8 index, uint8 page, std::array<uint8, 32>& replyBuf,
uint8 sequence);
void WriteBlock(uint8 index, uint8 page, std::span<const uint8, 4> toWriteBuf, std::array<uint8, 32>& replyBuf,
uint8 sequence);
void GetModel(std::span<const uint8, 8> buf, uint8 sequence,
std::array<uint8, 32>& replyBuf);
bool RemoveFigure(uint8 pad, uint8 index, bool fullRemove);
bool TempRemove(uint8 index);
bool CancelRemove(uint8 index);
uint32 LoadFigure(const std::array<uint8, 0x2D * 0x04>& buf, std::unique_ptr<FileStream> file, uint8 pad, uint8 index);
bool CreateFigure(fs::path pathName, uint32 id);
bool MoveFigure(uint8 pad, uint8 index, uint8 oldPad, uint8 oldIndex);
static std::map<const uint32, const char*> GetListMinifigs();
static std::map<const uint32, const char*> GetListTokens();
std::string FindFigure(uint32 figNum);
protected:
std::mutex m_dimensionsMutex;
std::array<DimensionsMini, 7> m_figures{};
private:
void RandomUID(std::array<uint8, 0x2D * 0x04>& uidBuffer);
uint8 GenerateChecksum(const std::array<uint8, 32>& data,
int numOfBytes) const;
std::array<uint8, 8> Decrypt(std::span<const uint8, 8> buf, std::optional<std::array<uint8, 16>> key);
std::array<uint8, 8> Encrypt(std::span<const uint8, 8> buf, std::optional<std::array<uint8, 16>> key);
std::array<uint8, 16> GenerateFigureKey(const std::array<uint8, 0x2D * 0x04>& uid);
std::array<uint8, 4> PWDGenerate(const std::array<uint8, 0x2D * 0x04>& uid);
std::array<uint8, 4> DimensionsRandomize(const std::vector<uint8> key, uint8 count);
uint32 GetFigureId(const std::array<uint8, 0x2D * 0x04>& buf);
uint32 Scramble(const std::array<uint8, 7>& uid, uint8 count);
uint32 GetNext();
DimensionsMini& GetFigureByIndex(uint8 index);
uint32 m_randomA;
uint32 m_randomB;
uint32 m_randomC;
uint32 m_randomD;
bool m_isAwake = false;
std::queue<std::array<uint8, 32>> m_figureAddedRemovedResponses;
std::queue<std::array<uint8, 32>> m_queries;
};
extern DimensionsUSB g_dimensionstoypad;
} // namespace nsyshid
| 3,423
|
C++
|
.h
| 86
| 35.918605
| 121
| 0.725271
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,598
|
BackendLibusb.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/BackendLibusb.h
|
#ifndef CEMU_NSYSHID_BACKEND_LIBUSB_H
#define CEMU_NSYSHID_BACKEND_LIBUSB_H
#include "nsyshid.h"
#if NSYSHID_ENABLE_BACKEND_LIBUSB
#include <libusb-1.0/libusb.h>
#include "Backend.h"
namespace nsyshid::backend::libusb
{
class BackendLibusb : public nsyshid::Backend {
public:
BackendLibusb();
~BackendLibusb();
bool IsInitialisedOk() override;
protected:
void AttachVisibleDevices() override;
private:
libusb_context* m_ctx;
int m_initReturnCode;
bool m_callbackRegistered;
libusb_hotplug_callback_handle m_hotplugCallbackHandle;
std::thread m_hotplugThread;
std::atomic<bool> m_hotplugThreadStop;
// called by libusb
static int HotplugCallback(libusb_context* ctx, libusb_device* dev,
libusb_hotplug_event event, void* user_data);
int OnHotplug(libusb_device* dev, libusb_hotplug_event event);
std::shared_ptr<Device> CheckAndCreateDevice(libusb_device* dev);
std::shared_ptr<Device> FindLibusbDevice(libusb_device* dev);
bool FindDefaultDeviceEndpoints(libusb_device* dev,
bool& endpointInFound, uint8& endpointIn, uint16& endpointInMaxPacketSize,
bool& endpointOutFound, uint8& endpointOut, uint16& endpointOutMaxPacketSize);
};
template<typename T>
using UniquePtr = std::unique_ptr<T, void (*)(T*)>;
using ConfigDescriptor = UniquePtr<libusb_config_descriptor>;
class DeviceLibusb : public nsyshid::Device {
public:
DeviceLibusb(libusb_context* ctx,
uint16 vendorId,
uint16 productId,
uint8 interfaceIndex,
uint8 interfaceSubClass,
uint8 protocol,
uint8 libusbBusNumber,
uint8 libusbDeviceAddress,
std::vector<ConfigDescriptor> configs);
~DeviceLibusb() override;
bool Open() override;
void Close() override;
bool IsOpened() override;
ReadResult Read(ReadMessage* message) override;
WriteResult Write(WriteMessage* message) override;
bool GetDescriptor(uint8 descType,
uint8 descIndex,
uint8 lang,
uint8* output,
uint32 outputMaxLength) override;
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
int ClaimAllInterfaces(uint8 config_num);
int ReleaseAllInterfaces(uint8 config_num);
int ReleaseAllInterfacesForCurrentConfig();
bool SetReport(ReportMessage* message) override;
uint8 m_libusbBusNumber;
uint8 m_libusbDeviceAddress;
bool m_libusbHasEndpointIn;
uint8 m_libusbEndpointIn;
bool m_libusbHasEndpointOut;
uint8 m_libusbEndpointOut;
private:
void CloseDevice();
libusb_context* m_ctx;
std::mutex m_handleMutex;
std::atomic<sint32> m_handleInUseCounter;
std::condition_variable m_handleInUseCounterDecremented;
libusb_device_handle* m_libusbHandle;
std::vector<ConfigDescriptor> m_config_descriptors;
class HandleLock {
public:
HandleLock() = delete;
HandleLock(libusb_device_handle** handle,
std::mutex& handleMutex,
std::atomic<sint32>& handleInUseCounter,
std::condition_variable& handleInUseCounterDecremented,
DeviceLibusb& device);
~HandleLock();
HandleLock(const HandleLock&) = delete;
HandleLock& operator=(const HandleLock&) = delete;
bool IsValid();
libusb_device_handle* GetHandle();
private:
libusb_device_handle* m_handle;
std::mutex& m_handleMutex;
std::atomic<sint32>& m_handleInUseCounter;
std::condition_variable& m_handleInUseCounterDecremented;
};
std::unique_ptr<HandleLock> AquireHandleLock();
};
} // namespace nsyshid::backend::libusb
#endif // NSYSHID_ENABLE_BACKEND_LIBUSB
#endif // CEMU_NSYSHID_BACKEND_LIBUSB_H
| 3,597
|
C++
|
.h
| 100
| 31.57
| 88
| 0.756436
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,599
|
BackendEmulated.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/BackendEmulated.h
|
#include "nsyshid.h"
#include "Backend.h"
namespace nsyshid::backend::emulated
{
class BackendEmulated : public nsyshid::Backend {
public:
BackendEmulated();
~BackendEmulated();
bool IsInitialisedOk() override;
protected:
void AttachVisibleDevices() override;
};
} // namespace nsyshid::backend::emulated
| 324
|
C++
|
.h
| 13
| 22.461538
| 50
| 0.766234
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,600
|
Skylander.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/Skylander.h
|
#pragma once
#include <mutex>
#include "nsyshid.h"
#include "Backend.h"
#include "Common/FileStream.h"
namespace nsyshid
{
class SkylanderPortalDevice final : public Device {
public:
SkylanderPortalDevice();
~SkylanderPortalDevice() = default;
bool Open() override;
void Close() override;
bool IsOpened() override;
ReadResult Read(ReadMessage* message) override;
WriteResult Write(WriteMessage* message) override;
bool GetDescriptor(uint8 descType,
uint8 descIndex,
uint8 lang,
uint8* output,
uint32 outputMaxLength) override;
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
bool SetReport(ReportMessage* message) override;
private:
bool m_IsOpened;
};
constexpr uint16 SKY_BLOCK_COUNT = 0x40;
constexpr uint16 SKY_BLOCK_SIZE = 0x10;
constexpr uint16 SKY_FIGURE_SIZE = SKY_BLOCK_COUNT * SKY_BLOCK_SIZE;
constexpr uint8 MAX_SKYLANDERS = 16;
class SkylanderUSB {
public:
struct Skylander final
{
std::unique_ptr<FileStream> skyFile;
uint8 status = 0;
std::queue<uint8> queuedStatus;
std::array<uint8, SKY_FIGURE_SIZE> data{};
uint32 lastId = 0;
void Save();
enum : uint8
{
REMOVED = 0,
READY = 1,
REMOVING = 2,
ADDED = 3
};
};
struct SkylanderLEDColor final
{
uint8 red = 0;
uint8 green = 0;
uint8 blue = 0;
};
void ControlTransfer(uint8* buf, sint32 originalLength);
void Activate();
void Deactivate();
void SetLeds(uint8 side, uint8 r, uint8 g, uint8 b);
std::array<uint8, 64> GetStatus();
void QueryBlock(uint8 skyNum, uint8 block, uint8* replyBuf);
void WriteBlock(uint8 skyNum, uint8 block, const uint8* toWriteBuf,
uint8* replyBuf);
uint8 LoadSkylander(uint8* buf, std::unique_ptr<FileStream> file);
bool RemoveSkylander(uint8 skyNum);
bool CreateSkylander(fs::path pathName, uint16 skyId, uint16 skyVar);
uint16 SkylanderCRC16(uint16 initValue, const uint8* buffer, uint32 size);
static std::map<const std::pair<const uint16, const uint16>, const char*> GetListSkylanders();
std::string FindSkylander(uint16 skyId, uint16 skyVar);
protected:
std::mutex m_skyMutex;
std::mutex m_queryMutex;
std::array<Skylander, MAX_SKYLANDERS> m_skylanders;
private:
std::queue<std::array<uint8, 64>> m_queries;
bool m_activated = true;
uint8 m_interruptCounter = 0;
SkylanderLEDColor m_colorRight = {};
SkylanderLEDColor m_colorLeft = {};
SkylanderLEDColor m_colorTrap = {};
};
extern SkylanderUSB g_skyportal;
} // namespace nsyshid
| 2,552
|
C++
|
.h
| 82
| 27.463415
| 96
| 0.729984
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,601
|
Infinity.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/Infinity.h
|
#pragma once
#include <mutex>
#include "nsyshid.h"
#include "Backend.h"
#include "Common/FileStream.h"
namespace nsyshid
{
class InfinityBaseDevice final : public Device {
public:
InfinityBaseDevice();
~InfinityBaseDevice() = default;
bool Open() override;
void Close() override;
bool IsOpened() override;
ReadResult Read(ReadMessage* message) override;
WriteResult Write(WriteMessage* message) override;
bool GetDescriptor(uint8 descType,
uint8 descIndex,
uint8 lang,
uint8* output,
uint32 outputMaxLength) override;
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
bool SetReport(ReportMessage* message) override;
private:
bool m_IsOpened;
};
constexpr uint16 INF_BLOCK_COUNT = 0x14;
constexpr uint16 INF_BLOCK_SIZE = 0x10;
constexpr uint16 INF_FIGURE_SIZE = INF_BLOCK_COUNT * INF_BLOCK_SIZE;
constexpr uint8 MAX_FIGURES = 9;
class InfinityUSB {
public:
struct InfinityFigure final
{
std::unique_ptr<FileStream> infFile;
std::array<uint8, INF_FIGURE_SIZE> data{};
bool present = false;
uint8 orderAdded = 255;
void Save();
};
void SendCommand(uint8* buf, sint32 originalLength);
std::array<uint8, 32> GetStatus();
void GetBlankResponse(uint8 sequence, std::array<uint8, 32>& replyBuf);
void DescrambleAndSeed(uint8* buf, uint8 sequence,
std::array<uint8, 32>& replyBuf);
void GetNextAndScramble(uint8 sequence, std::array<uint8, 32>& replyBuf);
void GetPresentFigures(uint8 sequence, std::array<uint8, 32>& replyBuf);
void QueryBlock(uint8 figNum, uint8 block, std::array<uint8, 32>& replyBuf,
uint8 sequence);
void WriteBlock(uint8 figNum, uint8 block, const uint8* toWriteBuf,
std::array<uint8, 32>& replyBuf, uint8 sequence);
void GetFigureIdentifier(uint8 figNum, uint8 sequence,
std::array<uint8, 32>& replyBuf);
bool RemoveFigure(uint8 position);
uint32 LoadFigure(const std::array<uint8, INF_FIGURE_SIZE>& buf,
std::unique_ptr<FileStream>, uint8 position);
bool CreateFigure(fs::path pathName, uint32 figureNum, uint8 series);
static std::map<const uint32, const std::pair<const uint8, const char*>> GetFigureList();
std::pair<uint8, std::string> FindFigure(uint32 figNum);
protected:
std::shared_mutex m_infinityMutex;
std::array<InfinityFigure, 9> m_figures;
private:
uint8 GenerateChecksum(const std::array<uint8, 32>& data,
int numOfBytes) const;
uint32 Descramble(uint64 numToDescramble);
uint64 Scramble(uint32 numToScramble, uint32 garbage);
void GenerateSeed(uint32 seed);
uint32 GetNext();
InfinityFigure& GetFigureByOrder(uint8 orderAdded);
uint8 DeriveFigurePosition(uint8 position);
std::array<uint8, 16> GenerateInfinityFigureKey(const std::vector<uint8>& sha1Data);
std::array<uint8, 16> GenerateBlankFigureData(uint32 figureNum, uint8 series);
uint32 m_randomA;
uint32 m_randomB;
uint32 m_randomC;
uint32 m_randomD;
uint8 m_figureOrder = 0;
std::queue<std::array<uint8, 32>> m_figureAddedRemovedResponses;
std::queue<std::array<uint8, 32>> m_queries;
};
extern InfinityUSB g_infinitybase;
} // namespace nsyshid
| 3,182
|
C++
|
.h
| 83
| 34.481928
| 91
| 0.746914
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,602
|
nsyshid.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/nsyshid.h
|
#pragma once
namespace nsyshid
{
class Backend;
void AttachBackend(const std::shared_ptr<Backend>& backend);
void DetachBackend(const std::shared_ptr<Backend>& backend);
void load();
} // namespace nsyshid
| 214
|
C++
|
.h
| 8
| 24.75
| 61
| 0.782178
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,603
|
BackendWindowsHID.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nsyshid/BackendWindowsHID.h
|
#ifndef CEMU_NSYSHID_BACKEND_WINDOWS_HID_H
#define CEMU_NSYSHID_BACKEND_WINDOWS_HID_H
#include "nsyshid.h"
#if NSYSHID_ENABLE_BACKEND_WINDOWS_HID
#include "Backend.h"
namespace nsyshid::backend::windows
{
class BackendWindowsHID : public nsyshid::Backend {
public:
BackendWindowsHID();
~BackendWindowsHID();
bool IsInitialisedOk() override;
protected:
void AttachVisibleDevices() override;
private:
std::shared_ptr<Device> CheckAndCreateDevice(wchar_t* devicePath, HANDLE hDevice);
};
class DeviceWindowsHID : public nsyshid::Device {
public:
DeviceWindowsHID(uint16 vendorId,
uint16 productId,
uint8 interfaceIndex,
uint8 interfaceSubClass,
uint8 protocol,
wchar_t* devicePath);
~DeviceWindowsHID();
bool Open() override;
void Close() override;
bool IsOpened() override;
ReadResult Read(ReadMessage* message) override;
WriteResult Write(WriteMessage* message) override;
bool GetDescriptor(uint8 descType, uint8 descIndex, uint8 lang, uint8* output, uint32 outputMaxLength) override;
bool SetProtocol(uint8 ifIndex, uint8 protocol) override;
bool SetReport(ReportMessage* message) override;
private:
wchar_t* m_devicePath;
HANDLE m_hFile;
};
HANDLE OpenDevice(wchar_t* devicePath);
void _debugPrintHex(std::string prefix, uint8* data, size_t len);
} // namespace nsyshid::backend::windows
#endif // NSYSHID_ENABLE_BACKEND_WINDOWS_HID
#endif // CEMU_NSYSHID_BACKEND_WINDOWS_HID_H
| 1,492
|
C++
|
.h
| 43
| 31.069767
| 114
| 0.769285
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,604
|
nn_nfp.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_nfp/nn_nfp.h
|
#pragma once
namespace nn::nfp
{
uint32 NFCGetTagInfo(uint32 index, uint32 timeout, MPTR functionPtr, void* userParam);
void load();
}
void nnNfp_load();
void nnNfp_update();
bool nnNfp_isInitialized();
bool nnNfp_touchNfcTagFromFile(const fs::path& filePath, uint32* nfcError);
#define NFP_STATE_NONE (0)
#define NFP_STATE_INIT (1)
#define NFP_STATE_RW_SEARCH (2)
#define NFP_STATE_RW_ACTIVE (3)
#define NFP_STATE_RW_DEACTIVE (4)
#define NFP_STATE_RW_MOUNT (5)
#define NFP_STATE_UNEXPECTED (6)
#define NFP_STATE_RW_MOUNT_ROM (7)
| 544
|
C++
|
.h
| 18
| 28.833333
| 87
| 0.758157
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,605
|
AmiiboCrypto.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h
|
#pragma once
#include "util/crypto/aes128.h"
#include "openssl/evp.h"
#include "openssl/hmac.h"
typedef struct
{
char typeString[14];
uint8 magicBytes[16];
uint8 magicBytesLen;
uint8 xorPad[32];
uint8 hmacKey[16];
}amiiboInternalKeys_t;
void amiiboCalcSeed(AmiiboInternal* internalData, uint8* seed)
{
memcpy(seed + 0x00, (uint8*)internalData + 0x029, 0x02);
memset(seed + 0x02, 0x00, 0x0E);
memcpy(seed + 0x10, (uint8*)internalData + 0x1D4, 0x08);
memcpy(seed + 0x18, (uint8*)internalData + 0x1D4, 0x08);
memcpy(seed + 0x20, (uint8*)internalData + 0x1E8, 0x20);
}
void amiiboGenKeyInternalPrepare(amiiboInternalKeys_t* keys, uint8* seed, uint8* output, sint32& outputLen)
{
sint32 index = 0;
// concat:
// typeString (including '\0')
sint32 typeStringLen = (sint32)strlen(keys->typeString)+1;
memcpy(output + index, keys->typeString, typeStringLen);
index += typeStringLen;
// seed (16 - magic byte len)
sint32 seedPart1Len = 16 - keys->magicBytesLen;
memcpy(output + index, seed, seedPart1Len);
index += seedPart1Len;
// magic bytes + 16 bytes at +0x10 from input seed
memcpy(output + index, keys->magicBytes, keys->magicBytesLen);
index += keys->magicBytesLen;
// seed 16 bytes at +0x10
memcpy(output + index, seed + 0x10, 16);
index += 16;
// 32 bytes at +0x20 from input seed xored with xor pad
for (sint32 i = 0; i < 32; i++)
output[index + i] = seed[i + 32] ^ keys->xorPad[i];
index += 32;
outputLen = index;
}
typedef struct
{
uint8 hmacKey[16];
uint8 buffer[sizeof(uint16) + 480];
sint32 bufferSize;
uint16 counter;
}amiiboCryptCtx_t;
typedef struct
{
uint8 raw[32];
}drgbOutput32_t;
void amiiboCryptInit(amiiboCryptCtx_t* ctx, const uint8* hmacKey, size_t hmacKeySize, const uint8* seed, sint32 seedSize)
{
ctx->counter = 0;
ctx->bufferSize = (sint32)sizeof(ctx->counter) + seedSize;
memcpy(ctx->hmacKey, hmacKey, 16);
// set static part of buffer
memcpy(ctx->buffer + sizeof(uint16), seed, seedSize);
}
void amiiboCryptStep(amiiboCryptCtx_t* ctx, drgbOutput32_t* output)
{
// update counter
ctx->buffer[0] = ctx->counter >> 8;
ctx->buffer[1] = ctx->counter >> 0;
ctx->counter++;
// generate bytes
uint32 mdLen = (uint32)sizeof(drgbOutput32_t);
HMAC(EVP_sha256(), ctx->hmacKey, sizeof(ctx->hmacKey), (const unsigned char *)ctx->buffer, ctx->bufferSize, output->raw, &mdLen);
}
typedef struct
{
uint8 aesKey[16];
uint8 aesIV[16];
uint8 hmacKey[16];
}amiiboDerivedKeys_t;
static_assert(sizeof(amiiboDerivedKeys_t) == 0x30);
void amiiboCrypto_genKey(amiiboInternalKeys_t* keys, AmiiboInternal* internalData, amiiboDerivedKeys_t* derivedKeys)
{
// generate seed
uint8 seed[0x40];
amiiboCalcSeed(internalData, seed);
// generate internal seed
uint8 internalKey[512];
sint32 internalKeyLen = 0;
amiiboGenKeyInternalPrepare(keys, seed, internalKey, internalKeyLen);
// gen bytes for derived keys
drgbOutput32_t temp[2];
amiiboCryptCtx_t rngCtx;
amiiboCryptInit(&rngCtx, keys->hmacKey, sizeof(keys->hmacKey), internalKey, internalKeyLen);
amiiboCryptStep(&rngCtx, temp + 0);
amiiboCryptStep(&rngCtx, temp + 1);
memcpy(derivedKeys, temp, sizeof(amiiboDerivedKeys_t));
}
void amiiboCrypto_nfcFormatToInternal(AmiiboRawNFCData* nfcData, AmiiboInternal* internalData)
{
uint8* tag = (uint8*)nfcData;
uint8* intl = (uint8*)internalData;
memcpy(intl + 0x000, tag + 0x008, 0x008);
memcpy(intl + 0x008, tag + 0x080, 0x020); // tag hmac
memcpy(intl + 0x028, tag + 0x010, 0x024);
memcpy(intl + 0x04C, tag + 0x0A0, 0x168);
memcpy(intl + 0x1B4, tag + 0x034, 0x020); // data hmac
memcpy(intl + 0x1D4, tag + 0x000, 0x008);
memcpy(intl + 0x1DC, tag + 0x054, 0x02C);
}
void amiiboCrypto_internalToNfcFormat(AmiiboInternal* internalData, AmiiboRawNFCData* nfcData)
{
uint8* tag = (uint8*)nfcData;
uint8* intl = (uint8*)internalData;
memcpy(tag + 0x008, intl + 0x000, 0x008);
memcpy(tag + 0x080, intl + 0x008, 0x020); // tag hmac
memcpy(tag + 0x010, intl + 0x028, 0x024);
memcpy(tag + 0x0A0, intl + 0x04C, 0x168);
memcpy(tag + 0x034, intl + 0x1B4, 0x020); // data hmac
memcpy(tag + 0x000, intl + 0x1D4, 0x008);
memcpy(tag + 0x054, intl + 0x1DC, 0x02C);
}
void amiiboCrypto_transform(const amiiboDerivedKeys_t * keys, uint8 * in, uint8 * out)
{
uint8 nonce[16];
memcpy(nonce, keys->aesIV, sizeof(nonce));
AmiiboInternal internalCopy;
memcpy(&internalCopy, in, sizeof(internalCopy));
if (out != in)
memcpy(out, in, 0x188 + 0x2C);
AES128CTR_transform(out + 0x2C, 0x188, (uint8*)keys->aesKey, nonce);
memcpy(out + 0x000, ((uint8*)&internalCopy) + 0x000, 0x008);
memcpy(out + 0x028, ((uint8*)&internalCopy) + 0x028, 0x004);
memcpy(out + 0x1D4, ((uint8*)&internalCopy) + 0x1D4, 0x034);
}
void AES128_init();
void amiiboInitMasterKeys(amiiboInternalKeys_t& kData, amiiboInternalKeys_t& kTag)
{
uint8 dataKey_hmacKey[16] = { 0x1D, 0x16, 0x4B, 0x37, 0x5B, 0x72, 0xA5, 0x57, 0x28, 0xB9, 0x1D, 0x64, 0xB6, 0xA3, 0xC2, 0x05 };
uint8 dataKey_typeString[14] = { "unfixed infos" };
uint8 dataKey_magicBytesSize = 0x0E;
uint8 dataKey_magicBytes[14] = { 0xDB, 0x4B, 0x9E, 0x3F, 0x45, 0x27, 0x8F, 0x39, 0x7E, 0xFF, 0x9B, 0x4F, 0xB9, 0x93 };
uint8 dataKey_xorPad[32] = { 0x04, 0x49, 0x17, 0xDC, 0x76, 0xB4, 0x96, 0x40, 0xD6, 0xF8, 0x39, 0x39, 0x96, 0x0F, 0xAE, 0xD4, 0xEF, 0x39, 0x2F, 0xAA, 0xB2, 0x14, 0x28, 0xAA, 0x21, 0xFB, 0x54, 0xE5, 0x45, 0x05, 0x47, 0x66 };
uint8 tagKey_hmacKey[16] = { 0x7F, 0x75, 0x2D, 0x28, 0x73, 0xA2, 0x00, 0x17, 0xFE, 0xF8, 0x5C, 0x05, 0x75, 0x90, 0x4B, 0x6D };
uint8 tagKey_typeString[14] = { "locked secret" };
uint8 tagKey_magicBytesSize = 0x10;
uint8 tagKey_magicBytes[16] = { 0xFD, 0xC8, 0xA0, 0x76, 0x94, 0xB8, 0x9E, 0x4C, 0x47, 0xD3, 0x7D, 0xE8, 0xCE, 0x5C, 0x74, 0xC1 };
uint8 tagKey_xorPad[32] = { 0x04, 0x49, 0x17, 0xDC, 0x76, 0xB4, 0x96, 0x40, 0xD6, 0xF8, 0x39, 0x39, 0x96, 0x0F, 0xAE, 0xD4, 0xEF, 0x39, 0x2F, 0xAA, 0xB2, 0x14, 0x28, 0xAA, 0x21, 0xFB, 0x54, 0xE5, 0x45, 0x05, 0x47, 0x66 };
memcpy(kData.hmacKey, dataKey_hmacKey, 16);
memcpy(kData.typeString, dataKey_typeString, 13);
kData.magicBytesLen = dataKey_magicBytesSize;
memcpy(kData.magicBytes, dataKey_magicBytes, 14);
memcpy(kData.xorPad, dataKey_xorPad, 32);
memcpy(kTag.hmacKey, tagKey_hmacKey, 16);
memcpy(kTag.typeString, tagKey_typeString, 13);
kTag.magicBytesLen = tagKey_magicBytesSize;
memcpy(kTag.magicBytes, tagKey_magicBytes, 16);
memcpy(kTag.xorPad, tagKey_xorPad, 32);
}
void amiiboDecrypt()
{
amiiboInternalKeys_t kData{};
amiiboInternalKeys_t kTag{};
amiiboInitMasterKeys(kData, kTag);
amiiboDerivedKeys_t derivedKeysData{};
amiiboDerivedKeys_t derivedKeysTag{};
amiiboCrypto_nfcFormatToInternal(&nfp_data.amiiboNFCData, &nfp_data.amiiboInternal);
amiiboCrypto_genKey(&kData, &nfp_data.amiiboInternal, &derivedKeysData);
amiiboCrypto_genKey(&kTag, &nfp_data.amiiboInternal, &derivedKeysTag);
amiiboCrypto_transform(&derivedKeysData, (uint8*)&nfp_data.amiiboInternal, (uint8*)&nfp_data.amiiboInternal);
// generate tag hmac
uint32 mdLen = 32;
HMAC(EVP_sha256(), derivedKeysTag.hmacKey, 16, (((uint8*)&nfp_data.amiiboInternal) + 0x1D4), 0x34,
nfp_data.amiiboInternal.tagHMAC, &mdLen);
// generate data hmac
mdLen = 32;
HMAC(EVP_sha256(), derivedKeysData.hmacKey, 16, (((uint8*)&nfp_data.amiiboInternal) + 0x29), 0x1DF,
((uint8*)&nfp_data.amiiboInternal) + 0x8, &mdLen);
bool isValidTagHMAC = memcmp(nfp_data.amiiboNFCData.tagHMAC, nfp_data.amiiboInternal.tagHMAC, 32) == 0;
bool isValidDataHMAC = memcmp(nfp_data.amiiboNFCData.dataHMAC, nfp_data.amiiboInternal.dataHMAC, 32) == 0;
if (!isValidTagHMAC)
cemuLog_log(LogType::Force, "Decrypt amiibo has invalid tag HMAC");
if (!isValidDataHMAC)
cemuLog_log(LogType::Force, "Decrypt amiibo has invalid data HMAC");
nfp_data.hasInvalidHMAC = !isValidTagHMAC || !isValidDataHMAC;
}
void amiiboEncrypt(AmiiboRawNFCData* nfcOutput)
{
amiiboInternalKeys_t kData{};
amiiboInternalKeys_t kTag{};
amiiboInitMasterKeys(kData, kTag);
amiiboDerivedKeys_t derivedKeysData{};
amiiboDerivedKeys_t derivedKeysTag{};
// copy internal Amiibo data
AmiiboInternal internalCopy;
memcpy(&internalCopy, &nfp_data.amiiboInternal, sizeof(AmiiboInternal));
// gen key
amiiboCrypto_genKey(&kData, &internalCopy, &derivedKeysData);
amiiboCrypto_genKey(&kTag, &internalCopy, &derivedKeysTag);
// generate new HMACs
uint8 tagHMAC[32];
uint32 mdLen = 32;
HMAC(EVP_sha256(), derivedKeysTag.hmacKey, 16, (((uint8*)&internalCopy) + 0x1D4), 0x34,
tagHMAC, &mdLen);
mdLen = 32;
uint8 dataHMAC[32];
HMAC(EVP_sha256(), derivedKeysData.hmacKey, 16, (((uint8*)&internalCopy) + 0x29), 0x1DF,
dataHMAC, &mdLen);
memset(internalCopy.tagHMAC, 0, 32);
memset(internalCopy.dataHMAC, 0, 32);
// transform
amiiboCrypto_transform(&derivedKeysData, (uint8*)&internalCopy, (uint8*)&internalCopy);
// set HMACs
memcpy(internalCopy.tagHMAC, tagHMAC, 32);
memcpy(internalCopy.dataHMAC, dataHMAC, 32);
// convert back to nfc order
amiiboCrypto_internalToNfcFormat(&internalCopy, nfcOutput);
// restore NFC values that aren't part of the internal representation
memcpy(nfcOutput->dynamicLock, nfp_data.amiiboNFCData.dynamicLock, 4);
memcpy(nfcOutput->cfg0, nfp_data.amiiboNFCData.cfg0, 4);
memcpy(nfcOutput->cfg1, nfp_data.amiiboNFCData.cfg1, 4);
}
| 9,247
|
C++
|
.h
| 221
| 39.819005
| 223
| 0.743847
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,606
|
padscore.h
|
cemu-project_Cemu/src/Cafe/OS/libs/padscore/padscore.h
|
#pragma once
#include "util/math/vector3.h"
namespace padscore
{
void start();
void load();
}
constexpr int kWPADMaxControllers = 4;
constexpr int kKPADMaxControllers = 7;
#define WPAD_ERR_NONE 0
#define WPAD_ERR_NO_CONTROLLER -1
#define WPAD_ERR_BUSY -2
#define WPAD_ERR_INVALID -4
#define WPAD_PRESS_UNITS 4
#define WPAD_FMT_CORE 0
#define WPAD_FMT_CORE_ACC 1
#define WPAD_FMT_CORE_ACC_DPD 2
typedef struct
{
float x;
float y;
float z;
}padVec3D_t;
static_assert(sizeof(padVec3D_t) == 0xC);
typedef struct beVec3D
{
float32be x;
float32be y;
float32be z;
beVec3D() = default;
beVec3D(const Vector3<float>& v)
: x(v.x), y(v.y), z(v.z) {}
beVec3D(const float32be& x, const float32be& y, const float32be& z)
: x(x), y(y), z(z) {}
}beVec3D_t;
static_assert(sizeof(beVec3D_t) == 0xC);
typedef struct
{
float x;
float y;
}padVec2D_t;
static_assert(sizeof(padVec2D_t) == 0x8);
typedef struct
{
float32be x;
float32be y;
}beVec2D_t;
static_assert(sizeof(beVec2D_t) == 0x8);
union KPADEXStatus_t
{
struct
{
beVec2D_t stick;
beVec3D_t acc;
float32be accValue;
float32be accSpeed;
}fs;
struct
{
uint32be hold;
uint32be trig;
uint32be release;
beVec2D_t lstick;
beVec2D_t rstick;
float32be ltrigger;
float32be rtrigger;
}cl;
struct
{
uint32be hold;
uint32be trig;
uint32be release;
beVec2D_t lstick;
beVec2D_t rstick;
uint32be charge;
uint32be cable;
}uc;
struct
{
uint32be hold;
uint32be trig;
uint32be release;
}cm;
uint8 _padding[0x50];
};
static_assert(sizeof(KPADEXStatus_t) == 0x50);
struct KPADMPDir_t
{
padVec3D_t X;
padVec3D_t Y;
padVec3D_t Z;
};
static_assert(sizeof(KPADMPDir_t) == 0x24);
struct KPADMPStatus_t
{
padVec3D_t mpls;
padVec3D_t angle;
KPADMPDir_t dir;
};
static_assert(sizeof(KPADMPStatus_t) == 0x3C);
struct KPADStatus_t
{
uint32be hold;
uint32be trig;
uint32be release;
beVec3D_t acc;
float32be acc_value;
float32be acc_speed;
beVec2D_t pos;
beVec2D_t vec;
float32be speed;
beVec2D_t horizon;
beVec2D_t horiVec;
float32be horiSpeed;
float32be dist;
float32be distVec;
float32be distSpeed;
beVec2D_t accVertical;
uint8 devType;
sint8 wpadErr;
sint8 dpd_valid_fg;
uint8 data_format;
KPADEXStatus_t ex_status;
KPADMPStatus_t mpls;
uint8 _unused[4];
};
static_assert(sizeof(KPADStatus_t) == 0xF0);
#define WPAD_DPD_MAX_OBJECTS (4)
struct DPDObject_t
{
uint16be x;
uint16be y;
uint16be size;
uint8 traceId;
uint8 padding;
};
static_assert(sizeof(DPDObject_t) == 0x8);
struct WPADStatus_t
{
uint16be button;
uint16be accX;
uint16be accY;
uint16be accZ;
DPDObject_t obj[WPAD_DPD_MAX_OBJECTS];
uint8 dev;
sint8 err;
};
static_assert(sizeof(WPADStatus_t) == 0x2A);
struct WPADFSStatus_t : WPADStatus_t
{
uint16be fsAccX;
uint16be fsAccY;
uint16be fsAccZ;
sint8 fsStickX;
sint8 fsStickY;
};
struct WPADCLStatus_t : WPADStatus_t
{
uint16be clButton;
uint16be clLStickX;
uint16be clLStickY;
uint16be clRStickX;
uint16be clRStickY;
uint8 clTriggerL;
uint8 clTriggerR;
};
struct WPADUCStatus_t : WPADStatus_t
{
uint8 padding1[2]; // unsure
uint32be ucButton;
uint16be ucLStickX;
uint16be ucLStickY;
uint16be ucRStickX;
uint16be ucRStickY;
uint32be charge;
uint32be cable;
};
static_assert(sizeof(WPADUCStatus_t) == 0x40);
struct WPADTRStatus_t : WPADStatus_t
{
uint16 trButton;
uint8 brake;
uint8 mascon;
};
struct WPADBLStatus_t : WPADStatus_t
{
uint16be press[WPAD_PRESS_UNITS];
sint8 temp;
uint8 battery;
} ;
static_assert(sizeof(WPADBLStatus_t) == 0x34);
struct WPADMPStatus_t : WPADStatus_t
{
union
{
// for Nunchuk
struct
{
uint16be fsAccX;
uint16be fsAccY;
uint16be fsAccZ;
sint8 fsStickX;
sint8 fsStickY;
}fs;
// for Classic
struct
{
uint16be clButton;
uint16be clLStickX;
uint16be clLStickY;
uint16be clRStickX;
uint16be clRStickY;
uint8 clTriggerL;
uint8 clTriggerR;
}cl;
}status;
uint8 stat;
uint8 _ukn;
uint16be pitch;
uint16be yaw;
uint16be roll;
};
static_assert(sizeof(WPADMPStatus_t) == 0x3E);
typedef struct KPADUnifiedWpadStatus
{
union
{
WPADStatus_t core;
WPADFSStatus_t fs;
WPADCLStatus_t cl;
WPADTRStatus_t tr;
WPADBLStatus_t bl;
WPADMPStatus_t mp;
}u;
uint8 fmt;
uint8 padding;
uint32 _40; // padding?
}KPADUnifiedWpadStatus_t;
static_assert(sizeof(KPADUnifiedWpadStatus_t) == 0x44);
| 4,390
|
C++
|
.h
| 239
| 16.263598
| 68
| 0.757974
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,607
|
nn_idbe.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_idbe/nn_idbe.h
|
namespace nn
{
namespace idbe
{
void load();
}
}
| 54
|
C++
|
.h
| 7
| 6
| 15
| 0.680851
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,608
|
stream.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nfc/stream.h
|
#pragma once
#include <cstdint>
#include <vector>
#include <span>
#include <bit>
#include "Common/precompiled.h"
class Stream
{
public:
enum Error
{
ERROR_OK,
ERROR_READ_FAILED,
ERROR_WRITE_FAILED,
};
public:
Stream(std::endian endianness = std::endian::native);
virtual ~Stream();
Error GetError() const;
void SetEndianness(std::endian endianness);
std::endian GetEndianness() const;
virtual std::size_t Read(const std::span<std::byte>& data) = 0;
virtual std::size_t Write(const std::span<const std::byte>& data) = 0;
virtual bool SetPosition(std::size_t position) = 0;
virtual std::size_t GetPosition() const = 0;
virtual std::size_t GetRemaining() const = 0;
// Stream read operators
template<std::integral T>
Stream& operator>>(T& val)
{
val = 0;
if (Read(std::as_writable_bytes(std::span(std::addressof(val), 1))) == sizeof(val))
{
if (NeedsSwap())
{
if (sizeof(T) == 2)
{
val = _swapEndianU16(val);
}
else if (sizeof(T) == 4)
{
val = _swapEndianU32(val);
}
else if (sizeof(T) == 8)
{
val = _swapEndianU64(val);
}
}
}
return *this;
}
Stream& operator>>(bool& val);
Stream& operator>>(float& val);
Stream& operator>>(double& val);
// Stream write operators
template<std::integral T>
Stream& operator<<(T val)
{
if (NeedsSwap())
{
if (sizeof(T) == 2)
{
val = _swapEndianU16(val);
}
else if (sizeof(T) == 4)
{
val = _swapEndianU32(val);
}
else if (sizeof(T) == 8)
{
val = _swapEndianU64(val);
}
}
Write(std::as_bytes(std::span(std::addressof(val), 1)));
return *this;
}
Stream& operator<<(bool val);
Stream& operator<<(float val);
Stream& operator<<(double val);
protected:
void SetError(Error error);
bool NeedsSwap();
Error mError;
std::endian mEndianness;
};
class VectorStream : public Stream
{
public:
VectorStream(std::vector<std::byte>& vector, std::endian endianness = std::endian::native);
virtual ~VectorStream();
virtual std::size_t Read(const std::span<std::byte>& data) override;
virtual std::size_t Write(const std::span<const std::byte>& data) override;
virtual bool SetPosition(std::size_t position) override;
virtual std::size_t GetPosition() const override;
virtual std::size_t GetRemaining() const override;
private:
std::reference_wrapper<std::vector<std::byte>> mVector;
std::size_t mPosition;
};
class SpanStream : public Stream
{
public:
SpanStream(std::span<const std::byte> span, std::endian endianness = std::endian::native);
virtual ~SpanStream();
virtual std::size_t Read(const std::span<std::byte>& data) override;
virtual std::size_t Write(const std::span<const std::byte>& data) override;
virtual bool SetPosition(std::size_t position) override;
virtual std::size_t GetPosition() const override;
virtual std::size_t GetRemaining() const override;
private:
std::span<const std::byte> mSpan;
std::size_t mPosition;
};
| 2,952
|
C++
|
.h
| 113
| 23.336283
| 92
| 0.69321
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,609
|
TagV0.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nfc/TagV0.h
|
#pragma once
#include <memory>
#include <span>
#include <map>
#include "TLV.h"
class TagV0
{
public:
using Block = std::array<std::byte, 0x8>;
public:
TagV0();
virtual ~TagV0();
static std::shared_ptr<TagV0> FromBytes(const std::span<const std::byte>& data);
std::vector<std::byte> ToBytes() const;
const Block& GetUIDBlock() const;
const std::vector<std::byte>& GetNDEFData() const;
const std::vector<std::byte>& GetLockedArea() const;
void SetNDEFData(const std::span<const std::byte>& data);
private:
bool ParseLockedArea(const std::span<const std::byte>& data);
bool IsBlockLocked(uint8 blockIdx) const;
bool ParseDataArea(const std::span<const std::byte>& data, std::vector<std::byte>& dataArea);
bool ValidateCapabilityContainer();
std::map<uint8, Block> mLockedOrReservedBlocks;
std::map<uint8, Block> mLockedBlocks;
std::array<uint8, 0x4> mCapabilityContainer;
std::vector<TLV> mTLVs;
std::size_t mNdefTlvIdx;
std::vector<std::byte> mLockedArea;
};
| 985
|
C++
|
.h
| 30
| 30.9
| 94
| 0.751586
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,610
|
TLV.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nfc/TLV.h
|
#pragma once
#include <cstdint>
#include <span>
#include <vector>
class TLV
{
public:
enum Tag
{
TAG_NULL = 0x00,
TAG_LOCK_CTRL = 0x01,
TAG_MEM_CTRL = 0x02,
TAG_NDEF = 0x03,
TAG_PROPRIETARY = 0xFD,
TAG_TERMINATOR = 0xFE,
};
public:
TLV();
TLV(Tag tag, std::vector<std::byte> value);
virtual ~TLV();
static std::vector<TLV> FromBytes(const std::span<std::byte>& data);
std::vector<std::byte> ToBytes() const;
Tag GetTag() const;
const std::vector<std::byte>& GetValue() const;
void SetTag(Tag tag);
void SetValue(const std::span<const std::byte>& value);
private:
Tag mTag;
std::vector<std::byte> mValue;
};
| 660
|
C++
|
.h
| 30
| 19.9
| 69
| 0.678973
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,611
|
nfc.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nfc/nfc.h
|
#pragma once
// CEMU NFC error codes
#define NFC_TOUCH_TAG_ERROR_NONE (0)
#define NFC_TOUCH_TAG_ERROR_NO_ACCESS (1)
#define NFC_TOUCH_TAG_ERROR_INVALID_FILE_FORMAT (2)
// NFC result base
#define NFC_RESULT_BASE_INIT (-0x100)
#define NFC_RESULT_BASE_READ (-0x200)
#define NFC_RESULT_BASE_WRITE (-0x300)
#define NFC_RESULT_BASE_FORMAT (-0x400)
#define NFC_RESULT_BASE_SET_READ_ONLY (-0x500)
#define NFC_RESULT_BASE_IS_TAG_PRESENT (-0x600)
#define NFC_RESULT_BASE_ABORT (-0x700)
#define NFC_RESULT_BASE_SHUTDOWN (-0x800)
#define NFC_RESULT_BASE_DETECT (-0x900)
#define NFC_RESULT_BASE_SEND_RAW_DATA (-0xA00)
#define NFC_RESULT_BASE_SET_MODE (-0xB00)
#define NFC_RESULT_BASE_TAG_PARSE (-0xC00)
#define NFC_RESULT_BASE_GET_TAG_INFO (-0x1400)
// NFC result status
#define NFC_RESULT_NO_TAG (0x01)
#define NFC_RESULT_INVALID_TAG (0x02)
#define NFC_RESULT_UID_MISMATCH (0x0A)
#define NFC_RESULT_UNINITIALIZED (0x20)
#define NFC_RESULT_INVALID_STATE (0x21)
#define NFC_RESULT_INVALID_MODE (0x24)
#define NFC_RESULT_TAG_INFO_TIMEOUT (0x7A)
// Result macros
#define NFC_RESULT_SUCCESS (0)
#define NFC_RESULT_BASE_MASK (0xFFFFFF00)
#define NFC_RESULT_MASK (0x000000FF)
#define NFC_MAKE_RESULT(base, result) ((base) | (result))
#define NFC_PROTOCOL_T1T 0x1
#define NFC_PROTOCOL_T2T 0x2
#define NFC_TECHNOLOGY_A 0x0
#define NFC_TECHNOLOGY_B 0x1
#define NFC_TECHNOLOGY_F 0x2
namespace nfc
{
struct NFCUid
{
/* +0x00 */ uint8 uid[7];
};
static_assert(sizeof(NFCUid) == 0x7);
struct NFCTagInfo
{
/* +0x00 */ uint8 uidSize;
/* +0x01 */ uint8 uid[10];
/* +0x0B */ uint8 technology;
/* +0x0C */ uint8 protocol;
/* +0x0D */ uint8 reserved[0x20];
};
static_assert(sizeof(NFCTagInfo) == 0x2D);
sint32 NFCInit(uint32 chan);
sint32 NFCInitEx(uint32 chan, uint32 powerMode);
sint32 NFCShutdown(uint32 chan);
bool NFCIsInit(uint32 chan);
void NFCProc(uint32 chan);
sint32 NFCGetMode(uint32 chan);
sint32 NFCSetMode(uint32 chan, sint32 mode);
void NFCSetTagDetectCallback(uint32 chan, MPTR callback, void* context);
sint32 NFCGetTagInfo(uint32 chan, uint32 discoveryTimeout, MPTR callback, void* context);
sint32 NFCSendRawData(uint32 chan, bool startDiscovery, uint32 discoveryTimeout, uint32 commandTimeout, uint32 commandSize, uint32 responseSize, void* commandData, MPTR callback, void* context);
sint32 NFCAbort(uint32 chan, MPTR callback, void* context);
sint32 NFCRead(uint32 chan, uint32 discoveryTimeout, NFCUid* uid, NFCUid* uidMask, MPTR callback, void* context);
sint32 NFCWrite(uint32 chan, uint32 discoveryTimeout, NFCUid* uid, NFCUid* uidMask, uint32 size, void* data, MPTR callback, void* context);
void Initialize();
bool TouchTagFromFile(const fs::path& filePath, uint32* nfcError);
}
| 2,752
|
C++
|
.h
| 69
| 38.043478
| 195
| 0.762406
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,612
|
ndef.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nfc/ndef.h
|
#pragma once
#include <span>
#include <vector>
#include <optional>
#include "stream.h"
namespace ndef
{
class Record
{
public:
enum HeaderFlag
{
NDEF_IL = 0x08,
NDEF_SR = 0x10,
NDEF_CF = 0x20,
NDEF_ME = 0x40,
NDEF_MB = 0x80,
NDEF_TNF_MASK = 0x07,
};
enum TypeNameFormat
{
NDEF_TNF_EMPTY = 0,
NDEF_TNF_WKT = 1,
NDEF_TNF_MEDIA = 2,
NDEF_TNF_URI = 3,
NDEF_TNF_EXT = 4,
NDEF_TNF_UNKNOWN = 5,
NDEF_TNF_UNCHANGED = 6,
NDEF_TNF_RESERVED = 7,
};
public:
Record();
virtual ~Record();
static std::optional<Record> FromStream(Stream& stream);
std::vector<std::byte> ToBytes(uint8 flags = 0) const;
TypeNameFormat GetTNF() const;
const std::vector<std::byte>& GetID() const;
const std::vector<std::byte>& GetType() const;
const std::vector<std::byte>& GetPayload() const;
void SetTNF(TypeNameFormat tnf);
void SetID(const std::span<const std::byte>& id);
void SetType(const std::span<const std::byte>& type);
void SetPayload(const std::span<const std::byte>& payload);
bool IsLast() const;
bool IsShort() const;
private:
uint8 mFlags;
TypeNameFormat mTNF;
std::vector<std::byte> mID;
std::vector<std::byte> mType;
std::vector<std::byte> mPayload;
};
class Message
{
public:
Message();
virtual ~Message();
static std::optional<Message> FromBytes(const std::span<const std::byte>& data);
std::vector<std::byte> ToBytes() const;
Record& operator[](int i) { return mRecords[i]; }
const Record& operator[](int i) const { return mRecords[i]; }
void append(const Record& r);
auto begin() { return mRecords.begin(); }
auto end() { return mRecords.end(); }
auto begin() const { return mRecords.begin(); }
auto end() const { return mRecords.end(); }
private:
std::vector<Record> mRecords;
};
} // namespace ndef
| 1,914
|
C++
|
.h
| 70
| 24.271429
| 82
| 0.652245
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,613
|
nn_aoc.h
|
cemu-project_Cemu/src/Cafe/OS/libs/nn_aoc/nn_aoc.h
|
namespace nn
{
namespace aoc
{
void Initialize();
}
}
| 58
|
C++
|
.h
| 7
| 6.714286
| 20
| 0.711538
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,614
|
ax_internal.h
|
cemu-project_Cemu/src/Cafe/OS/libs/snd_core/ax_internal.h
|
#pragma once
#include "Cafe/OS/libs/snd_core/ax.h"
namespace snd_core
{
typedef struct
{
bool isInitialized;
bool isSoundCore2;
// init params
struct
{
uint32 rendererFreq; // 32Khz or 48Khz
uint32 frameLength; // 3MS
uint32 pipelineMode;
}initParam;
}sndGeneric_t;
extern sndGeneric_t sndGeneric;
const uint32 AX_SYNCFLAG_SRCFILTER = 0x1; // Voice src type (AXSetVoiceSrcType)
const uint32 AX_SYNCFLAG_DEVICEMIXMASK = 0x2; // Voice mix related (AXSetVoiceDeviceMix)
const uint32 AX_SYNCFLAG_PLAYBACKSTATE = 0x4; // Voice play state (AXSetVoiceState)
const uint32 AX_SYNCFLAG_VOICETYPE = 0x8; // Voice type (AXSetVoiceType)
const uint32 AX_SYNCFLAG_DEVICEMIX = 0x10; // Voice mix related (AXSetVoiceDeviceMix)
const uint32 AX_SYNCFLAG_ITD20 = 0x20; // Voice initial time delay (AXSetVoiceItdOn)
const uint32 AX_SYNCFLAG_ITD40 = 0x40; // Voice initial time delay (AXSetVoiceItdOn, AXSetVoiceItdTarget)
const uint32 AX_SYNCFLAG_VE = 0x100; // Voice ve (AXSetVoiceVe)
const uint32 AX_SYNCFLAG_VEDELTA = 0x200; // Voice ve delta (AXSetVoiceVeDelta)
const uint32 AX_SYNCFLAG_OFFSETS = 0x400; // Voice offset data (AXSetVoiceOffsets)
const uint32 AX_SYNCFLAG_LOOPFLAG = 0x800; // Voice loop flag (AXSetVoiceLoop)
const uint32 AX_SYNCFLAG_LOOPOFFSET = 0x1000; // Voice loop offset (AXSetVoiceLoopOffset)
const uint32 AX_SYNCFLAG_ENDOFFSET = 0x2000; // Voice end offset (AXSetVoiceEndOffset)
const uint32 AX_SYNCFLAG_CURRENTOFFSET = 0x4000; // Voice current offset (AXSetVoiceCurrentOffset)
const uint32 AX_SYNCFLAG_ADPCMDATA = 0x8000; // Voice adpcm data (AXSetVoiceAdpcm)
const uint32 AX_SYNCFLAG_SRCDATA = 0x10000; // Voice src + src ratio (AXSetVoiceSrc)
const uint32 AX_SYNCFLAG_SRCRATIO = 0x20000; // Voice src ratio (AXSetVoiceSrcRatio)
const uint32 AX_SYNCFLAG_ADPCMLOOP = 0x40000; // Voice adpcm loop (AXSetVoiceAdpcmLoop)
const uint32 AX_SYNCFLAG_LPFDATA = 0x80000; // Voice lpf (AXSetVoiceLpf)
const uint32 AX_SYNCFLAG_LPFCOEF = 0x100000; // Voice lpf coef (AXSetVoiceLpfCoefs)
const uint32 AX_SYNCFLAG_BIQUADDATA = 0x200000; // Voice biquad (AXSetVoiceBiquad)
const uint32 AX_SYNCFLAG_BIQUADCOEF = 0x400000; // Voice biquad coef (AXSetVoiceBiquadCoefs)
const uint32 AX_SYNCFLAG_VOICEREMOTEON = 0x800000; // ??? (AXSetVoiceRmtOn?)
const uint32 AX_SYNCFLAG_4000000 = 0x4000000; // ???
const uint32 AX_SYNCFLAG_8000000 = 0x8000000; // ???
struct axADPCMInternal_t
{
/* +0x00 | +0x190 */ uint16 coef[16];
/* +0x20 | +0x1B0 */ uint16 gain;
/* +0x22 | +0x1B2 */ uint16 scale;
/* +0x24 | +0x1B4 */ uint16 yn1;
/* +0x26 | +0x1B6 */ uint16 yn2;
// size: 0x28
};
struct axADPCMLoopInternal_t
{
/* +0x00 | 0x1C6 */ uint16 loopScale;
/* +0x02 | 0x1C8 */ uint16 loopYn1;
/* +0x04 | 0x1CA */ uint16 loopYn2;
// size: 0x6
};
struct axOffsetsInternal_t
{
/* +0x00 / 0x17E */ uint16 loopFlag;
/* +0x02 / 0x180 */ uint16 format;
/* +0x04 / 0x182 */ uint16 ptrHighExtension; // defines 512mb range (highest 3 bit of current offset ptr counted in bytes)
// offsets (relative to NULL, counted in sample words)
// note: All offset ptr variables can only store values up to 512MB (PCM8 mask -> 0x1FFFFFFF, PCM16 mask -> 0x0FFFFFFF, ADPCM mask -> 0x3FFFFFFF)
/* +0x06 / 0x184 */ uint16 loopOffsetPtrHigh;
/* +0x08 / 0x186 */ uint16 loopOffsetPtrLow;
/* +0x0A / 0x188 */ uint16 endOffsetPtrHigh;
/* +0x0C / 0x18A */ uint16 endOffsetPtrLow;
/* +0x0E / 0x18C */ uint16 currentOffsetPtrHigh;
/* +0x10 / 0x18E */ uint16 currentOffsetPtrLow;
uint32 GetLoopOffset32() const
{
uint32 offset = (uint32)_swapEndianU16(loopOffsetPtrHigh) << 16;
return offset | (uint32)_swapEndianU16(loopOffsetPtrLow);
}
uint32 GetEndOffset32() const
{
uint32 offset = (uint32)_swapEndianU16(endOffsetPtrHigh) << 16;
return offset | (uint32)_swapEndianU16(endOffsetPtrLow);
}
uint32 GetCurrentOffset32() const
{
uint32 offset = (uint32)_swapEndianU16(currentOffsetPtrHigh) << 16;
return offset | (uint32)_swapEndianU16(currentOffsetPtrLow);
}
};
const int AX_BUS_COUNT = 4;
struct AXVPBInternal_t
{
/* matches what the DSP expects */
/* +0x000 */ uint16be nextAddrHigh; // points to next shadow copy (physical pointer, NULL for last voice in list)
/* +0x002 */ uint16be nextAddrLow;
/* +0x004 */ uint16be selfAddrHigh; // points to shadow copy of self (physical pointer)
/* +0x006 */ uint16be selfAddrLow;
/* +0x008 */ uint16 srcFilterMode; // AX_FILTER_MODE_*
/* +0x00A */ uint16 srcTapFilter; // AX_FILTER_TAP_*
/* +0x00C */ uint16be mixerSelect;
/* +0x00E */ uint16 voiceType;
/* +0x010 */ uint16 deviceMixMaskTV[4];
/* +0x018 */ uint16 deviceMixMaskDRC[4 * 2];
/* +0x028 */ AXCHMIX_DEPR deviceMixTV[AX_BUS_COUNT * AX_TV_CHANNEL_COUNT]; // TV device mix
/* +0x088 */ AXCHMIX_DEPR deviceMixDRC[AX_BUS_COUNT * AX_DRC_CHANNEL_COUNT * 2]; // DRC device mix
/* +0x108 */ AXCHMIX_DEPR deviceMixRMT[0x40 / 4]; // RMT device mix (size unknown)
/* +0x148 */ uint16 reserved148_voiceRmtOn;
/* +0x14A */ uint16 deviceMixMaskRMT[0x10];
/* +0x16A */ uint16 playbackState;
// itd (0x16C - 0x1B4?)
/* +0x16C */ uint16 reserved16C;
/* +0x16E */ uint16be itdAddrHigh; // points to AXItd_t (physical pointer)
/* +0x170 */ uint16be itdAddrLow;
/* +0x172 */ uint16 reserved172;
/* +0x174 */ uint16 reserved174;
/* +0x176 */ uint16 reserved176_itdRelated;
/* +0x178 */ uint16 reserved178_itdRelated;
/* +0x17A */ uint16be veVolume;
/* +0x17C */ uint16be veDelta;
/* +0x17E */ axOffsetsInternal_t internalOffsets;
/* +0x190 */ axADPCMInternal_t adpcmData;
/* +0x1B8 */ AXPBSRC_t src;
/* +0x1C6 */ axADPCMLoopInternal_t adpcmLoop;
struct
{
/* +0x1CC */ uint16 on;
/* +0x1CE */ uint16 yn1;
/* +0x1D0 */ uint16 a0;
/* +0x1D2 */ uint16 b0;
}lpf;
struct
{
/* +0x1D4 */ uint16 on;
/* +0x1D6 */ sint16 xn1;
/* +0x1D8 */ sint16 xn2;
/* +0x1DA */ sint16 yn1;
/* +0x1DC */ sint16 yn2;
/* +0x1DE */ uint16 b0;
/* +0x1E0 */ uint16 b1;
/* +0x1E2 */ uint16 b2;
/* +0x1E4 */ uint16 a1;
/* +0x1E6 */ uint16 a2;
}biquad;
uint16 reserved1E8[0x18];
uint16 reserved218[0x20]; // not related to device mix?
uint16 reserved258[0x10]; // not related to device mix?
// rmt src related
uint16 reserved278;
uint16 reserved27A;
uint16 reserved27C;
uint16 reserved27E;
uint16 reserved280;
uint16 reserved282_rmtIIRGuessed;
uint32 reserved284;
uint32 reserved288;
uint32 reserved28C;
uint32 reserved290;
uint16 reserved294;
uint16 reserved296;
/* +0x298 */ uint16 reserved298;
/* +0x29A */ uint16 reserved29A;
/* +0x29C */ uint16 reserved29C;
/* +0x29E */ uint16 reserved29E;
/* +0x2A0 */ uint16be index;
/* +0x2A2 */ uint16be ukn2A2; // voice active/valid and being processed?
uint16 reserved2A4;
uint16 reserved2A6;
uint16 reserved2A8;
uint16 reserved2AA;
/* +0x2AC */ MEMPTR<AXVPBInternal_t> nextToProcess;
uint32 reserved2B0;
uint32 reserved2B4;
uint32 reserved2B8;
uint32 reserved2BC;
// size: 0x2C0
};
static_assert(sizeof(AXVPBInternal_t) == 0x2C0);
extern AXVPBInternal_t* __AXVPBInternalVoiceArray;
extern AXVPBInternal_t* __AXVPBInternalVoiceShadowCopyArrayPtr;
extern AXVPB* __AXVPBArrayPtr;
void AXResetVoiceLoopCount(AXVPB* vpb);
std::vector<AXVPB*>& AXVoiceList_GetListByPriority(uint32 priority);
std::vector<AXVPB*>& AXVoiceList_GetFreeVoices();
inline AXVPBInternal_t* GetInternalVoice(const AXVPB* vpb)
{
return __AXVPBInternalVoiceArray + (size_t)vpb->index;
}
inline uint32 GetVoiceIndex(const AXVPB* vpb)
{
return (uint32)vpb->index;
}
void AXVBP_Reset();
// AXIst
void AXIst_InitThread();
OSThread_t* AXIst_GetThread();
void AXIst_StopThread();
void AXIst_HandleFrameCallbacks();
// AXAux
void AXAux_incrementBufferIndex();
// internal mix buffers
extern SysAllocator<sint32, AX_SAMPLES_MAX * AX_TV_CHANNEL_COUNT> __AXTVOutputBuffer;
extern SysAllocator<sint32, AX_SAMPLES_MAX * AX_DRC_CHANNEL_COUNT * 2> __AXDRCOutputBuffer;
}
| 8,091
|
C++
|
.h
| 201
| 37.393035
| 147
| 0.715048
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,615
|
ax.h
|
cemu-project_Cemu/src/Cafe/OS/libs/snd_core/ax.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit.h" // for OSThread*
#include "util/helpers/fspinlock.h"
struct PPCInterpreter_t;
namespace snd_core
{
// sndcore2 - AX init param config
const int AX_RENDERER_FREQ_32KHZ = 0;
const int AX_RENDERER_FREQ_48KHZ = 1;
const int AX_FRAMELENGTH_3MS = 0;
const int AX_SAMPLES_PER_3MS_48KHZ = (144); // 48000*3/1000
const int AX_SAMPLES_PER_3MS_32KHZ = (96); // 32000*3/1000
const int AX_SAMPLES_MAX = AX_SAMPLES_PER_3MS_48KHZ; // the maximum amount of samples in a single frame
const int AX_DEV_TV = 0;
const int AX_DEV_DRC = 1;
const int AX_DEV_RMT = 2;
const int AX_DEV_COUNT = 3;
const int AX_UPSAMPLE_STAGE_BEFORE_FINALMIX = 0;
const int AX_UPSAMPLE_STAGE_AFTER_FINALMIX = 1;
const int AX_PIPELINE_SINGLE = 0;
struct AXINITPARAM
{
uint32be freq; // AX_RENDERER_FREQ_*
uint32be frameLength; // AX_FRAMELENGTH_*
uint32be pipelineMode; // AX_PIPELINE_*
};
// maximum number of supported channels per device
const int AX_TV_CHANNEL_COUNT = 6;
const int AX_DRC_CHANNEL_COUNT = 4;
const int AX_RMT_CHANNEL_COUNT = 1;
const int AX_APP_FRAME_CALLBACK_MAX = 64;
const int AX_MODE_STEREO = 0;
const int AX_MODE_SURROUND = 1;
const int AX_MODE_DPL2 = 2;
const int AX_MODE_6CH = 3;
const int AX_MODE_MONO = 5;
const int AX_PRIORITY_MAX = 32;
const int AX_PRIORITY_FREE = 0;
const int AX_PRIORITY_NODROP = 31;
const int AX_PRIORITY_LOWEST = 1;
const int AX_MAX_VOICES = 96;
const int AX_AUX_BUS_COUNT = 3;
const int AX_MAX_NUM_BUS = 4;
const int AX_FORMAT_ADPCM = 0x0;
const int AX_FORMAT_PCM16 = 0xA;
const int AX_FORMAT_PCM8 = 0x19;
const int AX_LPF_OFF = 0x0;
const int AX_BIQUAD_OFF = 0x0;
const int AX_SRC_TYPE_NONE = 0x0;
const int AX_SRC_TYPE_LINEAR = 0x1;
const int AX_SRC_TYPE_LOWPASS1 = 0x2;
const int AX_SRC_TYPE_LOWPASS2 = 0x3;
const int AX_SRC_TYPE_LOWPASS3 = 0x4;
const int AX_FILTER_MODE_TAP = 0x0;
const int AX_FILTER_MODE_LINEAR = 0x1;
const int AX_FILTER_MODE_NONE = 0x2;
const int AX_FILTER_LOWPASS_8K = 0x0;
const int AX_FILTER_LOWPASS_12K = 0x1;
const int AX_FILTER_LOWPASS_16K = 0x2;
void loadExports();
bool isInitialized();
void reset();
// AX VPB
struct AXAUXCBCHANNELINFO
{
/* +0x00 */ uint32be numChannels;
/* +0x04 */ uint32be numSamples;
};
struct AXPBOFFSET_t
{
/* +0x00 | +0x34 */ uint16 format;
/* +0x02 | +0x36 */ uint16 loopFlag;
/* +0x04 | +0x38 */ uint32 loopOffset;
/* +0x08 | +0x3C */ uint32 endOffset;
/* +0x0C | +0x40 */ uint32 currentOffset;
/* +0x10 | +0x44 */ MPTR samples;
};
struct AXPBVE
{
uint16be currentVolume;
sint16be currentDelta;
};
struct AXVPBItd
{
uint8 ukn[64];
};
struct AXVPB
{
/* +0x00 */ uint32be index;
/* +0x04 */ uint32be playbackState;
/* +0x08 */ uint32be ukn08;
/* +0x0C */ uint32be mixerSelect;
/* +0x10 */ MEMPTR<AXVPB> next;
/* +0x14 */ MEMPTR<AXVPB> prev;
/* +0x18 */ uint32be ukn18;
/* +0x1C */ uint32be priority;
/* +0x20 */ uint32be callback;
/* +0x24 */ uint32be userParam;
/* +0x28 */ uint32be sync;
/* +0x2C */ uint32be depop;
/* +0x30 */ MEMPTR<AXVPBItd> itd;
/* +0x34 */ AXPBOFFSET_t offsets;
/* +0x48 */ uint32be callbackEx; // AXAcquireVoiceEx
/* +0x4C */ uint32be ukn4C_dropReason;
/* +0x50 */ float32be dspLoad;
/* +0x54 */ float32be ppcLoad;
};
struct AXPBLPF_t
{
/* +0x00 */ uint16 on;
/* +0x02 */ sint16 yn1;
/* +0x04 */ sint16 a0;
/* +0x06 */ sint16 b0;
};
struct AXPBBIQUAD_t
{
/* +0x00 */ uint16 on;
/* +0x02 */ sint16 xn1;
/* +0x04 */ sint16 xn2;
/* +0x06 */ sint16 yn1;
/* +0x08 */ sint16 yn2;
/* +0x0A */ uint16 b0;
/* +0x0C */ uint16 b1;
/* +0x0E */ uint16 b2;
/* +0x10 */ uint16 a1;
/* +0x12 */ uint16 a2;
};
struct AXRemixMatrix_t
{
/* +0x00 */ uint32be channelIn;
/* +0x04 */ uint32be channelOut;
/* +0x08 */ MEMPTR<float32be> matrix;
};
struct AXRemixMatrices_t
{
/* +0x00 */ AXRemixMatrix_t deviceEntry[3]; // tv, drc, remote
};
struct AXPBADPCM_t
{
uint16 a[16];
uint16 gain;
uint16 scale;
uint16 yn1;
uint16 yn2;
};
struct AXPBADPCMLOOP_t
{
uint16 loopScale;
uint16 loopYn1;
uint16 loopYn2;
};
struct AXPBSRC_t
{
/* +0x1B8 */ uint16 ratioHigh;
/* +0x1BA */ uint16 ratioLow;
/* +0x1BC */ uint16 currentFrac;
/* +0x1BE */ uint16 historySamples[4];
uint32 GetSrcRatio32() const
{
uint32 offset = (uint32)_swapEndianU16(ratioHigh) << 16;
return offset | (uint32)_swapEndianU16(ratioLow);
}
};
struct AXCHMIX_DEPR
{
uint16 vol;
sint16 delta;
};
struct AXCHMIX2
{
uint16be vol;
sint16be delta;
};
void AXVPB_Init();
void AXResetToDefaultState();
sint32 AXIsValidDevice(sint32 device, sint32 deviceIndex);
AXVPB* AXAcquireVoiceEx(uint32 priority, MPTR callbackEx, MPTR userParam);
void AXFreeVoice(AXVPB* vpb);
bool AXUserIsProtected();
sint32 AXUserBegin();
sint32 AXUserEnd();
bool AXVoiceProtection_IsProtectedByAnyThread(AXVPB* vpb);
bool AXVoiceProtection_IsProtectedByCurrentThread(AXVPB* vpb);
sint32 AXVoiceBegin(AXVPB* voice);
sint32 AXVoiceEnd(AXVPB* voice);
sint32 AXSetVoiceDeviceMix(AXVPB* vpb, sint32 device, sint32 deviceIndex, AXCHMIX_DEPR* mix);
void AXSetVoiceState(AXVPB* vpb, sint32 voiceState);
sint32 AXIsVoiceRunning(AXVPB* vpb);
void AXSetVoiceType(AXVPB* vpb, uint16 voiceType);
void AXSetVoiceAdpcm(AXVPB* vpb, AXPBADPCM_t* adpcm);
void AXSetVoiceAdpcmLoop(AXVPB* vpb, AXPBADPCMLOOP_t* adpcmLoop);
void AXSetVoiceSrc(AXVPB* vpb, AXPBSRC_t* src);
void AXSetVoiceSrcType(AXVPB* vpb, uint32 srcType);
sint32 AXSetVoiceSrcRatio(AXVPB* vpb, float ratio);
void AXSetVoiceVe(AXVPB* vpb, AXPBVE* ve);
void AXComputeLpfCoefs(uint32 freq, uint16be* a0, uint16be* b0);
void AXSetVoiceLpf(AXVPB* vpb, AXPBLPF_t* lpf);
void AXSetVoiceLpfCoefs(AXVPB* vpb, uint16 a0, uint16 b0);
void AXSetVoiceBiquad(AXVPB* vpb, AXPBBIQUAD_t* biquad);
void AXSetVoiceBiquadCoefs(AXVPB* vpb, uint16 b0, uint16 b1, uint16 b2, uint16 a1, uint16 a2);
void AXSetVoiceOffsets(AXVPB* vpb, AXPBOFFSET_t* pbOffset);
void AXGetVoiceOffsets(AXVPB* vpb, AXPBOFFSET_t* pbOffset);
void AXGetVoiceOffsetsEx(AXVPB* vpb, AXPBOFFSET_t* pbOffset, MPTR sampleBase);
void AXSetVoiceCurrentOffset(AXVPB* vpb, uint32 currentOffset);
void AXSetVoiceLoopOffset(AXVPB* vpb, uint32 loopOffset);
void AXSetVoiceEndOffset(AXVPB* vpb, uint32 endOffset);
void AXSetVoiceCurrentOffsetEx(AXVPB* vpb, uint32 currentOffset, MPTR sampleBase);
void AXSetVoiceLoopOffsetEx(AXVPB* vpb, uint32 loopOffset, MPTR sampleBase);
void AXSetVoiceEndOffsetEx(AXVPB* vpb, uint32 endOffset, MPTR sampleBase);
uint32 AXGetVoiceCurrentOffsetEx(AXVPB* vpb, MPTR sampleBase);
void AXSetVoiceLoop(AXVPB* vpb, uint16 loopState);
// AXIst
void AXIst_Init();
void AXIst_ThreadEntry(PPCInterpreter_t* hCPU);
void AXIst_QueueFrame();
void AXResetCallbacks();
bool AXIst_IsFrameBeingProcessed();
sint32 AXSetDeviceUpsampleStage(sint32 device, int upsampleStage);
sint32 AXGetDeviceUpsampleStage(sint32 device, uint32be* upsampleStage);
sint32 AXGetDeviceFinalMixCallback(sint32 device, uint32be* funcAddrPtr);
sint32 AXRegisterDeviceFinalMixCallback(sint32 device, MPTR funcAddr);
sint32 AXSetDeviceRemixMatrix(sint32 deviceId, uint32 inputChannelCount, uint32 outputChannelCount, const MEMPTR<float32be>& matrix);
sint32 AXGetDeviceRemixMatrix(uint32 deviceId, uint32 inputChannelCount, uint32 outputChannelCount, MEMPTR<MEMPTR<float32be>>& matrix);
sint32 AXRegisterAppFrameCallback(MPTR funcAddr);
sint32 AXDeregisterAppFrameCallback(MPTR funcAddr);
MPTR AXRegisterFrameCallback(MPTR funcAddr);
sint32 AXGetInputSamplesPerFrame();
sint32 AXGetInputSamplesPerSec();
// AXOut
void resetNumProcessedFrames();
uint32 getNumProcessedFrames();
void AXOut_Init();
sint32 AIGetSamplesPerChannel(uint32 device);
sint32 AIGetChannelCount(uint32 device);
sint16* AIGetCurrentDMABuffer(uint32 device);
void AXOut_SubmitTVFrame(sint32 frameIndex);
void AXOut_SubmitDRCFrame(sint32 frameIndex);
sint32 AXGetDeviceMode(sint32 device);
extern uint32 numProcessedFrames;
// AUX
void AXAux_Init();
void AXAux_Process();
sint32be* AXAux_GetInputBuffer(sint32 device, sint32 deviceIndex, sint32 auxBus);
sint32be* AXAux_GetOutputBuffer(sint32 device, sint32 deviceIndex, sint32 auxBus);
sint32 AXGetAuxCallback(sint32 device, sint32 deviceIndex, uint32 auxBusIndex, MEMPTR<uint32be> funcPtrOut, MEMPTR<uint32be> contextPtrOut);
sint32 AXRegisterAuxCallback(sint32 device, sint32 deviceIndex, uint32 auxBusIndex, MPTR funcMPTR, MPTR userParam);
sint32 AXSetAuxReturnVolume(uint32 device, uint32 deviceIndex, uint32 auxBus, uint16 volume);
extern uint16 __AXTVAuxReturnVolume[AX_AUX_BUS_COUNT];
// AXMix
// mixer select constants (for AXSetDefaultMixerSelect / AXGetDefaultMixerSelect)
const int AX_MIXER_SELECT_DSP = (0);
const int AX_MIXER_SELECT_PPC = (1);
const int AX_MIXER_SELECT_BOTH = (2);
void AXMix_Init();
void AXSetDefaultMixerSelect(uint32 mixerSelect);
uint32 AXGetDefaultMixerSelect();
void AXMix_DepopVoice(struct AXVPBInternal_t* internalShadowCopy);
void AXMix_process(struct AXVPBInternal_t* internalShadowCopyHead);
extern FSpinlock __AXVoiceListSpinlock;
// AX multi voice
struct AXVPBMULTI
{
/* +0x00 */ betype<uint32> isUsed;
/* +0x04 */ betype<uint32> channelCount;
/* +0x08 */ MEMPTR<AXVPB> voice[6];
// size: 0x20
};
static_assert(sizeof(AXVPBMULTI) == 0x20);
struct AXMULTIVOICEUKNSTRUCT
{
uint8 ukn[0x4A];
betype<sint16> channelCount;
};
struct AXDSPADPCM
{
/* +0x00 */ uint32be numSamples;
/* +0x04 */ uint32be ukn04;
/* +0x08 */ uint32be sampleRate;
/* +0x0C */ uint16be isLooped;
/* +0x0E */ uint16be format;
/* +0x10 */ uint32be ukn10;
/* +0x14 */ uint32be ukn14;
/* +0x18 */ uint32be ukn18;
/* +0x1C */ uint16be coef[16];
/* +0x3C */ uint16be gain;
/* +0x3E */ uint16be scale;
/* +0x40 */ uint16be yn1;
/* +0x42 */ uint16be yn2;
/* +0x44 */ uint16be ukn44;
/* +0x46 */ uint16be ukn46;
/* +0x48 */ uint16be ukn48;
/* +0x4A */ uint16be channelCount;
/* +0x4C */ uint16be ukn4C;
/* +0x4E */ uint8 _padding4E[0x12];
};
static_assert(sizeof(AXDSPADPCM) == 0x60);
void AXMultiVoice_Init();
sint32 AXAcquireMultiVoice(sint32 voicePriority, void* cbFunc, void* cbData, AXMULTIVOICEUKNSTRUCT* uknR6, MEMPTR<AXVPBMULTI>* multiVoiceOut);
void AXFreeMultiVoice(AXVPBMULTI* multiVoice);
sint32 AXGetMultiVoiceReformatBufferSize(sint32 voiceFormat, uint32 channelCount, uint32 sizeInBytes, uint32be* sizeOutput);
void AXSetMultiVoiceType(AXVPBMULTI* mv, uint16 type);
void AXSetMultiVoiceAdpcm(AXVPBMULTI* mv, AXDSPADPCM* data);
void AXSetMultiVoiceSrcType(AXVPBMULTI* mv, uint32 type);
void AXSetMultiVoiceOffsets(AXVPBMULTI* mv, AXPBOFFSET_t* offsets);
void AXSetMultiVoiceVe(AXVPBMULTI* mv, AXPBVE* ve);
void AXSetMultiVoiceSrcRatio(AXVPBMULTI* mv, float ratio);
void AXSetMultiVoiceSrc(AXVPBMULTI* mv, AXPBSRC_t* src);
void AXSetMultiVoiceLoop(AXVPBMULTI* mv, uint16 loop);
void AXSetMultiVoiceState(AXVPBMULTI* mv, uint16 state);
void AXSetMultiVoiceAdpcmLoop(AXVPBMULTI* mv, AXPBADPCMLOOP_t* loops);
sint32 AXIsMultiVoiceRunning(AXVPBMULTI* mv);
void AXOut_init();
void AXOut_reset();
void AXOut_update();
void Initialize();
}
| 11,327
|
C++
|
.h
| 316
| 33.291139
| 143
| 0.743573
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,616
|
OSCommon.h
|
cemu-project_Cemu/src/Cafe/OS/common/OSCommon.h
|
#pragma once
struct PPCInterpreter_t;
#define OSLIB_FUNCTIONTABLE_TYPE_FUNCTION (1)
#define OSLIB_FUNCTIONTABLE_TYPE_POINTER (2)
void osLib_load();
void osLib_generateHashFromName(const char* name, uint32* hashA, uint32* hashB);
sint32 osLib_getFunctionIndex(const char* libraryName, const char* functionName);
uint32 osLib_getPointer(const char* libraryName, const char* functionName);
void osLib_addFunctionInternal(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t* hCPU));
#define osLib_addFunction(__p1, __p2, __p3) osLib_addFunctionInternal((const char*)__p1, __p2, __p3)
void osLib_addVirtualPointer(const char* libraryName, const char* functionName, uint32 vPtr);
void osLib_returnFromFunction(PPCInterpreter_t* hCPU, uint32 returnValue);
void osLib_returnFromFunction64(PPCInterpreter_t* hCPU, uint64 returnValue64);
// libs
#include "Cafe/OS/libs/coreinit/coreinit.h"
// utility functions
#include "Cafe/OS/common/OSUtil.h"
// va_list
struct ppc_va_list
{
uint8be gprIndex;
uint8be fprIndex;
uint8be _padding2[2];
MEMPTR<uint8be> overflow_arg_area;
MEMPTR<uint8be> reg_save_area;
};
static_assert(sizeof(ppc_va_list) == 0xC);
struct ppc_va_list_reg_storage
{
uint32be gpr_save_area[8]; // 32 bytes, r3 to r10
float64be fpr_save_area[8]; // 64 bytes, f1 to f8
ppc_va_list vargs;
uint32be padding;
};
static_assert(sizeof(ppc_va_list_reg_storage) == 0x70);
// Equivalent of va_start for PPC HLE functions. Must be called before any StackAllocator<> definitions
#define ppc_define_va_list(__gprIndex, __fprIndex) \
MPTR vaOriginalR1 = PPCInterpreter_getCurrentInstance()->gpr[1]; \
StackAllocator<ppc_va_list_reg_storage> va_list_storage; \
for(int i=3; i<=10; i++) va_list_storage->gpr_save_area[i-3] = PPCInterpreter_getCurrentInstance()->gpr[i]; \
for(int i=1; i<=8; i++) va_list_storage->fpr_save_area[i-1] = PPCInterpreter_getCurrentInstance()->fpr[i].fp0; \
va_list_storage->vargs.gprIndex = __gprIndex; \
va_list_storage->vargs.fprIndex = __fprIndex; \
va_list_storage->vargs.reg_save_area = (uint8be*)&va_list_storage; \
va_list_storage->vargs.overflow_arg_area = {vaOriginalR1 + 8}; \
ppc_va_list& vargs = va_list_storage->vargs;
enum class ppc_va_type
{
INT32 = 1,
INT64 = 2,
FLOAT_OR_DOUBLE = 3,
};
static void* _ppc_va_arg(ppc_va_list* vargs, ppc_va_type argType)
{
void* r;
switch ( argType )
{
default:
cemu_assert_suspicious();
case ppc_va_type::INT32:
if ( vargs[0].gprIndex < 8u )
{
r = &vargs->reg_save_area[4 * vargs->gprIndex];
vargs->gprIndex++;
return r;
}
r = vargs->overflow_arg_area;
vargs->overflow_arg_area += 4;
return r;
case ppc_va_type::INT64:
if ( (vargs->gprIndex & 1) != 0 )
vargs->gprIndex++;
if ( vargs->gprIndex < 8 )
{
r = &vargs->reg_save_area[4 * vargs->gprIndex];
vargs->gprIndex += 2;
return r;
}
vargs->overflow_arg_area = {(vargs->overflow_arg_area.GetMPTR()+7) & 0xFFFFFFF8};
r = vargs->overflow_arg_area;
vargs->overflow_arg_area += 8;
return r;
case ppc_va_type::FLOAT_OR_DOUBLE:
if ( vargs->fprIndex < 8 )
{
r = &vargs->reg_save_area[0x20 + 8 * vargs->fprIndex];
vargs->fprIndex++;
return r;
}
vargs->overflow_arg_area = {(vargs->overflow_arg_area.GetMPTR()+7) & 0xFFFFFFF8};
r = vargs->overflow_arg_area;
vargs->overflow_arg_area += 8;
return r;
}
}
| 3,357
|
C++
|
.h
| 95
| 33.126316
| 125
| 0.720615
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,617
|
OSUtil.h
|
cemu-project_Cemu/src/Cafe/OS/common/OSUtil.h
|
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "Cafe/HW/Espresso/PPCState.h"
#include "Cafe/HW/MMU/MMU.h"
#include <fmt/ostream.h>
#include <fmt/compile.h>
#include <fmt/ranges.h>
class cafeExportParamWrapper
{
public:
template <typename T>
static void getParamWrapper(PPCInterpreter_t* hCPU, int& gprIndex, int& fprIndex, T& v)
{
if constexpr (std::is_pointer_v<T>)
{
uint32be addr;
if (gprIndex >= 8)
addr = memory_readU32(hCPU->gpr[1] + 8 + (gprIndex - 8) * 4);
else
addr = hCPU->gpr[3 + gprIndex];
using TPtr = std::remove_pointer_t<T>;
v = MEMPTR<TPtr>(addr).GetPtr();
gprIndex++;
}
else if constexpr (std::is_base_of_v<MEMPTRBase, T>)
{
uint32be addr;
if (gprIndex >= 8)
addr = memory_readU32(hCPU->gpr[1] + 8 + (gprIndex - 8) * 4);
else
addr = hCPU->gpr[3 + gprIndex];
v = addr.value();
gprIndex++;
}
else if constexpr (std::is_enum_v<T>)
{
using TEnum = std::underlying_type_t<T>;
getParamWrapper<TEnum>(hCPU, gprIndex, fprIndex, (TEnum&)v);
}
else if constexpr (std::is_integral_v<T>)
{
if constexpr (sizeof(T) == sizeof(uint64))
{
gprIndex = (gprIndex + 1)&~1;
if (gprIndex >= 8)
v = (T)memory_readU64(hCPU->gpr[1] + 8 + (gprIndex - 8) * 4);
else
v = (T)(((uint64)hCPU->gpr[3 + gprIndex]) << 32) | ((uint64)hCPU->gpr[3 + gprIndex + 1]);
gprIndex += 2;
}
else
{
if (gprIndex >= 8)
v = (T)memory_readU32(hCPU->gpr[1] + 8 + (gprIndex - 8) * 4);
else
v = (T)hCPU->gpr[3 + gprIndex];
gprIndex++;
}
}
else if constexpr (std::is_floating_point_v<T>)
{
v = (T)hCPU->fpr[1 + fprIndex].fpr;
fprIndex++;
}
else
{
assert_dbg();
}
}
template<typename T>
static void setReturnResult(PPCInterpreter_t* hCPU, T r)
{
if constexpr (std::is_pointer_v<T>)
{
hCPU->gpr[3] = MEMPTR(r).GetMPTR();
}
else if constexpr (std::is_reference_v<T>)
{
hCPU->gpr[3] = MEMPTR(&r).GetMPTR();
}
else if constexpr (std::is_enum_v<T>)
{
using TEnum = std::underlying_type_t<T>;
setReturnResult<TEnum>(hCPU, (TEnum)r);
}
else if constexpr (std::is_integral_v<T>)
{
if constexpr(sizeof(T) == 8)
{
const auto t = static_cast<uint64>(r);
hCPU->gpr[3] = (uint32)(t >> 32); // high
hCPU->gpr[4] = (uint32)(t); // low
}
else
{
hCPU->gpr[3] = (uint32)r;
}
}
else
{
cemu_assert_unimplemented();
//static_assert(false);
}
}
template<typename T>
static auto getFormatResult(T r)
{
if constexpr (std::is_pointer_v<T>)
return MEMPTR(r).GetMPTR();
else if constexpr (std::is_enum_v<T>)
return static_cast<std::underlying_type_t<T>>(r);
else if constexpr(!std::is_fundamental_v<T>)
return MEMPTR(&r).GetMPTR();
else
return r;
}
};
template<typename T>
T cafeExportGetParamWrapper(PPCInterpreter_t* hCPU, int& gprIndex, int& fprIndex)
{
T v;
cafeExportParamWrapper::getParamWrapper(hCPU, gprIndex, fprIndex, v);
return v;
}
template <typename R, typename ... Args>
static std::tuple<Args...> cafeExportBuildArgTuple(PPCInterpreter_t* hCPU, R(fn)(Args...))
{
int gprIndex = 0;
int fprIndex = 0;
return std::tuple<Args...>{ cafeExportGetParamWrapper<Args>(hCPU, gprIndex, fprIndex)... };
}
template<typename T>
T cafeExportGetFormatParamWrapper(PPCInterpreter_t* hCPU, int& gprIndex, int& fprIndex)
{
T v;
cafeExportParamWrapper::getParamWrapper(hCPU, gprIndex, fprIndex, v);
// if T is char* or const char*, return "null" instead of nullptr since newer fmtlib would throw otherwise
if constexpr (std::is_same_v<T, char*> || std::is_same_v<T, const char*>)
return v ? v : (T)"null";
return v;
}
template<typename T>
using _CAFE_FORMAT_ARG = std::conditional_t<std::is_pointer_v<T>,
std::conditional_t<std::is_same_v<T, char*> || std::is_same_v<T, const char*>, T, MEMPTR<T>>, T>;
template <typename R, typename... Args>
static auto cafeExportBuildFormatTuple(PPCInterpreter_t* hCPU, R(fn)(Args...))
{
int gprIndex = 0;
int fprIndex = 0;
return std::tuple<_CAFE_FORMAT_ARG<Args>...>{
cafeExportGetFormatParamWrapper<_CAFE_FORMAT_ARG<Args>>(hCPU, gprIndex, fprIndex)...
};
}
template<auto fn, typename TNames, LogType TLogType>
void cafeExportCallWrapper(PPCInterpreter_t* hCPU)
{
auto tup = cafeExportBuildArgTuple(hCPU, fn);
bool shouldLog = false;
if (cemuLog_isLoggingEnabled(TLogType))
{
const auto format_tup = cafeExportBuildFormatTuple(hCPU, fn);
if(cemuLog_advancedPPCLoggingEnabled())
{
MPTR threadMPTR = memory_getVirtualOffsetFromPointer(coreinit::OSGetCurrentThread());
if constexpr (std::tuple_size<decltype(format_tup)>::value > 0)
shouldLog = cemuLog_log(TLogType, "{}.{}{} # LR: {:#x} | Thread: {:#x}", TNames::GetLib(), TNames::GetFunc(), format_tup, hCPU->spr.LR, threadMPTR);
else
shouldLog = cemuLog_log(TLogType, "{}.{}() # LR: {:#x} | Thread: {:#x}", TNames::GetLib(), TNames::GetFunc(), hCPU->spr.LR, threadMPTR);
}
else
{
if constexpr (std::tuple_size<decltype(format_tup)>::value > 0)
{
shouldLog = cemuLog_log(TLogType, "{}.{}{}", TNames::GetLib(), TNames::GetFunc(), format_tup);
}
else
shouldLog = cemuLog_log(TLogType, "{}.{}()", TNames::GetLib(), TNames::GetFunc());
}
}
if constexpr (!std::is_void<decltype(std::apply(fn, tup))>::value)
{
// has non-void return type
decltype(auto) result = std::apply(fn, tup);
cafeExportParamWrapper::setReturnResult<decltype(std::apply(fn, tup))>(hCPU, result);
if(shouldLog)
cemuLog_log(TLogType, "\t\t{}.{} -> {}", TNames::GetLib(), TNames::GetFunc(), cafeExportParamWrapper::getFormatResult(result));
}
else
{
// return type is void
std::apply(fn, tup);
}
// return from func
hCPU->instructionPointer = hCPU->spr.LR;
}
void osLib_addFunctionInternal(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t* hCPU));
template<auto fn, typename TNames, LogType TLogType>
void cafeExportMakeWrapper(const char* libname, const char* funcname)
{
osLib_addFunctionInternal(libname, funcname, &cafeExportCallWrapper<fn, TNames, TLogType>);
}
#define cafeExportRegister(__libname, __func, __logtype) \
{ \
struct StringWrapper { \
static const char* GetLib() { return __libname; }; \
static const char* GetFunc() { return #__func; }; \
}; \
cafeExportMakeWrapper<__func, StringWrapper, __logtype>(__libname, # __func);\
}
#define cafeExportRegisterFunc(__func, __libname, __funcname, __logtype) \
{\
struct StringWrapper { \
static const char* GetLib() { return __libname; }; \
static const char* GetFunc() { return __funcname; }; \
}; \
cafeExportMakeWrapper<__func, StringWrapper, __logtype>(__libname, __funcname);\
}
template<auto fn>
MPTR makeCallableExport()
{
return PPCInterpreter_makeCallableExportDepr(&cafeExportCallWrapper<fn, "CALLABLE_EXPORT">);
}
void osLib_addVirtualPointer(const char* libraryName, const char* functionName, uint32 vPtr);
| 6,959
|
C++
|
.h
| 223
| 28.269058
| 152
| 0.67704
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,618
|
PPCConcurrentQueue.h
|
cemu-project_Cemu/src/Cafe/OS/common/PPCConcurrentQueue.h
|
#pragma once
#include <mutex>
#include <condition_variable>
#include <queue>
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
template <typename T>
class PPCConcurrentQueue
{
public:
PPCConcurrentQueue() = default;
PPCConcurrentQueue(const PPCConcurrentQueue&) = delete;
PPCConcurrentQueue& operator=(const PPCConcurrentQueue&) = delete;
void push(const T& item, OSThread_t* thread)
{
//if(thread == nullptr)
// thread = coreinitThread_getCurrentThread(ppcInterpreterCurrentInstance);
//OSThread_t* currentThread = coreinit::OSGetCurrentThread();
//cemu_assert_debug(thread == nullptr || currentThread == thread);
// cemuLog_logDebug(LogType::Force, "push suspend count: {}", _swapEndianU32(thread->suspend) - m_suspendCount);
//__OSLockScheduler();
__OSLockScheduler();
m_queue.push(item);
coreinit::__OSResumeThreadInternal(thread, 1);
__OSUnlockScheduler();
//__OSUnlockScheduler();
//m_prevSuspendCount = _swapEndianU32(thread->suspend) - m_suspendCount;
//coreinit_resumeThread(thread, _swapEndianU32(thread->suspend));
}
T pop(OSThread_t* thread = nullptr)
{
//if (thread == nullptr)
// thread = coreinitThread_getCurrentThread(ppcInterpreterCurrentInstance);
OSThread_t* currentThread = coreinit::OSGetCurrentThread();
cemu_assert_debug(thread == nullptr || currentThread == thread);
//thread = coreinitThread_getCurrentThread(ppcInterpreterCurrentInstance);
// cemuLog_logDebug(LogType::Force, "pop suspend count: {}", _swapEndianU32(thread->suspend) + m_suspendCount);
__OSLockScheduler();
if (m_queue.empty())
coreinit::__OSSuspendThreadInternal(thread);
auto val = m_queue.front();
m_queue.pop();
__OSUnlockScheduler();
//coreinit_suspendThread(thread, m_suspendCount + m_prevSuspendCount);
//m_prevSuspendCount = 0;
//PPCCore_switchToScheduler();
return val;
}
private:
//const int m_suspendCount = 8000;
std::queue<T> m_queue;
//std::atomic<uint32> m_prevSuspendCount;
};
| 1,974
|
C++
|
.h
| 52
| 35.288462
| 114
| 0.748688
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,619
|
GraphicPack2.h
|
cemu-project_Cemu/src/Cafe/GraphicPack/GraphicPack2.h
|
#pragma once
#include "util/helpers/helpers.h"
#include "Cemu/ExpressionParser/ExpressionParser.h"
#include "Cafe/HW/Latte/Renderer/RendererOuputShader.h"
#include "util/helpers/Serializer.h"
#include "Cafe/OS/RPL/rpl.h"
#include "Cemu/PPCAssembler/ppcAssembler.h"
#include <variant>
#include "Cafe/HW/Latte/Renderer/Renderer.h"
#include "GraphicPack2Patches.h"
#include "util/IniParser/IniParser.h"
class GraphicPack2
{
public:
enum class GP_SHADER_TYPE : uint8
{
PIXEL = 0,
VERTEX = 1,
GEOMETRY = 2,
};
enum
{
GFXPACK_VERSION_5 = 5,
GFXPACK_VERSION_6 = 6, // added memory extensions
GFXPACK_VERSION_7 = 7, // added fine-grained origin control in patch format (no more forced 4 byte alignment), .string directive (an alias to .byte) and support for more than one constant per data directive
};
struct TextureRule
{
// filter (texture must match these settings)
struct FILTER_SETTINGS
{
enum class MEM1_FILTER {
BOTH,
INSIDE,
OUTSIDE,
};
sint32 width = -1;
sint32 height = -1;
sint32 depth = -1;
MEM1_FILTER inMEM1 = MEM1_FILTER::BOTH;
std::vector<sint32> format_whitelist{};
std::vector<sint32> format_blacklist{};
std::vector<sint32> tilemode_whitelist{};
std::vector<sint32> tilemode_blacklist{};
} filter_settings;
// overwrite (if match found, these settings are overwritten)
struct OVERWRITE_SETTINGS
{
sint32 width = -1;
sint32 height = -1;
sint32 depth = -1;
sint32 format = -1;
sint32 lod_bias = -1; // in 1/64th steps
sint32 relative_lod_bias = -1; // in 1/64th steps
sint32 anistropic_value = -1; // 1<<n
} overwrite_settings;
};
struct CustomShader
{
std::string source;
uint64 shader_base_hash;
uint64 shader_aux_hash;
GP_SHADER_TYPE type;
bool isPreVulkanShader{}; // set to true for V3 packs since the shaders are not compatible with the Vulkan renderer
};
enum VarType
{
kDouble = 0,
kInt = 1,
};
using PresetVar = std::pair<VarType, double>;
struct Preset
{
std::string category; // preset category (empty for default)
std::string name; // displayed name
std::string condition;
std::unordered_map<std::string, PresetVar> variables;
bool active = false; // selected/active preset
bool visible = true; // set by condition or true
bool is_default = false; // selected by default
Preset(std::string_view name, std::unordered_map<std::string, PresetVar> vars)
: name(name), variables(std::move(vars)) {}
Preset(std::string_view category, std::string_view name, std::unordered_map<std::string, PresetVar> vars)
: category(category), name(name), variables(std::move(vars)) {}
Preset(std::string_view category, std::string_view name, std::string_view condition, std::unordered_map<std::string, PresetVar> vars)
: category(category), name(name), condition(condition), variables(std::move(vars)) {}
};
using PresetPtr = std::shared_ptr<Preset>;
GraphicPack2(fs::path rulesPath, IniParser& rules);
bool IsEnabled() const { return m_enabled; }
bool IsActivated() const { return m_activated; }
sint32 GetVersion() const { return m_version; }
const fs::path GetRulesPath() const { return m_rulesPath; }
std::string GetNormalizedPathString() const;
bool RequiresRestart(bool changeEnableState, bool changePreset);
bool Reload();
bool HasName() const { return !m_name.empty(); }
const std::string& GetName() const { return m_name.empty() ? m_virtualPath : m_name; }
const std::string& GetVirtualPath() const { return m_virtualPath; } // returns the path in the gfx tree hierarchy
const std::string& GetDescription() const { return m_description; }
bool IsDefaultEnabled() const { return m_default_enabled; }
bool AllowRendertargetSizeOptimization() const { return m_allowRendertargetSizeOptimization; }
void SetEnabled(bool state) { m_enabled = state; }
bool ContainsTitleId(uint64_t title_id) const;
const std::vector<uint64_t>& GetTitleIds() const { return m_title_ids; }
bool HasCustomVSyncFrequency() const { return m_vsync_frequency >= 1; }
sint32 GetCustomVSyncFrequency() const { return m_vsync_frequency; }
// texture rules
const std::vector<TextureRule>& GetTextureRules() const { return m_texture_rules; }
// presets
[[nodiscard]] bool HasActivePreset() const;
[[nodiscard]] std::string GetActivePreset(std::string_view category = "") const;
[[nodiscard]] std::vector<PresetPtr> GetActivePresets() const;
[[nodiscard]] bool IsPresetVisible(const PresetPtr& preset) const;
[[nodiscard]] std::optional<PresetVar> GetPresetVariable(const std::vector<PresetPtr>& presets, std::string_view var_name) const;
void ValidatePresetSelections();
bool SetActivePreset(std::string_view category, std::string_view name, bool update_visibility = true);
bool SetActivePreset(std::string_view name);
void UpdatePresetVisibility();
void AddConstantsForCurrentPreset(ExpressionParser& ep);
bool ResolvePresetConstant(const std::string& varname, double& value) const;
[[nodiscard]] const std::vector<PresetPtr>& GetPresets() const { return m_presets; }
[[nodiscard]] std::unordered_map<std::string, std::vector<PresetPtr>> GetCategorizedPresets(std::vector<std::string>& order) const;
// shaders
void LoadShaders();
bool HasShaders() const;
const std::vector<CustomShader>& GetCustomShaders() const { return m_custom_shaders; }
static const std::string* FindCustomShaderSource(uint64 shaderBaseHash, uint64 shaderAuxHash, GP_SHADER_TYPE type, bool isVulkanRenderer);
const std::string& GetOutputShaderSource() const { return m_output_shader_source; }
const std::string& GetDownscalingShaderSource() const { return m_downscaling_shader_source; }
const std::string& GetUpscalingShaderSource() const { return m_upscaling_shader_source; }
RendererOutputShader* GetOuputShader(bool render_upside_down);
RendererOutputShader* GetUpscalingShader(bool render_upside_down);
RendererOutputShader* GetDownscalingShader(bool render_upside_down);
LatteTextureView::MagFilter GetUpscalingMagFilter() const { return m_output_settings.upscale_filter; }
LatteTextureView::MagFilter GetDownscalingMagFilter() const { return m_output_settings.downscale_filter; }
// static methods
static void LoadAll();
static const std::vector<std::shared_ptr<GraphicPack2>>& GetGraphicPacks() { return s_graphic_packs; }
static const std::vector<std::shared_ptr<GraphicPack2>>& GetActiveGraphicPacks() { return s_active_graphic_packs; }
static void LoadGraphicPack(fs::path graphicPackPath);
static bool LoadGraphicPack(const fs::path& rulesPath, class IniParser& rules);
static bool ActivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack);
static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack);
static void ClearGraphicPacks();
static void WaitUntilReady(); // wait until all graphic packs finished activation
static void ActivateForCurrentTitle();
static void Reset();
private:
bool Activate();
bool Deactivate();
static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs;
static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs;
static std::atomic_bool s_isReady;
template<typename TType>
void FillPresetConstants(TExpressionParser<TType>& parser) const
{
// fils preset variables with priority
// active && visible > active > default
const auto active_presets = GetActivePresets();
for(const auto& preset : active_presets)
{
if(preset->visible)
{
for (auto& var : preset->variables)
parser.AddConstant(var.first, (TType)var.second.second);
}
}
for(const auto& preset : active_presets)
{
if(!preset->visible)
{
for (auto& var : preset->variables)
parser.TryAddConstant(var.first, (TType)var.second.second);
}
}
for (auto& var : m_preset_vars)
parser.TryAddConstant(var.first, (TType)var.second.second);
}
fs::path m_rulesPath;
sint32 m_version;
std::string m_name;
std::string m_virtualPath;
std::string m_description;
bool m_default_enabled = false;
bool m_allowRendertargetSizeOptimization = false; // gfx pack supports framebuffers with non-padded sizes, which is an optional optimization introduced with Cemu 2.0-74
// filter
std::optional<RendererAPI> m_renderer_api;
std::optional<GfxVendor> m_gfx_vendor;
bool m_enabled = false;
bool m_activated = false; // set if the graphic pack is currently used by the running game
std::vector<uint64_t> m_title_ids;
bool m_patchedFilesLoaded = false; // set to true once patched files are loaded
sint32 m_vsync_frequency = -1;
sint32 m_fs_priority = 100;
struct
{
LatteTextureView::MagFilter upscale_filter = LatteTextureView::MagFilter::kLinear;
LatteTextureView::MagFilter downscale_filter = LatteTextureView::MagFilter::kLinear;
} m_output_settings;
std::vector<PresetPtr> m_presets;
// default preset vars
std::unordered_map<std::string, PresetVar> m_preset_vars;
std::vector<CustomShader> m_custom_shaders;
std::vector<TextureRule> m_texture_rules;
std::string m_output_shader_source, m_upscaling_shader_source, m_downscaling_shader_source;
std::unique_ptr<RendererOutputShader> m_output_shader, m_upscaling_shader, m_downscaling_shader, m_output_shader_ud, m_upscaling_shader_ud, m_downscaling_shader_ud;
template<typename T>
bool ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* value_out) const;
template<typename T>
std::vector<T> ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const;
std::unordered_map<std::string, PresetVar> ParsePresetVars(IniParser& rules) const;
std::vector<uint64> ParseTitleIds(IniParser& rules, const char* option_name) const;
CustomShader LoadShader(const fs::path& path, uint64 shader_base_hash, uint64 shader_aux_hash, GP_SHADER_TYPE shader_type) const;
void ApplyShaderPresets(std::string& shader_source) const;
void LoadReplacedFiles();
void _iterateReplacedFiles(const fs::path& currentPath, bool isAOC);
// ram mappings
std::vector<std::pair<MPTR, MPTR>> m_ramMappings;
// patches
void LoadPatchFiles(); // loads Cemuhook or Cemu patches
bool LoadCemuPatches();
void ParseCemuhookPatchesTxtInternal(MemStreamReader& patchesStream);
bool ParseCemuPatchesTxtInternal(MemStreamReader& patchesStream);
void CancelParsingPatches();
void ApplyPatchGroups(std::vector<PatchGroup*>& groups, const RPLModule* rpl);
void UndoPatchGroups(std::vector<PatchGroup*>& groups, const RPLModule* rpl);
void AddPatchGroup(PatchGroup* group);
sint32 GetLengthWithoutComment(const char* str, size_t length);
void LogPatchesSyntaxError(sint32 lineNumber, std::string_view errorMsg);
std::vector<PatchGroup*> list_patchGroups;
static std::recursive_mutex mtx_patches;
static std::vector<const RPLModule*> list_modules;
public:
static std::vector<std::pair<MPTR, MPTR>> GetActiveRAMMappings();
void EnablePatches();
void UnloadPatches();
bool HasPatches();
const std::vector<PatchGroup*>& GetPatchGroups();
void ApplyPatchesForModule(const RPLModule* rpl);
void RevertPatchesForModule(const RPLModule* rpl);
static void NotifyModuleLoaded(const RPLModule* rpl);
static void NotifyModuleUnloaded(const RPLModule* rpl);
};
using GraphicPackPtr = std::shared_ptr<GraphicPack2>;
template <typename T>
bool GraphicPack2::ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* value_out) const
{
auto option_value = iniParser.FindOption(option_name);
if (option_value)
{
*value_out = parser.Evaluate<T>(*option_value);
return true;
}
return false;
}
template <typename T>
std::vector<T> GraphicPack2::ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const
{
std::vector<T> result;
auto option_text = iniParser.FindOption(option_name);
if (!option_text)
return result;
for(auto& token : Tokenize(*option_text, ','))
{
try
{
result.emplace_back(parser.Evaluate<T>(token));
}
catch (const std::invalid_argument&) {}
}
return result;
}
| 12,036
|
C++
|
.h
| 273
| 41.435897
| 208
| 0.763856
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,620
|
GraphicPackError.h
|
cemu-project_Cemu/src/Cafe/GraphicPack/GraphicPackError.h
|
#pragma once
class PatchErrorHandler
{
public:
enum class STAGE
{
PARSER,
APPLY,
};
void setCurrentGraphicPack(class GraphicPack2* gp)
{
m_gp = gp;
}
void setStage(STAGE s)
{
m_stage = s;
}
void printError(class PatchGroup* patchGroup, sint32 lineNumber, std::string_view errorMsg);
void showStageErrorMessageBox();
bool hasError() const { return m_anyErrorTriggered; };
class GraphicPack2* m_gp{};
bool m_anyErrorTriggered{};
STAGE m_stage{ STAGE::PARSER };
std::vector<std::string> errorMessages; // if patch logging is enabled also remember error msgs for the message box
};
| 609
|
C++
|
.h
| 25
| 22.12
| 116
| 0.757366
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,621
|
GraphicPack2Patches.h
|
cemu-project_Cemu/src/Cafe/GraphicPack/GraphicPack2Patches.h
|
#pragma once
class PatchGroup;
#include "GraphicPackError.h"
struct PatchContext_t
{
struct UnresolvedSymbol
{
sint32 lineNumber;
PatchGroup* patchGroup;
std::string symbolName;
UnresolvedSymbol(sint32 _lineNumber, PatchGroup* _patchGroup, std::string _symbolName) : lineNumber(_lineNumber), patchGroup(_patchGroup), symbolName(_symbolName) {};
bool operator < (const UnresolvedSymbol &other) const
{
if (lineNumber == other.lineNumber)
return symbolName.compare(other.symbolName);
return lineNumber < other.lineNumber;
}
};
class GraphicPack2* graphicPack;
//MEMPTR<void> codeCaveStart;
//MEMPTR<void> codeCaveEnd;
const RPLModule* matchedModule;
std::unordered_map<std::string, uint32> map_values;
// error information
//std::unordered_set<std::string> unresolvedSymbols;
std::set<UnresolvedSymbol> unresolvedSymbols;
//std::unordered_multiset<sint32, std::greater<std::string>> unresolvedSymbols;
// error handler
PatchErrorHandler errorHandler{};
};
enum class PATCH_RESOLVE_RESULT
{
RESOLVED, // successfully resolved any expressions or relocations
EXPRESSION_ERROR, // syntax error in expression (usually this should be detected during the parsing stage already)
VALUE_ERROR, // expression evaluated but the result is not useable (e.g. branch target out of range)
UNKNOWN_VARIABLE, // variable not known or referencing unresolved variable (try again)
VARIABLE_CONFLICT, // a variable or label with the same name was already defined
INVALID_ADDRESS, // attempted to relocate address that is not within any known section
UNDEFINED_ERROR, // unexpected error
};
enum class EXPRESSION_RESOLVE_RESULT
{
AVAILABLE,
EXPRESSION_ERROR,
UNKNOWN_VARIABLE
};
class PatchEntry
{
public:
PatchEntry() {};
virtual ~PatchEntry() {};
// apply relocation or evaluate any expressions for this entry
virtual PATCH_RESOLVE_RESULT resolve(PatchContext_t& ctx) = 0;
};
// represents symbol assignment (always treated like an address)
// <symbolName> = <expression>
class PatchEntryCemuhookSymbolValue : public PatchEntry
{
public:
PatchEntryCemuhookSymbolValue(sint32 lineNumber, const char* symbolName, const sint32 symbolNameLen, const char* expressionStr, const sint32 expressionLen) : PatchEntry(), m_lineNumber(lineNumber)
{
m_symbolName.assign(symbolName, symbolNameLen);
m_expressionString.assign(expressionStr, expressionLen);
}
sint32 getLineNumber() { return m_lineNumber; }
PATCH_RESOLVE_RESULT resolve(PatchContext_t& ctx) override;
std::string& getSymbolName() { return m_symbolName; }
private:
sint32 m_lineNumber;
std::string m_symbolName;
std::string m_expressionString;
uint32 m_resolvedValue;
bool m_isResolved{};
};
enum class PATCHVARTYPE
{
DOUBLE,
INT, // 32bit signed integer
UINT, // 32bit unsigned integer or pointer
//BOOL, // boolean
};
// represents variable value assignment
// unlike Cemu symbols these are treated as a
// <symbolName> = <expression>
class PatchEntryVariableValue : public PatchEntry
{
public:
PatchEntryVariableValue(sint32 lineNumber, const char* symbolName, const sint32 symbolNameLen, PATCHVARTYPE varType, const char* expressionStr, const sint32 expressionLen) : PatchEntry(), m_lineNumber(lineNumber), m_varType(varType)
{
m_symbolName.assign(symbolName, symbolNameLen);
m_expressionString.assign(expressionStr, expressionLen);
}
sint32 getLineNumber() { return m_lineNumber; }
PATCH_RESOLVE_RESULT resolve(PatchContext_t& ctx) override;
std::string& getSymbolName() { return m_symbolName; }
//uint32 getSymbolValue() { return m_resolvedValue; }
private:
sint32 m_lineNumber;
std::string m_symbolName;
std::string m_expressionString;
PATCHVARTYPE m_varType;
std::variant<sint32, uint32, double> m_resolvedValue;
bool m_isResolved{};
};
// represents a label
class PatchEntryLabel : public PatchEntry
{
public:
PatchEntryLabel(sint32 lineNumber, const char* symbolName, const sint32 symbolNameLen) : PatchEntry(), m_lineNumber(lineNumber)
{
m_symbolName.assign(symbolName, symbolNameLen);
}
sint32 getLineNumber() { return m_lineNumber; }
PATCH_RESOLVE_RESULT resolve(PatchContext_t& ctx) override;
std::string& getSymbolName() { return m_symbolName; }
uint32 getSymbolValue() { return m_relocatedAddress; }
void setAssignedVA(uint32 virtualAddress)
{
m_address = virtualAddress;
}
private:
sint32 m_lineNumber;
std::string m_symbolName;
uint32 m_address;
uint32 m_relocatedAddress;
bool m_isResolved{};
};
// represents assembled code/data
class PatchEntryInstruction : public PatchEntry
{
public:
PatchEntryInstruction(sint32 lineNumber, uint32 patchAddr, std::span<uint8> data, std::vector<PPCAssemblerReloc>& list_relocs) : PatchEntry(), m_lineNumber(lineNumber), m_addr(patchAddr), m_size((uint32)data.size()), m_relocs(list_relocs)
{
sint32 dataLength = (sint32)data.size();
m_length = dataLength;
m_data = new uint8[dataLength];
m_dataWithRelocs = new uint8[dataLength];
m_dataBackup = new uint8[dataLength];
memcpy(m_data, data.data(), dataLength);
memcpy(m_dataWithRelocs, data.data(), dataLength);
}
~PatchEntryInstruction()
{
if (m_data)
delete[] m_data;
if (m_dataWithRelocs)
delete[] m_dataWithRelocs;
if (m_dataBackup)
delete[] m_dataBackup;
}
uint32 getAddr() const
{
return m_addr;
}
uint32 getRelocatedAddr()
{
return m_relocatedAddr;
}
uint32 getSize() const
{
return m_size;
}
PATCH_RESOLVE_RESULT resolve(PatchContext_t& ctx) override;
PATCH_RESOLVE_RESULT resolveReloc(PatchContext_t& ctx, PPCAssemblerReloc* reloc);
void applyPatch();
void undoPatch();
private:
uint8* m_data{}; // original unrelocated data
uint8* m_dataWithRelocs{}; // data with relocs applied
uint8* m_dataBackup{}; // original data before patch was applied
sint32 m_length{};
std::vector<PPCAssemblerReloc> m_relocs;
uint32 m_lineNumber;
uint32 m_addr;
uint32 m_size;
uint32 m_relocatedAddr;
bool m_addrRelocated{};
};
class PatchGroup
{
friend class GraphicPack2;
public:
PatchGroup(class GraphicPack2* gp, const char* nameStr, sint32 nameLength) : graphicPack(gp)
{
name = std::string(nameStr, nameLength);
}
bool matchesCRC(uint32 crc)
{
for (auto& chk : list_moduleMatches)
{
if (chk == crc)
return true;
}
return false;
}
uint32 getCodeCaveBase()
{
return codeCaveMem.GetMPTR();
}
uint32 getCodeCaveSize()
{
return codeCaveSize;
}
std::string_view getName()
{
return name;
}
void setApplied() { m_isApplied = true; }
void resetApplied() { m_isApplied = false; }
bool isApplied() const { return m_isApplied; }
private:
class GraphicPack2* graphicPack;
std::string name;
std::vector<uint32> list_moduleMatches;
std::vector<PatchEntry*> list_patches;
uint32 codeCaveSize;
MEMPTR<void> codeCaveMem;
bool m_isApplied{};
};
| 6,815
|
C++
|
.h
| 219
| 28.908676
| 239
| 0.774489
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,622
|
TitleList.h
|
cemu-project_Cemu/src/Cafe/TitleList/TitleList.h
|
#pragma once
#include "TitleInfo.h"
#include "GameInfo.h"
struct CafeTitleListCallbackEvent
{
enum class TYPE
{
TITLE_DISCOVERED,
TITLE_REMOVED,
SCAN_FINISHED,
};
TYPE eventType;
TitleInfo* titleInfo;
};
class CafeTitleList
{
public:
static void Initialize(const fs::path cacheXmlFile);
static void LoadCacheFile();
static void StoreCacheFile();
static void ClearScanPaths();
static void AddScanPath(fs::path path);
static void SetMLCPath(fs::path path);
static void Refresh(); // scan all paths
static bool IsScanning(); // returns true if async refresh is currently active
static void WaitForMandatoryScan(); // wait for current scan result if no cached info is available
static void AddTitleFromPath(fs::path path);
static uint64 RegisterCallback(void(*cb)(CafeTitleListCallbackEvent* evt, void* ctx), void* ctx); // on register, the callback will be invoked for every already known title
static void UnregisterCallback(uint64 id);
// utility functions
static bool HasTitle(TitleId titleId, uint16& versionOut);
static bool HasTitleAndVersion(TitleId titleId, uint16 version);
static std::vector<TitleId> GetAllTitleIds();
static bool GetFirstByTitleId(TitleId titleId, TitleInfo& titleInfoOut);
static bool FindBaseTitleId(TitleId titleId, TitleId& titleIdBaseOut);
static std::span<TitleInfo*> AcquireInternalList();
static void ReleaseInternalList();
static GameInfo2 GetGameInfo(TitleId titleId);
static TitleInfo GetTitleInfoByUID(uint64 uid);
private:
static bool RefreshWorkerThread();
static void ScanGamePath(const fs::path& path);
static void ScanMLCPath(const fs::path& path);
static void AddDiscoveredTitle(TitleInfo* titleInfo);
static void AddTitle(TitleInfo* titleInfo);
};
| 1,740
|
C++
|
.h
| 46
| 35.782609
| 173
| 0.804038
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,623
|
SaveList.h
|
cemu-project_Cemu/src/Cafe/TitleList/SaveList.h
|
#pragma once
#include "SaveInfo.h"
struct CafeSaveListCallbackEvent
{
enum class TYPE
{
SAVE_DISCOVERED,
SAVE_REMOVED,
SCAN_FINISHED,
};
TYPE eventType;
SaveInfo* saveInfo;
};
class CafeSaveList
{
public:
static void Initialize();
static void SetMLCPath(fs::path mlcPath);
static void Refresh();
static SaveInfo GetSaveByTitleId(TitleId titleId);
// callback
static uint64 RegisterCallback(void(*cb)(CafeSaveListCallbackEvent* evt, void* ctx), void* ctx); // on register, the callback will be invoked for every already known save
static void UnregisterCallback(uint64 id);
private:
static void RefreshThreadWorker();
static void DiscoveredSave(SaveInfo* saveInfo);
};
| 693
|
C++
|
.h
| 27
| 23.740741
| 171
| 0.797277
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,624
|
ParsedMetaXml.h
|
cemu-project_Cemu/src/Cafe/TitleList/ParsedMetaXml.h
|
#pragma once
#include <pugixml.hpp>
#include "config/CemuConfig.h"
struct ParsedMetaXml
{
uint32 m_version;
std::string m_product_code;
std::string m_company_code;
std::string m_content_platform;
uint64 m_title_id;
CafeConsoleRegion m_region;
std::array<std::string, 12> m_long_name;
std::array<std::string, 12> m_short_name;
std::array<std::string, 12> m_publisher;
uint32 m_olv_accesskey;
std::string GetShortName(CafeConsoleLanguage languageId) const
{
return m_short_name[(size_t)languageId].empty() ? m_short_name[(size_t)CafeConsoleLanguage::EN] : m_short_name[(size_t)languageId];
}
std::string GetLongName(CafeConsoleLanguage languageId) const
{
return m_long_name[(size_t)languageId].empty() ? m_long_name[(size_t)CafeConsoleLanguage::EN] : m_long_name[(size_t)languageId];
}
TitleId GetTitleId() const
{
return m_title_id;
}
uint16 GetTitleVersion() const
{
return (uint16)m_version;
}
CafeConsoleRegion GetRegion() const
{
return m_region;
}
std::string GetProductCode() const
{
return m_product_code;
}
std::string GetCompanyCode() const
{
return m_company_code;
}
uint32 GetOlvAccesskey() const
{
return m_olv_accesskey;
}
static ParsedMetaXml* Parse(uint8* xmlData, size_t xmlSize)
{
if (xmlSize == 0)
return nullptr;
pugi::xml_document meta_doc;
if (!meta_doc.load_buffer_inplace(xmlData, xmlSize))
return nullptr;
const auto root = meta_doc.child("menu");
if (!root)
return nullptr;
ParsedMetaXml* parsedMetaXml = new ParsedMetaXml();
for (const auto& child : root.children())
{
std::string_view name = child.name();
if (name == "title_version")
parsedMetaXml->m_version = child.text().as_uint();
else if (name == "product_code")
parsedMetaXml->m_product_code = child.text().as_string();
else if (name == "company_code")
parsedMetaXml->m_company_code = child.text().as_string();
else if (name == "content_platform")
parsedMetaXml->m_content_platform = child.text().as_string();
else if (name == "title_id")
parsedMetaXml->m_title_id = std::stoull(child.text().as_string(), nullptr, 16);
else if (name == "region")
parsedMetaXml->m_region = (CafeConsoleRegion)child.text().as_uint();
else if (boost::starts_with(name, "longname_"))
{
const sint32 index = GetLanguageIndex(name.substr(std::size("longname_") - 1));
if (index != -1){
std::string longname = child.text().as_string();
std::replace_if(longname.begin(), longname.end(), [](char c) { return c == '\r' || c == '\n';}, ' ');
parsedMetaXml->m_long_name[index] = longname;
}
}
else if (boost::starts_with(name, L"shortname_"))
{
const sint32 index = GetLanguageIndex(name.substr(std::size("shortname_") - 1));
if (index != -1)
parsedMetaXml->m_short_name[index] = child.text().as_string();
}
else if (boost::starts_with(name, L"publisher_"))
{
const sint32 index = GetLanguageIndex(name.substr(std::size("publisher_") - 1));
if (index != -1)
parsedMetaXml->m_publisher[index] = child.text().as_string();
}
else if (boost::starts_with(name, L"olv_accesskey"))
parsedMetaXml->m_olv_accesskey = child.text().as_uint(-1);
}
if (parsedMetaXml->m_title_id == 0)
{
// not valid
delete parsedMetaXml;
return nullptr;
}
return parsedMetaXml;
}
private:
static sint32 GetLanguageIndex(std::string_view language) // move to NCrypto ?
{
if (language == "ja")
return (sint32)CafeConsoleLanguage::JA;
else if (language == "en")
return (sint32)CafeConsoleLanguage::EN;
else if (language == "fr")
return (sint32)CafeConsoleLanguage::FR;
else if (language == "de")
return (sint32)CafeConsoleLanguage::DE;
else if (language == "it")
return (sint32)CafeConsoleLanguage::IT;
else if (language == "es")
return (sint32)CafeConsoleLanguage::ES;
else if (language == "zhs")
return (sint32)CafeConsoleLanguage::ZH;
else if (language == "ko")
return (sint32)CafeConsoleLanguage::KO;
else if (language == "nl")
return (sint32)CafeConsoleLanguage::NL;
else if (language == "pt")
return (sint32)CafeConsoleLanguage::PT;
else if (language == "ru")
return (sint32)CafeConsoleLanguage::RU;
else if (language == "zht")
return (sint32)CafeConsoleLanguage::TW; // if return ZH here, xxx_zht values may cover xxx_zh values in function Parse()
return -1;
}
};
| 4,405
|
C++
|
.h
| 135
| 29.325926
| 133
| 0.690806
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,625
|
AppType.h
|
cemu-project_Cemu/src/Cafe/TitleList/AppType.h
|
#pragma once
enum class APP_TYPE : uint32
{
GAME = 0x80000000,
GAME_UPDATE = 0x0800001B,
GAME_DLC = 0x0800000E,
// data titles
VERSION_DATA_TITLE = 0x10000015,
DRC_FIRMWARE = 0x10000013,
DRC_TEXTURE_ATLAS = 0x1000001A,
};
// allow direct comparison with uint32
inline bool operator==(APP_TYPE lhs, uint32 rhs)
{
return static_cast<uint32>(lhs) == rhs;
}
inline bool operator==(uint32 lhs, APP_TYPE rhs)
{
return lhs == static_cast<uint32>(rhs);
}
| 459
|
C++
|
.h
| 20
| 21.35
| 48
| 0.747706
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,626
|
TitleId.h
|
cemu-project_Cemu/src/Cafe/TitleList/TitleId.h
|
#pragma once
using TitleId = uint64;
static_assert(sizeof(TitleId) == 8);
class TitleIdParser
{
public:
enum class TITLE_TYPE
{
/* XX */ UNKNOWN = 0xFF, // placeholder
/* 00 */ BASE_TITLE = 0x00, // eShop and disc titles
/* 02 */ BASE_TITLE_DEMO = 0x02,
/* 0E */ BASE_TITLE_UPDATE = 0x0E, // update for BASE_TITLE (and maybe BASE_TITLE_DEMO?)
/* 0F */ HOMEBREW = 0x0F,
/* 0C */ AOC = 0x0C, // DLC
/* 10 */ SYSTEM_TITLE = 0x10, // eShop etc
/* 1B */ SYSTEM_DATA = 0x1B,
/* 30 */ SYSTEM_OVERLAY_TITLE = 0x30,
};
TitleIdParser(uint64 titleId) : m_titleId(titleId) {};
// controls whether this title installs to /usr/title or /sys/title
bool IsSystemTitle() const
{
return (GetTypeByte() & 0x10) != 0;
};
bool IsBaseTitleUpdate() const
{
return GetType() == TITLE_TYPE::BASE_TITLE_UPDATE;
}
TITLE_TYPE GetType() const
{
uint8 b = GetTypeByte();
switch (b)
{
case 0x00:
return TITLE_TYPE::BASE_TITLE;
case 0x02:
return TITLE_TYPE::BASE_TITLE_DEMO;
case 0x0E:
return TITLE_TYPE::BASE_TITLE_UPDATE;
case 0x0F:
return TITLE_TYPE::HOMEBREW;
case 0x0C:
return TITLE_TYPE::AOC;
case 0x10:
return TITLE_TYPE::SYSTEM_TITLE;
case 0x1B:
return TITLE_TYPE::SYSTEM_DATA;
case 0x30:
return TITLE_TYPE::SYSTEM_OVERLAY_TITLE;
}
cemuLog_log(LogType::Force, "Unknown title type ({0:016x})", m_titleId);
return TITLE_TYPE::UNKNOWN;
}
bool IsPlatformCafe() const
{
return GetPlatformWord() == 0x0005;
}
bool CanHaveSeparateUpdateTitleId() const
{
return GetType() == TITLE_TYPE::BASE_TITLE;
}
TitleId GetSeparateUpdateTitleId() const
{
cemu_assert_debug(CanHaveSeparateUpdateTitleId());
return MakeTitleIdWithType(TITLE_TYPE::BASE_TITLE_UPDATE); // e.g. 00050000-11223344 -> 0005000E-11223344
}
static TitleId MakeBaseTitleId(TitleId titleId)
{
TitleIdParser titleIdParser(titleId);
if (titleIdParser.GetType() == TITLE_TYPE::BASE_TITLE_UPDATE)
return titleIdParser.MakeTitleIdWithType(TITLE_TYPE::BASE_TITLE);
return titleId;
}
static bool ParseFromStr(std::string_view strView, TitleId& titleIdOut)
{
if (strView.size() < 16)
return false;
uint64 tmp = 0;
for (size_t i = 0; i < 8*2; i++)
{
tmp <<= 4;
char c = strView[i];
if (c >= 'A' && c <= 'F')
tmp += (uint64)(c - 'A' + 10);
else if (c >= 'a' && c <= 'f')
tmp += (uint64)(c - 'a' + 10);
else if (c >= '0' && c <= '9')
tmp += (uint64)(c - '0');
else
return false;
}
titleIdOut = tmp;
return true;
}
private:
uint8 GetTypeByte() const
{
return (m_titleId >> 32) & 0xFF;
}
TitleId MakeTitleIdWithType(TITLE_TYPE newType) const
{
TitleId t = m_titleId;
t &= ~(0xFFull << 32);
t |= ((uint64)newType << 32);
return t;
}
uint16 GetPlatformWord() const // might not be a whole word?
{
return (m_titleId >> 48) & 0xFFFF;
}
TitleId m_titleId;
};
| 2,879
|
C++
|
.h
| 112
| 22.830357
| 107
| 0.667394
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,627
|
TitleInfo.h
|
cemu-project_Cemu/src/Cafe/TitleList/TitleInfo.h
|
#pragma once
#include "Cafe/Filesystem/fsc.h"
#include "config/CemuConfig.h" // for CafeConsoleRegion. Move to NCrypto?
#include "TitleId.h"
#include "AppType.h"
#include "ParsedMetaXml.h"
enum class CafeTitleFileType
{
UNKNOWN,
WUD,
WUX,
RPX,
ELF,
};
CafeTitleFileType DetermineCafeSystemFileType(fs::path filePath);
struct ParsedAppXml
{
uint64 title_id;
uint16 title_version;
uint32 app_type;
uint32 group_id;
uint32 sdk_version;
};
enum class CosCapabilityGroup : uint32
{
None = 0,
BSP = 1,
DK = 3,
USB = 9,
UHS = 12,
FS = 11,
MCP = 13,
NIM = 14,
ACT = 15,
FPD = 16,
BOSS = 17,
ACP = 18,
PDM = 19,
AC = 20,
NDM = 21,
NSEC = 22
};
enum class CosCapabilityBits : uint64
{
All = 0xFFFFFFFFFFFFFFFFull
};
enum class CosCapabilityBitsFS : uint64
{
ODD_READ = (1llu << 0),
ODD_WRITE = (1llu << 1),
ODD_RAW_OPEN = (1llu << 2),
ODD_MOUNT = (1llu << 3),
SLCCMPT_READ = (1llu << 4),
SLCCMPT_WRITE = (1llu << 5),
SLCCMPT_RAW_OPEN = (1llu << 6),
SLCCMPT_MOUNT = (1llu << 7),
SLC_READ = (1llu << 8),
SLC_WRITE = (1llu << 9),
SLC_RAW_OPEN = (1llu << 10),
SLC_MOUNT = (1llu << 11),
MLC_READ = (1llu << 12),
MLC_WRITE = (1llu << 13),
MLC_RAW_OPEN = (1llu << 14),
MLC_MOUNT = (1llu << 15),
SDCARD_READ = (1llu << 16),
SDCARD_WRITE = (1llu << 17),
SDCARD_RAW_OPEN = (1llu << 18),
SDCARD_MOUNT = (1llu << 19),
HFIO_READ = (1llu << 20),
HFIO_WRITE = (1llu << 21),
HFIO_RAW_OPEN = (1llu << 22),
HFIO_MOUNT = (1llu << 23),
RAMDISK_READ = (1llu << 24),
RAMDISK_WRITE = (1llu << 25),
RAMDISK_RAW_OPEN = (1llu << 26),
RAMDISK_MOUNT = (1llu << 27),
USB_READ = (1llu << 28),
USB_WRITE = (1llu << 29),
USB_RAW_OPEN = (1llu << 30),
USB_MOUNT = (1llu << 31),
OTHER_READ = (1llu << 32),
OTHER_WRITE = (1llu << 33),
OTHER_RAW_OPEN = (1llu << 34),
OTHER_MOUNT = (1llu << 35)
};
ENABLE_BITMASK_OPERATORS(CosCapabilityBitsFS);
struct ParsedCosXml
{
public:
std::string argstr;
struct Permission
{
CosCapabilityGroup group{CosCapabilityGroup::None};
CosCapabilityBits mask{CosCapabilityBits::All};
};
Permission permissions[19]{};
static ParsedCosXml* Parse(uint8* xmlData, size_t xmlLen);
CosCapabilityBits GetCapabilityBits(CosCapabilityGroup group) const
{
for (const auto& perm : permissions)
{
if (perm.group == group)
return perm.mask;
}
return CosCapabilityBits::All;
}
};
class TitleInfo
{
public:
enum class TitleDataFormat
{
HOST_FS = 1, // host filesystem directory (fullPath points to root with content/code/meta subfolders)
WUD = 2, // WUD or WUX
WIIU_ARCHIVE = 3, // Wii U compressed single-file archive (.wua)
NUS = 4, // NUS format. Directory with .app files, title.tik and title.tmd
WUHB = 5,
// error
INVALID_STRUCTURE = 0,
};
enum class InvalidReason : uint8
{
NONE = 0,
BAD_PATH_OR_INACCESSIBLE = 1,
UNKNOWN_FORMAT = 2,
NO_DISC_KEY = 3,
NO_TITLE_TIK = 4,
MISSING_XML_FILES = 4,
};
struct CachedInfo
{
TitleDataFormat titleDataFormat;
fs::path path;
std::string subPath; // for WUA
uint64 titleId;
uint16 titleVersion;
uint32 sdkVersion;
std::string titleName;
CafeConsoleRegion region;
uint32 group_id;
uint32 app_type;
};
TitleInfo() : m_isValid(false) {};
TitleInfo(const fs::path& path);
TitleInfo(const fs::path& path, std::string_view subPath);
TitleInfo(const CachedInfo& cachedInfo);
~TitleInfo();
TitleInfo(const TitleInfo& other)
{
Copy(other);
}
TitleInfo& operator=(TitleInfo other)
{
Copy(other);
return *this;
}
bool IsCached() { return m_cachedInfo; }; // returns true if this TitleInfo was loaded from cache and has not yet been parsed
CachedInfo MakeCacheEntry();
bool IsValid() const;
InvalidReason GetInvalidReason() const { return m_invalidReason; }
uint64 GetUID(); // returns a unique identifier derived from the absolute canonical title location which can be used to identify this title by its location. May not persist across sessions, especially when Cemu is used portable
fs::path GetPath() const;
TitleDataFormat GetFormat() const { return m_titleFormat; };
bool Mount(std::string_view virtualPath, std::string_view subfolder, sint32 mountPriority);
void Unmount(std::string_view virtualPath);
void UnmountAll();
bool IsMounted() const { return !m_mountpoints.empty(); }
bool ParseXmlInfo();
bool HasValidXmlInfo() const { return m_parsedMetaXml && m_parsedAppXml && m_parsedCosXml; };
bool IsEqualByLocation(const TitleInfo& rhs) const
{
return m_uid == rhs.m_uid;
}
bool IsSystemDataTitle() const
{
if(!IsValid())
return false;
uint32 appType = GetAppType();
return appType == APP_TYPE::DRC_FIRMWARE || appType == APP_TYPE::DRC_TEXTURE_ATLAS || appType == APP_TYPE::VERSION_DATA_TITLE;
}
// API which requires parsed meta data or cached info
TitleId GetAppTitleId() const; // from app.xml
uint16 GetAppTitleVersion() const; // from app.xml
uint32 GetAppSDKVersion() const; // from app.xml
uint32 GetAppGroup() const; // from app.xml
uint32 GetAppType() const; // from app.xml
std::string GetMetaTitleName() const; // from meta.xml
CafeConsoleRegion GetMetaRegion() const; // from meta.xml
uint32 GetOlvAccesskey() const;
// cos.xml
std::string GetArgStr() const;
// meta.xml also contains a version field which seems to match the one from app.xml
// the titleId in meta.xml seems to be the title id of the base game for updates specifically. For AOC content it's the AOC's titleId
TitleIdParser::TITLE_TYPE GetTitleType();
ParsedMetaXml* GetMetaInfo()
{
return m_parsedMetaXml;
}
ParsedCosXml* GetCosInfo()
{
return m_parsedCosXml;
}
std::string GetPrintPath() const; // formatted path including type and WUA subpath. Intended for logging and user-facing information
std::string GetInstallPath() const; // installation subpath, relative to storage base. E.g. "usr/title/.../..." or "sys/title/.../..."
static std::string GetUniqueTempMountingPath();
static bool ParseWuaTitleFolderName(std::string_view name, TitleId& titleIdOut, uint16& titleVersionOut);
private:
void Copy(const TitleInfo& other)
{
m_isValid = other.m_isValid;
m_titleFormat = other.m_titleFormat;
m_fullPath = other.m_fullPath;
m_subPath = other.m_subPath;
m_hasParsedXmlFiles = other.m_hasParsedXmlFiles;
m_parsedMetaXml = nullptr;
m_parsedAppXml = nullptr;
if (other.m_parsedMetaXml)
m_parsedMetaXml = new ParsedMetaXml(*other.m_parsedMetaXml);
if (other.m_parsedAppXml)
m_parsedAppXml = new ParsedAppXml(*other.m_parsedAppXml);
if (other.m_parsedCosXml)
m_parsedCosXml = new ParsedCosXml(*other.m_parsedCosXml);
if (other.m_cachedInfo)
m_cachedInfo = new CachedInfo(*other.m_cachedInfo);
m_mountpoints.clear();
m_wudVolume = nullptr;
}
bool DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataFormat& formatOut);
void CalcUID();
void SetInvalidReason(InvalidReason reason);
ParsedMetaXml* ParseAromaIni(std::span<unsigned char> content);
bool ParseAppXml(std::vector<uint8>& appXmlData);
bool m_isValid{ false };
TitleDataFormat m_titleFormat{ TitleDataFormat::INVALID_STRUCTURE };
fs::path m_fullPath;
std::string m_subPath; // used for formats where fullPath isn't unique on its own (like WUA)
uint64 m_uid{};
InvalidReason m_invalidReason{ InvalidReason::NONE }; // if m_isValid == false, this contains a more detailed error code
// mounting info
std::vector<std::pair<sint32, std::string>> m_mountpoints;
class FSTVolume* m_wudVolume{};
class ZArchiveReader* m_zarchive{};
class WUHBReader* m_wuhbreader{};
// xml info
bool m_hasParsedXmlFiles{ false };
ParsedMetaXml* m_parsedMetaXml{};
ParsedAppXml* m_parsedAppXml{};
ParsedCosXml* m_parsedCosXml{};
// cached info if called with cache constructor
CachedInfo* m_cachedInfo{nullptr};
};
| 7,970
|
C++
|
.h
| 251
| 29.438247
| 228
| 0.706939
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,628
|
SaveInfo.h
|
cemu-project_Cemu/src/Cafe/TitleList/SaveInfo.h
|
#pragma once
#include "TitleId.h"
#include "ParsedMetaXml.h"
class SaveInfo
{
public:
SaveInfo() {};
SaveInfo(TitleId titleId);
bool IsValid() const { return m_isValid; }
TitleId GetTitleId() const { return m_titleId; }
fs::path GetPath() const { return m_path; }
// meta data
bool ParseMetaData();
ParsedMetaXml* GetMetaInfo() { return m_parsedMetaXml; }
private:
static std::string GetStorageSubpathByTitleId(TitleId titleId);
static fs::path GetSavePath(TitleId titleId);
TitleId m_titleId;
fs::path m_path;
bool m_isValid{false};
bool m_hasMetaLoaded{false};
ParsedMetaXml* m_parsedMetaXml{nullptr};
};
| 628
|
C++
|
.h
| 23
| 25.391304
| 64
| 0.764608
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
23,629
|
GameInfo.h
|
cemu-project_Cemu/src/Cafe/TitleList/GameInfo.h
|
#pragma once
#include "config/CemuConfig.h"
#include "TitleInfo.h"
#include "config/ActiveSettings.h"
class GameInfo2
{
public:
~GameInfo2()
{
m_base.UnmountAll();
m_update.UnmountAll();
for (auto& it : m_aoc)
it.UnmountAll();
}
bool IsValid() const
{
return m_base.IsValid(); // at least the base must be valid for this to be a runnable title
}
bool IsSystemDataTitle() const
{
return m_base.IsSystemDataTitle();
}
void SetBase(const TitleInfo& titleInfo)
{
if (IsPrioritizedVersionOrFormat(m_base, titleInfo))
m_base = titleInfo;
}
void SetUpdate(const TitleInfo& titleInfo)
{
if (IsPrioritizedVersionOrFormat(m_update, titleInfo))
m_update = titleInfo;
}
bool HasUpdate() const
{
return m_update.IsValid();
}
void AddAOC(const TitleInfo& titleInfo)
{
TitleId aocTitleId = titleInfo.GetAppTitleId();
uint16 aocVersion = titleInfo.GetAppTitleVersion();
auto it = std::find_if(m_aoc.begin(), m_aoc.end(), [aocTitleId](const TitleInfo& rhs) { return rhs.GetAppTitleId() == aocTitleId; });
if (it != m_aoc.end())
{
if (!IsPrioritizedVersionOrFormat(*it, titleInfo))
return;
m_aoc.erase(it);
}
m_aoc.emplace_back(titleInfo);
}
bool HasAOC() const
{
return !m_aoc.empty();
}
TitleInfo& GetBase()
{
return m_base;
}
TitleInfo& GetUpdate()
{
return m_update;
}
std::span<TitleInfo> GetAOC()
{
return m_aoc;
}
TitleId GetBaseTitleId()
{
cemu_assert_debug(m_base.IsValid());
return m_base.GetAppTitleId();
}
std::string GetTitleName()
{
cemu_assert_debug(m_base.IsValid());
return m_base.GetMetaTitleName(); // long name
}
uint16 GetVersion() const
{
if (m_update.IsValid())
return m_update.GetAppTitleVersion();
return m_base.GetAppTitleVersion();
}
uint32 GetSDKVersion() const
{
if (m_update.IsValid())
return m_update.GetAppSDKVersion();
return m_base.GetAppSDKVersion();
}
CafeConsoleRegion GetRegion() const
{
if (m_update.IsValid())
return m_update.GetMetaRegion();
return m_base.GetMetaRegion();
}
uint16 GetAOCVersion() const
{
if (m_aoc.empty())
return 0;
return m_aoc.front().GetAppTitleVersion();
}
fs::path GetSaveFolder()
{
return ActiveSettings::GetMlcPath(fmt::format("usr/save/{:08x}/{:08x}", (GetBaseTitleId() >> 32), GetBaseTitleId() & 0xFFFFFFFF));
}
private:
bool IsPrioritizedVersionOrFormat(const TitleInfo& currentTitle, const TitleInfo& newTitle)
{
if (!currentTitle.IsValid())
return true; // always prefer a valid title over an invalid one
// always prefer higher version
if (newTitle.GetAppTitleVersion() > currentTitle.GetAppTitleVersion())
return true;
// never prefer lower version
if (newTitle.GetAppTitleVersion() < currentTitle.GetAppTitleVersion())
return false;
// for users which have both NUS and non-NUS titles in their games folder we want to prioritize non-NUS formats
// this is to stay consistent with previous Cemu versions which did not support NUS format at all
TitleInfo::TitleDataFormat currentFormat = currentTitle.GetFormat();
TitleInfo::TitleDataFormat newFormat = newTitle.GetFormat();
if (currentFormat != TitleInfo::TitleDataFormat::NUS && newFormat == TitleInfo::TitleDataFormat::NUS)
return false;
return true;
};
TitleInfo m_base;
TitleInfo m_update;
std::vector<TitleInfo> m_aoc;
};
| 3,344
|
C++
|
.h
| 126
| 23.865079
| 135
| 0.733896
|
cemu-project/Cemu
| 7,119
| 558
| 254
|
MPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.