mirror of
https://github.com/DaedalusX64/daedalus.git
synced 2024-05-18 03:50:47 -04:00
Compiles and launches, doesn't get to games yet :)
This commit is contained in:
parent
73827031bf
commit
5b8fb28b57
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -25,3 +25,5 @@ Source/tmp
|
|||
*build
|
||||
*build_*
|
||||
.vs/
|
||||
.*cia
|
||||
*.3dsx
|
|
@ -161,6 +161,8 @@ list(APPEND plat_main )
|
|||
if(CTR)
|
||||
include_directories($ENV{DEVKITPRO}/portlibs/3ds/include)
|
||||
include_directories($ENV{DEVKITPRO}/PicaGL/include)
|
||||
link_directories($ENV{DEVKITPRO}/PicaGL/lib)
|
||||
include_directories($ENV{DEVKITPRO}/portlibs/3ds/lib)
|
||||
endif(CTR)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -221,7 +223,7 @@ if(WIN32)
|
|||
|
||||
# --- Build ----
|
||||
add_executable(daedalus ${plat_main})
|
||||
list(APPEND default_libraries imgui png z picaGL DynaRec ctru) ## Required Libraries
|
||||
list(APPEND default_libraries png z DynaRec) ## Required Libraries
|
||||
target_include_directories(daedalus BEFORE PUBLIC ${include_dirs})
|
||||
target_link_libraries(daedalus PRIVATE ${daed_libs} ${default_libraries} ${sys_libraries} )
|
||||
|
||||
|
@ -235,6 +237,47 @@ if(WIN32)
|
|||
TITLE DaedalusX64
|
||||
)
|
||||
endif(PSP)
|
||||
|
||||
if(CTR)
|
||||
set(APP_TITLE "DaedalusX64")
|
||||
set(APP_DESCRIPTION "DaedalusX64 port for 3DS")
|
||||
set(APP_AUTHOR "MasterFeizz / DaedalusX64 Team")
|
||||
|
||||
set(APP_SMDH "${PROJECT_SOURCE_DIR}/SysCTR/Resources/daedalus.smdh")
|
||||
set(APP_BANNER "${PROJECT_SOURCE_DIR}/SysCTR/Resources/banner.bnr")
|
||||
set(APP_AUDIO "${PROJECT_SOURCE_DIR}/SysCTR/Resources/audio_silent.wav")
|
||||
set(APP_RSF "${PROJECT_SOURCE_DIR}/SysCTR/Resources/template.rsf")
|
||||
set(APP_ROMFS_DIR "${PROJECT_SOURCE_DIR}/SysCTR/Resources/RomFS")
|
||||
set(APP_ROMFS_BIN "${PROJECT_SOURCE_DIR}/SysCTR/Resources/romfs.bin")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DaedalusX64.3dsx
|
||||
COMMAND 3dsxtool daedalus.elf DaedalusX64.3dsx --romfs=${APP_ROMFS_DIR} --smdh=${APP_SMDH}
|
||||
DEPENDS daedalus.elf
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DaedalusX64.cia
|
||||
COMMAND makerom -f cia
|
||||
-target t
|
||||
-exefslogo
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/DaedalusX64.cia
|
||||
-elf daedalus.elf
|
||||
-rsf ${APP_RSF}
|
||||
-banner ${APP_BANNER}
|
||||
-icon ${APP_SMDH}
|
||||
-romfs ${APP_ROMFS_BIN}
|
||||
DEPENDS daedalus.elf ${APP_RSF}
|
||||
)
|
||||
|
||||
# add_custom_target(N3DS ALL
|
||||
# DEPENDS Daedalus.elf
|
||||
# DaedalusX64.3dsx
|
||||
# DaedalusX64.cia
|
||||
# )
|
||||
|
||||
|
||||
endif(CTR)
|
||||
|
||||
## Install and setup basic directories
|
||||
install(DIRECTORY DESTINATION DaedalusX64)
|
||||
|
|
|
@ -39,7 +39,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "SysGL/GL.h"
|
||||
#endif
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
#define HD_SCALE 0.8f
|
||||
#else
|
||||
#define HD_SCALE 0.754166f
|
||||
#endif
|
||||
|
||||
class CNativeTexture;
|
||||
struct TempVerts;
|
||||
|
@ -254,14 +258,23 @@ public:
|
|||
mTnL.TextureScaleY = fScaleY == 0 ? 1/32.0f : fScaleY;
|
||||
}
|
||||
inline u32 GetTextureTile() const { return mTextureTile; }
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
inline void SetCullMode(bool enable, bool mode) { enable ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE); mode ? glCullFace(GL_BACK) : glCullFace(GL_FRONT); }
|
||||
#else
|
||||
inline void SetCullMode(bool enable, bool mode) { mTnL.Flags.TriCull = enable; mTnL.Flags.CullBack = mode; }
|
||||
#endif
|
||||
|
||||
// Fog stuff
|
||||
inline void SetFogMultOffs(f32 Mult, f32 Offs) { mTnL.FogMult=Mult/255.0f; mTnL.FogOffs=Offs/255.0f;}
|
||||
#ifdef DAEDALUS_PSP
|
||||
inline void SetFogMinMax(f32 fog_near, f32 fog_far) { sceGuFog(-fog_near /2000, +fog_far /2000 , mFogColour.GetColour()); }
|
||||
#endif
|
||||
#ifdef DAEDALUS_PSP
|
||||
inline void SetFogMinMax(f32 fog_near, f32 fog_far) { sceGuFog(fog_near, fog_far, mFogColour.GetColour()); }
|
||||
inline void SetFogColour( c32 colour ) { mFogColour = colour; }
|
||||
#elif defined(DAEDALUS_VITA) || defined (DAEDALUS_CTR)
|
||||
inline void SetFogMinMax(f32 fog_near, f32 fog_far) { glFogf(GL_FOG_START, fog_near); glFogf(GL_FOG_END, fog_far); }
|
||||
inline void SetFogColour( c32 colour ) { float fog_clr[4] = {colour.GetRf(), colour.GetGf(), colour.GetBf(), colour.GetAf()}; glFogfv(GL_FOG_COLOR, &fog_clr[0]); }
|
||||
#endif
|
||||
|
||||
|
||||
// PrimDepth will replace the z value if depth_source=1 (z range 32767-0 while PSP depthbuffer range 0-65535)//Corn
|
||||
#ifdef DAEDALUS_PSP
|
||||
|
@ -292,8 +305,8 @@ public:
|
|||
virtual void FillRect( const v2 & xy0, const v2 & xy1, u32 color ) = 0;
|
||||
|
||||
// Texture stuff
|
||||
virtual void Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v0, f32 u1, f32 v1) = 0;
|
||||
virtual void Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3, f32 s, f32 t) = 0;
|
||||
virtual void Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v0, f32 u1, f32 v1, const std::shared_ptr<CNativeTexture> texture) = 0;
|
||||
virtual void Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3, f32 s, f32 t, const std::shared_ptr <CNativeTexture> texture) = 0;
|
||||
|
||||
// Viewport stuff
|
||||
void SetN64Viewport( const v2 & scale, const v2 & trans );
|
||||
|
@ -355,10 +368,13 @@ public:
|
|||
|
||||
virtual void ResetDebugState() {}
|
||||
#endif
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
inline float N64ToScreenX(float x) const { return x * mN64ToScreenScale.x; }
|
||||
inline float N64ToScreenY(float y) const { return y * mN64ToScreenScale.y; }
|
||||
#else
|
||||
inline float N64ToScreenX(float x) const { return x * mN64ToScreenScale.x + mN64ToScreenTranslate.x; }
|
||||
inline float N64ToScreenY(float y) const { return y * mN64ToScreenScale.y + mN64ToScreenTranslate.y; }
|
||||
|
||||
#endif
|
||||
|
||||
std::shared_ptr<CNativeTexture> LoadTextureDirectly( const TextureInfo & ti );
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "Utility/Profiler.h"
|
||||
|
||||
|
||||
|
||||
#ifdef DAEDALUS_DEBUG_DISPLAYLIST
|
||||
#define DL_UNIMPLEMENTED_ERROR( msg ) \
|
||||
{ \
|
||||
|
|
|
@ -21,19 +21,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define HLEGRAPHICS_UCODES_UCODE_FB_H_
|
||||
|
||||
#ifndef DAEDALUS_PSP
|
||||
static bool LoadFrameBuffer(u32 origin)
|
||||
static inline std::shared_ptr<CNativeTexture> LoadFrameBuffer(u32 origin)
|
||||
{
|
||||
u32 width = Memory_VI_GetRegister( VI_WIDTH_REG );
|
||||
if( width == 0 )
|
||||
{
|
||||
//DAEDALUS_ERROR("Loading 0 size frame buffer?");
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( origin <= width*2 )
|
||||
{
|
||||
//DAEDALUS_ERROR("Loading small frame buffer not supported");
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
//ToDO: We should use uViWidth and uViHeight?
|
||||
#define FB_WIDTH 320
|
||||
|
@ -58,11 +58,10 @@ static bool LoadFrameBuffer(u32 origin)
|
|||
ti.SetPitch (width << 2 >> 1);
|
||||
|
||||
gRenderer->LoadTextureDirectly(ti);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Borrowed from StrmnNrmn's N64js
|
||||
static inline void DrawFrameBuffer(u32 origin)
|
||||
static inline void DrawFrameBuffer(u32 origin, const std::shared_ptr<CNativeTexture> texture)
|
||||
{
|
||||
|
||||
u16 * pixels = (u16*)malloc(FB_WIDTH*FB_HEIGHT * sizeof(u16)); // TODO: should cache this, but at some point we'll need to deal with variable framebuffer size, so do this later.
|
||||
|
@ -86,8 +85,7 @@ static inline void DrawFrameBuffer(u32 origin)
|
|||
//Doesn't work
|
||||
//sceGuTexMode( GU_PSM_5551, 0, 0, 1 ); // maxmips/a2/swizzle = 0
|
||||
//sceGuTexImage(0, texture->GetCorrectedWidth(), texture->GetCorrectedHeight(), texture->GetBlockWidth(), pixels);
|
||||
|
||||
gRenderer->Draw2DTexture(0, 0, FB_WIDTH, FB_HEIGHT, 0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
gRenderer->Draw2DTexture(0, 0, FB_WIDTH, FB_HEIGHT, 0, 0, FB_WIDTH, FB_HEIGHT, texture);
|
||||
|
||||
free(pixels);
|
||||
}
|
||||
|
@ -98,8 +96,9 @@ void RenderFrameBuffer(u32 origin)
|
|||
gRenderer->SetVIScales();
|
||||
gRenderer->BeginScene();
|
||||
|
||||
if (LoadFrameBuffer(origin))
|
||||
DrawFrameBuffer(origin);
|
||||
std::shared_ptr<CNativeTexture> texture = LoadFrameBuffer(origin);
|
||||
if(texture != NULL)
|
||||
DrawFrameBuffer(origin, texture);
|
||||
|
||||
gRenderer->EndScene();
|
||||
gGraphicsPlugin->UpdateScreen();
|
||||
|
|
|
@ -246,7 +246,7 @@ static void Load_BgSprite( const uObjScaleBg *objBg )
|
|||
//*****************************************************************************
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void Load_ObjSprite( const uObjSprite *sprite, const uObjTxtr *txtr )
|
||||
static inline std::shared_ptr<CNativeTexture> Load_ObjSprite( const uObjSprite *sprite, const uObjTxtr *txtr )
|
||||
{
|
||||
TextureInfo ti;
|
||||
|
||||
|
@ -287,7 +287,7 @@ static void Load_ObjSprite( const uObjSprite *sprite, const uObjTxtr *txtr )
|
|||
default:
|
||||
// This should not happen!
|
||||
DAEDALUS_ERROR("Unhandled Obj texture");
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ static void Load_ObjSprite( const uObjSprite *sprite, const uObjTxtr *txtr )
|
|||
//
|
||||
//*****************************************************************************
|
||||
template< ESpriteMode mode >
|
||||
static void Draw_ObjSprite( const uObjSprite *sprite )
|
||||
static void Draw_ObjSprite( const uObjSprite *sprite, const std::shared_ptr<CNativeTexture> texture )
|
||||
{
|
||||
f32 imageW = sprite->imageW / 32.0f;
|
||||
f32 imageH = sprite->imageH / 32.0f;
|
||||
|
@ -334,8 +334,11 @@ static void Draw_ObjSprite( const uObjSprite *sprite )
|
|||
if (sprite->imageFlags & S2DEX_BG_FLAG_FLIPT)
|
||||
std::swap(y0,y1);
|
||||
//Swap< f32 >( y0, y1 );
|
||||
|
||||
gRenderer->Draw2DTextureR(x0, y0, x1, y1, x2, y2, x3, y3, imageW, imageH);
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTextureR(x0, y0, x1, y1, x2, y2, x3, y3, imageW, imageH, texture);
|
||||
#else
|
||||
gRenderer->Draw2DTextureR(x0, y0, x1, y1, x2, y2, x3, y3, imageW, imageH);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PARTIAL_ROTATION:
|
||||
|
@ -345,7 +348,11 @@ static void Draw_ObjSprite( const uObjSprite *sprite )
|
|||
y1 = mat2D.Y + objH / mat2D.BaseScaleY;
|
||||
|
||||
// Partial rotation doesn't flip sprites
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTexture(x0, y0, x1, y1, 0, 0, imageW, imageH, texture);
|
||||
#else
|
||||
gRenderer->Draw2DTexture(x0, y0, x1, y1, 0, 0, imageW, imageH);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NO_ROTATION:
|
||||
|
@ -362,8 +369,11 @@ static void Draw_ObjSprite( const uObjSprite *sprite )
|
|||
if (sprite->imageFlags & S2DEX_BG_FLAG_FLIPT)
|
||||
std::swap(y0,y1);
|
||||
// Swap< f32 >( y0, y1 );
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTexture(x0, y0, x1, y1, 0, 0, imageW, imageH, texture);
|
||||
#else
|
||||
gRenderer->Draw2DTexture(x0, y0, x1, y1, 0, 0, imageW, imageH);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -485,16 +495,13 @@ static void DLParser_Yoshi_MemRect( MicroCodeCommand command )
|
|||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Bomberman : Second Atatck uses this
|
||||
//*******************************************
|
||||
void DLParser_S2DEX_ObjSprite( MicroCodeCommand command )
|
||||
{
|
||||
const uObjSprite *sprite = (const uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjSprite *sprite = (uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
Load_ObjSprite( sprite, NULL );
|
||||
Draw_ObjSprite< FULL_ROTATION >( sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( sprite, NULL );
|
||||
Draw_ObjSprite< FULL_ROTATION >( sprite, texture );
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -504,10 +511,11 @@ void DLParser_S2DEX_ObjSprite( MicroCodeCommand command )
|
|||
// Note : This cmd loads textures from both ObjTxtr and LoadBlock/LoadTile!!
|
||||
void DLParser_S2DEX_ObjRectangle( MicroCodeCommand command )
|
||||
{
|
||||
const uObjSprite *sprite = (const uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjSprite *sprite = (uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
Load_ObjSprite( sprite, gObjTxtr );
|
||||
Draw_ObjSprite< NO_ROTATION >( sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( sprite, gObjTxtr );
|
||||
// Draw_ObjSprite( sprite, NO_ROTATION, texture );
|
||||
Draw_ObjSprite< NO_ROTATION >(sprite, texture);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -515,7 +523,7 @@ void DLParser_S2DEX_ObjRectangle( MicroCodeCommand command )
|
|||
//*****************************************************************************
|
||||
void DLParser_S2DEX_ObjRectangleR( MicroCodeCommand command )
|
||||
{
|
||||
const uObjSprite *sprite = (const uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjSprite *sprite = (uObjSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
if (sprite->imageFmt == G_IM_FMT_YUV)
|
||||
{
|
||||
DLParser_OB_YUV(sprite);
|
||||
|
@ -526,8 +534,9 @@ void DLParser_S2DEX_ObjRectangleR( MicroCodeCommand command )
|
|||
// Would like to find a game that uses this though
|
||||
DAEDALUS_ERROR("S2DEX_ObjRectangleR: Check me");
|
||||
|
||||
Load_ObjSprite( sprite, gObjTxtr );
|
||||
Draw_ObjSprite< PARTIAL_ROTATION >( sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( sprite, gObjTxtr );
|
||||
// Draw_ObjSprite( sprite, PARTIAL_ROTATION, texture );
|
||||
Draw_ObjSprite< PARTIAL_ROTATION >(sprite, texture);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -536,10 +545,11 @@ void DLParser_S2DEX_ObjRectangleR( MicroCodeCommand command )
|
|||
// Nintendo logo, shade, items, enemies & foes, sun, and pretty much everything in Yoshi
|
||||
void DLParser_S2DEX_ObjLdtxSprite( MicroCodeCommand command )
|
||||
{
|
||||
const uObjTxSprite *sprite = (const uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjTxSprite *sprite = (uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
Draw_ObjSprite< FULL_ROTATION >( &sprite->sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
// Draw_ObjSprite( &sprite->sprite, FULL_ROTATION, texture );
|
||||
Draw_ObjSprite< FULL_ROTATION >(&sprite->sprite, texture);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -548,10 +558,11 @@ void DLParser_S2DEX_ObjLdtxSprite( MicroCodeCommand command )
|
|||
// No Rotation. Intro logo, Awesome command screens and HUD in game :)
|
||||
void DLParser_S2DEX_ObjLdtxRect( MicroCodeCommand command )
|
||||
{
|
||||
const uObjTxSprite *sprite = (const uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjTxSprite *sprite = (uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
Draw_ObjSprite< NO_ROTATION >( &sprite->sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
// Draw_ObjSprite( &sprite->sprite, NO_ROTATION, texture );
|
||||
Draw_ObjSprite< NO_ROTATION >(&sprite->sprite, texture);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -560,10 +571,10 @@ void DLParser_S2DEX_ObjLdtxRect( MicroCodeCommand command )
|
|||
// With Rotation. Text, smoke, and items in Yoshi
|
||||
void DLParser_S2DEX_ObjLdtxRectR( MicroCodeCommand command )
|
||||
{
|
||||
const uObjTxSprite *sprite = (const uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
uObjTxSprite *sprite = (uObjTxSprite*)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
Draw_ObjSprite< PARTIAL_ROTATION >( &sprite->sprite );
|
||||
std::shared_ptr<CNativeTexture> texture = Load_ObjSprite( &sprite->sprite, &sprite->txtr );
|
||||
Draw_ObjSprite< PARTIAL_ROTATION >(&sprite->sprite, texture);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -671,8 +682,32 @@ void DLParser_S2DEX_BgCopy( MicroCodeCommand command )
|
|||
u16 frameW = (objBg->frameW >> 2) + frameX;
|
||||
u16 frameH = (objBg->frameH >> 2) + frameY;
|
||||
|
||||
TextureInfo ti;
|
||||
|
||||
ti.SetFormat(objBg->imageFmt);
|
||||
ti.SetSize(objBg->imageSiz);
|
||||
|
||||
ti.SetLoadAddress(RDPSegAddr(objBg->imagePtr));
|
||||
ti.SetWidth(imageW);
|
||||
ti.SetHeight(imageH);
|
||||
ti.SetPitch((((imageW << objBg->imageSiz) >> 1)>>3)<<3); //force 8-bit alignment
|
||||
|
||||
ti.SetSwapped(false);
|
||||
|
||||
ti.SetPalette(objBg->imagePal);
|
||||
ti.SetTlutAddress(gTlutLoadAddresses[0]);
|
||||
ti.SetTLutFormat(kTT_RGBA16);
|
||||
|
||||
|
||||
std::shared_ptr<CNativeTexture> texture = gRenderer->LoadTextureDirectly(ti);
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTexture( (f32)frameX, (f32)frameY, (f32)frameW, (f32)frameH,
|
||||
(f32)imageX, (f32)imageY, (f32)imageW, (f32)imageH, texture);
|
||||
#else
|
||||
gRenderer->Draw2DTexture( (f32)frameX, (f32)frameY, (f32)frameW, (f32)frameH,
|
||||
(f32)imageX, (f32)imageY, (f32)imageW, (f32)imageH );
|
||||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -701,12 +736,38 @@ void DLParser_S2DEX_Bg1cyc( MicroCodeCommand command )
|
|||
f32 imageW = objBg->imageW/4.0f;
|
||||
f32 imageH = objBg->imageH/4.0f;
|
||||
|
||||
TextureInfo ti;
|
||||
|
||||
ti.SetFormat(objBg->imageFmt);
|
||||
ti.SetSize(objBg->imageSiz);
|
||||
|
||||
ti.SetLoadAddress(RDPSegAddr(objBg->imagePtr));
|
||||
ti.SetWidth(objBg->imageW/4);
|
||||
ti.SetHeight(objBg->imageH/4);
|
||||
ti.SetPitch((((objBg->imageW/4 << ti.GetSize()) >> 1)>>3)<<3); //force 8-bit alignment, this what sets our correct viewport.
|
||||
|
||||
ti.SetSwapped(false);
|
||||
|
||||
ti.SetPalette(objBg->imagePal);
|
||||
ti.SetTlutAddress(gTlutLoadAddresses[0]);
|
||||
ti.SetTLutFormat(kTT_RGBA16);
|
||||
|
||||
std::shared_ptr<CNativeTexture> texture = gRenderer->LoadTextureDirectly(ti);
|
||||
|
||||
|
||||
if (g_ROM.GameHacks != YOSHI)
|
||||
{
|
||||
f32 s1 = (frameW-frameX)*scaleX + imageX;
|
||||
f32 t1 = (frameH-frameY)*scaleY + imageY;
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<CNativeTexture> texture = gRenderer->LoadTextureDirectly(ti);
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTexture( frameX, frameY, frameW, frameH, imageX, imageY, s1, t1,texture );
|
||||
#else
|
||||
gRenderer->Draw2DTexture( frameX, frameY, frameW, frameH, imageX, imageY, s1, t1 );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -715,11 +776,17 @@ void DLParser_S2DEX_Bg1cyc( MicroCodeCommand command )
|
|||
|
||||
f32 u1 = (frameW-x2)*scaleX;
|
||||
f32 v1 = (frameH-y2)*scaleY;
|
||||
|
||||
#ifdef DAEDALUS_CTR
|
||||
gRenderer->Draw2DTexture(frameX, frameY, x2, y2, imageX, imageY, imageW, imageH, texture);
|
||||
gRenderer->Draw2DTexture(x2, frameY, frameW, y2, 0, imageY, u1, imageH, texture);
|
||||
gRenderer->Draw2DTexture(frameX, y2, x2, frameH, imageX, 0, imageW, v1, texture);
|
||||
gRenderer->Draw2DTexture(x2, y2, frameW, frameH, 0, 0, u1, v1, texture);
|
||||
#else
|
||||
gRenderer->Draw2DTexture(frameX, frameY, x2, y2, imageX, imageY, imageW, imageH);
|
||||
gRenderer->Draw2DTexture(x2, frameY, frameW, y2, 0, imageY, u1, imageH);
|
||||
gRenderer->Draw2DTexture(frameX, y2, x2, frameH, imageX, 0, imageW, v1);
|
||||
gRenderer->Draw2DTexture(x2, y2, frameW, frameH, 0, 0, u1, v1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@ struct Sprite2DStruct
|
|||
u32 address;
|
||||
u32 tlut;
|
||||
|
||||
s16 imageW;
|
||||
s16 width;
|
||||
s16 stride;
|
||||
|
||||
s8 size;
|
||||
s8 format;
|
||||
s16 imageH;
|
||||
s16 height;
|
||||
|
||||
s16 imageY;
|
||||
s16 imageX;
|
||||
|
@ -79,7 +79,7 @@ static void Load_Sprite2D( const Sprite2DStruct *sprite, const Sprite2DInfo info
|
|||
ti.SetTLutFormat(kTT_RGBA16);
|
||||
|
||||
u32 width = sprite->stride;
|
||||
u32 height = sprite->imageH + sprite->imageY;
|
||||
u32 height = sprite->height + sprite->imageY;
|
||||
u32 pitch = (sprite->stride << sprite->size) >> 1;
|
||||
|
||||
if(g_ROM.GameHacks == WCW_NITRO)
|
||||
|
@ -103,59 +103,115 @@ static void Load_Sprite2D( const Sprite2DStruct *sprite, const Sprite2DInfo info
|
|||
//*****************************************************************************
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void Draw_Sprite2D( MicroCodeCommand command, const Sprite2DStruct *sprite, const Sprite2DInfo info )
|
||||
{
|
||||
f32 frameX = ((s16)((command.inst.cmd1>>16)&0xFFFF)) / 4.0f;
|
||||
f32 frameY = ((s16)(command.inst.cmd1&0xFFFF)) / 4.0f;
|
||||
f32 frameW = (u16)(sprite->imageW / info.scaleX);
|
||||
f32 frameH = (u16)(sprite->imageH / info.scaleY);
|
||||
// static void Draw_Sprite2D( MicroCodeCommand command, const Sprite2DStruct *sprite, const Sprite2DInfo info )
|
||||
// {
|
||||
// f32 frameX = ((s16)((command.inst.cmd1>>16)&0xFFFF)) / 4.0f;
|
||||
// f32 frameY = ((s16)(command.inst.cmd1&0xFFFF)) / 4.0f;
|
||||
// f32 frameW = (u16)(sprite->imageW / info.scaleX);
|
||||
// f32 frameH = (u16)(sprite->height / info.scaleY);
|
||||
|
||||
f32 ulx, lrx, uly, lry;
|
||||
if (info.flipX)
|
||||
{
|
||||
ulx = frameX + frameW;
|
||||
lrx = frameX;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulx = frameX;
|
||||
lrx = frameX + frameW;
|
||||
}
|
||||
if (info.flipY)
|
||||
{
|
||||
uly = frameY + frameH;
|
||||
lry = frameY;
|
||||
}
|
||||
else
|
||||
{
|
||||
uly = frameY;
|
||||
lry = frameY + frameH;
|
||||
}
|
||||
// f32 ulx, lrx, uly, lry;
|
||||
// if (info.flipX)
|
||||
// {
|
||||
// ulx = frameX + frameW;
|
||||
// lrx = frameX;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ulx = frameX;
|
||||
// lrx = frameX + frameW;
|
||||
// }
|
||||
// if (info.flipY)
|
||||
// {
|
||||
// uly = frameY + frameH;
|
||||
// lry = frameY;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// uly = frameY;
|
||||
// lry = frameY + frameH;
|
||||
// }
|
||||
|
||||
f32 uls = sprite->imageX; //left
|
||||
f32 ult = sprite->imageY; //top
|
||||
f32 lrs = sprite->imageX + sprite->imageW; //right
|
||||
f32 lrt = sprite->imageY + sprite->imageH; //bottom
|
||||
if (g_ROM.GameHacks == WCW_NITRO)
|
||||
{
|
||||
ult /= info.scaleY;
|
||||
lrt /= info.scaleY;
|
||||
}
|
||||
DL_PF(" Sprite2D Screen(%.1f, %.1f) -> (%.1f, %.1f)", ulx, uly, lrx, lry);
|
||||
DL_PF(" Sprite2D Tex:(%.1f, %.1f) -> (%.1f, %.1f)", uls, lrs, ult, lrt);
|
||||
// f32 uls = sprite->imageX; //left
|
||||
// f32 ult = sprite->imageY; //top
|
||||
// f32 lrs = sprite->imageX + sprite->imageW; //right
|
||||
// f32 lrt = sprite->imageY + sprite->height; //bottom
|
||||
// if (g_ROM.GameHacks == WCW_NITRO)
|
||||
// {
|
||||
// ult /= info.scaleY;
|
||||
// lrt /= info.scaleY;
|
||||
// }
|
||||
// DL_PF(" Sprite2D Screen(%.1f, %.1f) -> (%.1f, %.1f)", ulx, uly, lrx, lry);
|
||||
// DL_PF(" Sprite2D Tex:(%.1f, %.1f) -> (%.1f, %.1f)", uls, lrs, ult, lrt);
|
||||
|
||||
gRenderer->Draw2DTexture( ulx, uly, lrx, lry, uls, ult, lrs, lrt );
|
||||
}
|
||||
// #ifdef DAEDALUS_CTR
|
||||
// gRenderer->Draw2DTexture( ulx, uly, lrx, lry, uls, ult, lrs, lrt, texture );
|
||||
// #else
|
||||
// gRenderer->Draw2DTexture( ulx, uly, lrx, lry, uls, ult, lrs, lrt );
|
||||
// #endif
|
||||
// }
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void DLParser_Sprite2DDraw( MicroCodeCommand command, const Sprite2DInfo info, const Sprite2DStruct *sprite )
|
||||
{
|
||||
Load_Sprite2D( sprite, info );
|
||||
Draw_Sprite2D( command, sprite, info );
|
||||
}
|
||||
// static void DLParser_Sprite2DDraw( MicroCodeCommand command, const Sprite2DInfo info, const Sprite2DStruct *sprite )
|
||||
// {
|
||||
// Load_Sprite2D( sprite, info );
|
||||
// Draw_Sprite2D( command, sprite, info );
|
||||
// }
|
||||
|
||||
void DLParser_Sprite2DDraw( MicroCodeCommand command, const Sprite2DInfo &info, Sprite2DStruct *sprite )
|
||||
{
|
||||
|
||||
// Wipeout.
|
||||
if(sprite->width == 0)
|
||||
return;
|
||||
|
||||
// ToDO : Cache ti state as Sprite2D is mostly used for static BGs
|
||||
TextureInfo ti;
|
||||
|
||||
u32 address = RDPSegAddr(sprite->address);
|
||||
|
||||
SImageDescriptor desc = { sprite->format, sprite->size, sprite->stride, address };
|
||||
|
||||
ti.SetFormat(sprite->format);
|
||||
ti.SetSize(sprite->size);
|
||||
|
||||
ti.SetLoadAddress(desc.GetAddress(sprite->imageX, sprite->imageY));
|
||||
|
||||
ti.SetWidth(sprite->width);
|
||||
ti.SetHeight(sprite->height);
|
||||
ti.SetPitch((sprite->stride << sprite->size) >> 1);
|
||||
|
||||
ti.SetSwapped(false);
|
||||
|
||||
ti.SetPalette(0);
|
||||
ti.SetTlutAddress(RDPSegAddr(sprite->tlut));
|
||||
ti.SetTLutFormat(kTT_RGBA16);
|
||||
|
||||
auto texture = gRenderer->LoadTextureDirectly(ti);
|
||||
|
||||
s16 px = (s16)((command.inst.cmd1>>16)&0xFFFF)/4;
|
||||
s16 py = (s16)(command.inst.cmd1 &0xFFFF)/4;
|
||||
u16 pw = (u16)(sprite->width / info.scaleX);
|
||||
u16 ph = (u16)(sprite->height / info.scaleY);
|
||||
|
||||
s32 frameX = px;
|
||||
s32 frameY = py;
|
||||
s32 frameW = px + pw;
|
||||
s32 frameH = py + ph;
|
||||
|
||||
// SSV uses this
|
||||
if( info.flipX )
|
||||
std::swap< s32 >( frameX, frameW );
|
||||
|
||||
if( info.flipY )
|
||||
std::swap< s32 >( frameY, frameH );
|
||||
|
||||
gRenderer->Draw2DTexture( (f32)frameX, (f32)frameY, (f32)frameW, (f32)frameH,
|
||||
0.0f, 0.0f, (f32)sprite->width, (f32)sprite->height,
|
||||
texture );
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
@ -168,7 +224,10 @@ void DLParser_GBI1_Sprite2DBase( MicroCodeCommand command )
|
|||
// Try to execute as many sprite2d instructions as possible, I seen chains of over 700! in FB
|
||||
do
|
||||
{
|
||||
const Sprite2DStruct *sprite = (const Sprite2DStruct *)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
// Permissive
|
||||
Sprite2DStruct *sprite = ( Sprite2DStruct *)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
// const Sprite2DStruct *sprite = (const Sprite2DStruct *)(g_pu8RamBase + RDPSegAddr(command.inst.cmd1));
|
||||
|
||||
// Fetch the next 2 instructions at once (Sprite2D Flip and Sprite2D Draw)
|
||||
MicroCodeCommand command2 = *pCmdBase++;
|
||||
|
|
|
@ -54,7 +54,12 @@ enum ETVType
|
|||
|
||||
struct SGlobalPreferences
|
||||
{
|
||||
u32 DisplayFramerate;
|
||||
// This will need to be changed globally as it makes a lot more sense
|
||||
#if defined(DAEDALUS_CTR)
|
||||
bool DisplayFramerate;
|
||||
#else
|
||||
u32 DisplayFramerate;
|
||||
#endif
|
||||
#ifdef DAEDALUS_DEBUG_DISPLAYLIST
|
||||
bool HighlightInexactBlendModes;
|
||||
bool CustomBlendModes;
|
||||
|
|
|
@ -7,7 +7,7 @@ add_subdirectory(UI)
|
|||
add_subdirectory(Utility)
|
||||
|
||||
|
||||
list(APPEND sys_libraries "imgui")
|
||||
list(APPEND sys_libraries "imgui" "picaGL")
|
||||
set(sys_libraries ${sys_libraries} PARENT_SCOPE)
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
add_library(Graphics_Plat OBJECT GraphicsContextCTR.cpp NativeTextureCTR.cpp)
|
||||
|
||||
add_library(Graphics_CTR OBJECT
|
||||
GraphicsContextCTR.cpp
|
||||
NativeTextureCTR.cpp
|
||||
|
|
|
@ -4,7 +4,6 @@ add_library(HLEGraphics_CTR OBJECT
|
|||
ColourAdjuster.cpp
|
||||
GraphicsPluginCTR.cpp
|
||||
RendererCTR.cpp
|
||||
|
||||
)
|
||||
|
||||
add_subdirectory(Combiner)
|
||||
|
|
|
@ -124,6 +124,7 @@ class CGraphicsPluginImpl : public CGraphicsPlugin
|
|||
bool Initialise();
|
||||
|
||||
virtual bool StartEmulation() { return true; }
|
||||
|
||||
virtual void ViStatusChanged() {}
|
||||
virtual void ViWidthChanged() {}
|
||||
virtual void ProcessDList();
|
||||
|
@ -135,6 +136,11 @@ private:
|
|||
u32 LastOrigin;
|
||||
};
|
||||
|
||||
CGraphicsPlugin::~CGraphicsPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CGraphicsPluginImpl::CGraphicsPluginImpl(): LastOrigin( 0 )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -802,7 +802,7 @@ void RendererCTR::FillRect(const v2 & xy0, const v2 & xy1, u32 color)
|
|||
|
||||
void RendererCTR::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1,
|
||||
f32 u0, f32 v0, f32 u1, f32 v1,
|
||||
const CNativeTexture * texture)
|
||||
const std::shared_ptr<CNativeTexture> texture)
|
||||
{
|
||||
texture->InstallTexture();
|
||||
|
||||
|
@ -851,7 +851,7 @@ void RendererCTR::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1,
|
|||
|
||||
void RendererCTR::Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2,
|
||||
f32 y2, f32 x3, f32 y3, f32 s, f32 t,
|
||||
const CNativeTexture * texture)
|
||||
const std::shared_ptr<CNativeTexture> texture)
|
||||
{
|
||||
texture->InstallTexture();
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
virtual void TexRectFlip(u32 tile_idx, const v2 & xy0, const v2 & xy1, TexCoord st0, TexCoord st1);
|
||||
virtual void FillRect(const v2 & xy0, const v2 & xy1, u32 color);
|
||||
|
||||
virtual void Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v0, f32 u1, f32 v1, const CNativeTexture * texture);
|
||||
virtual void Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3, f32 s, f32 t, const CNativeTexture * texture);
|
||||
virtual void Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v0, f32 u1, f32 v1, const std::shared_ptr<CNativeTexture> texture);
|
||||
virtual void Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3, f32 s, f32 t, const std::shared_ptr<CNativeTexture> texture);
|
||||
|
||||
struct SBlendStateEntry
|
||||
{
|
||||
|
|
|
@ -281,7 +281,7 @@ class IInputManager : public CInputManager
|
|||
virtual u32 GetConfigurationFromName( const char * name ) const;
|
||||
|
||||
private:
|
||||
void LoadControllerConfigs( const char * p_dir );
|
||||
void LoadControllerConfigs( const std::filesystem::path p_dir );
|
||||
CControllerConfig * BuildDefaultConfig(bool ZSwap = false);
|
||||
CControllerConfig * BuildControllerConfig( const char * filename );
|
||||
|
||||
|
@ -412,16 +412,16 @@ u32 IInputManager::GetConfigurationFromName( const char * name ) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void IInputManager::LoadControllerConfigs( const char * p_dir )
|
||||
void IInputManager::LoadControllerConfigs( const std::filesystem::path p_dir )
|
||||
{
|
||||
IO::FindHandleT find_handle;
|
||||
IO::FindDataT find_data;
|
||||
if(IO::FindFileOpen( p_dir, &find_handle, find_data ))
|
||||
if(IO::FindFileOpen( p_dir.c_str(), &find_handle, find_data ))
|
||||
{
|
||||
do
|
||||
{
|
||||
const char * filename( find_data.Name );
|
||||
const char * last_period( strrchr( filename, '.' ) );
|
||||
const std::filesystem::path filename( find_data.Name );
|
||||
const char * last_period( strrchr( filename.c_str(), '.' ) );
|
||||
if(last_period != NULL)
|
||||
{
|
||||
if( strcmp(last_period, ".ini") == 0 )
|
||||
|
|
|
@ -59,7 +59,7 @@ static bool SaveStateExists(int slot)
|
|||
|
||||
sprintf(full_path, "%s%s.ss%d", "SaveStates/", g_ROM.settings.GameName.c_str(), slot);
|
||||
|
||||
return IO::File::Exists(full_path);
|
||||
return std::filesystem::exists(full_path);
|
||||
}
|
||||
|
||||
static void DrawSaveStatePage()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
add_library(Utility_CTR OBJECT
|
||||
CacheCTR.S
|
||||
IOCTR.cpp
|
||||
# IOCTR.cpp
|
||||
${PROJECT_SOURCE_DIR}/Source/SysPosix/Utility/IOPosix.cpp
|
||||
MemoryCTR.c
|
||||
ThreadCTR.cpp
|
||||
TimingCTR.cpp
|
||||
|
|
|
@ -186,6 +186,7 @@ namespace IO
|
|||
|
||||
|
||||
|
||||
|
||||
bool FindFileOpen( const char * path, FindHandleT * handle, FindDataT & data )
|
||||
{
|
||||
DIR * d = opendir( path );
|
||||
|
@ -204,23 +205,33 @@ namespace IO
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindFileNext(FindHandleT handle, FindDataT& data)
|
||||
{
|
||||
DAEDALUS_ASSERT(handle != nullptr, "Cannot search with an invalid directory handle");
|
||||
|
||||
while (fs::directory_entry entry = fs::directory_iterator(static_cast<fs::path*>(handle)->path()))
|
||||
std::filesystem::directory_iterator end; // Create the end iterator
|
||||
|
||||
while (handle != end)
|
||||
{
|
||||
std::filesystem::directory_entry entry = *handle;
|
||||
|
||||
// Ignore hidden files (and '.' and '..')
|
||||
if (entry.path().filename().string()[0] == '.')
|
||||
{
|
||||
++handle; // Move to the next entry
|
||||
continue;
|
||||
}
|
||||
|
||||
data.Name = entry.path().filename().string();
|
||||
++handle; // Move to the next entry
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool FindFileClose( FindHandleT handle )
|
||||
{
|
||||
DAEDALUS_ASSERT( handle != NULL, "Trying to close an invalid directory handle" );
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#include "Interface/Preferences.h"
|
||||
#include "Utility/Profiler.h"
|
||||
#include "System/Thread.h"
|
||||
#include "Utility/Translate.h"
|
||||
|
||||
#include "Utility/Timer.h"
|
||||
#include "Utility/ROMFile.h"
|
||||
#include "ROMFile/ROMFile.h"
|
||||
#include "Utility/MemoryCTR.h"
|
||||
|
||||
bool isN3DS = false;
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace IO
|
|||
};
|
||||
|
||||
// This is also pretty redundant, as the IO file is pretty much deprecated
|
||||
#if defined( DAEDALUS_W32)
|
||||
#if defined( DAEDALUS_W32) || defined(DAEDALUS_CTR)
|
||||
using FindHandleT = void *;
|
||||
#else
|
||||
using FindHandleT = intptr_t;
|
||||
|
|
|
@ -30,7 +30,8 @@ case "$1" in
|
|||
CMAKEDEFINES+="-DCTR=1"
|
||||
;;
|
||||
*)
|
||||
CMAKE=
|
||||
CMAKE=cmake
|
||||
CMAKEDEFINES=""
|
||||
;;
|
||||
esac
|
||||
# Use the custom define to do initial build then parse cmake after
|
||||
|
|
Loading…
Reference in a new issue