mirror of https://github.com/mgba-emu/mgba.git
3DS: Update for new citro3d
This commit is contained in:
parent
7c058ea13f
commit
bc88f23692
|
@ -133,7 +133,7 @@ void ctrActivateTexture(const C3D_Tex* texture) {
|
|||
C3D_TexBind(0, activeTexture);
|
||||
|
||||
C3D_TexEnv* env = C3D_GetTexEnv(0);
|
||||
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
|
||||
C3D_TexEnvInit(env);
|
||||
if (texture->fmt < GPU_LA8) {
|
||||
C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0);
|
||||
C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE);
|
||||
|
@ -144,11 +144,11 @@ void ctrActivateTexture(const C3D_Tex* texture) {
|
|||
C3D_TexEnvFunc(env, C3D_Alpha, GPU_MODULATE);
|
||||
}
|
||||
env = C3D_GetTexEnv(1);
|
||||
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
|
||||
C3D_TexEnvInit(env);
|
||||
C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, 0, 0);
|
||||
C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
|
||||
env = C3D_GetTexEnv(2);
|
||||
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
|
||||
C3D_TexEnvInit(env);
|
||||
C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, 0, 0);
|
||||
C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
|
||||
|
||||
|
@ -164,14 +164,14 @@ void ctrActivateTexture(const C3D_Tex* texture) {
|
|||
|
||||
void ctrTextureMultiply(void) {
|
||||
C3D_TexEnv* env = C3D_GetTexEnv(1);
|
||||
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
|
||||
C3D_TexEnvInit(env);
|
||||
C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, GPU_TEXTURE0, 0);
|
||||
C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE);
|
||||
}
|
||||
|
||||
void ctrTextureBias(u32 color) {
|
||||
C3D_TexEnv* env = C3D_GetTexEnv(2);
|
||||
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
|
||||
C3D_TexEnvInit(env);
|
||||
C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, GPU_CONSTANT, 0);
|
||||
C3D_TexEnvFunc(env, C3D_Both, GPU_ADD);
|
||||
C3D_TexEnvColor(env, color);
|
||||
|
|
|
@ -87,7 +87,6 @@ static enum {
|
|||
static void* outputBuffer;
|
||||
static struct mAVStream stream;
|
||||
static int16_t* audioLeft = 0;
|
||||
static int16_t* audioRight = 0;
|
||||
static size_t audioPos = 0;
|
||||
static C3D_Tex outputTexture;
|
||||
static ndspWaveBuf dspBuffer[DSP_BUFFERS];
|
||||
|
@ -128,8 +127,6 @@ static bool _initGpu(void) {
|
|||
return false;
|
||||
}
|
||||
|
||||
C3D_RenderTargetSetClear(upscaleBuffer, C3D_CLEAR_COLOR, 0, 0);
|
||||
|
||||
return ctrInitGpu();
|
||||
}
|
||||
|
||||
|
@ -183,6 +180,8 @@ static void _map3DSKey(struct mInputMap* map, int ctrKey, enum GBAKey key) {
|
|||
static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* right);
|
||||
|
||||
static void _drawStart(void) {
|
||||
C3D_FrameBufClear(&bottomScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0);
|
||||
C3D_FrameBufClear(&topScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0);
|
||||
}
|
||||
|
||||
static void _frameStart(void) {
|
||||
|
@ -199,9 +198,6 @@ static void _frameStart(void) {
|
|||
}
|
||||
}
|
||||
C3D_FrameBegin(flags);
|
||||
// Mark both buffers used to make sure they get cleared
|
||||
C3D_FrameDrawOn(topScreen[doubleBuffer]);
|
||||
C3D_FrameDrawOn(bottomScreen[doubleBuffer]);
|
||||
ctrStartFrame();
|
||||
}
|
||||
|
||||
|
@ -216,8 +212,6 @@ static void _drawEnd(void) {
|
|||
frameStarted = false;
|
||||
|
||||
doubleBuffer ^= 1;
|
||||
C3D_FrameBufClear(&bottomScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0);
|
||||
C3D_FrameBufClear(&topScreen[doubleBuffer]->frameBuf, C3D_CLEAR_COLOR, 0, 0);
|
||||
}
|
||||
|
||||
static int _batteryState(void) {
|
||||
|
@ -555,7 +549,7 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
|
|||
C3D_Tex* tex = &outputTexture;
|
||||
|
||||
GSPGPU_FlushDataCache(outputBuffer, 256 * VIDEO_VERTICAL_PIXELS * 2);
|
||||
C3D_SafeDisplayTransfer(
|
||||
C3D_SyncDisplayTransfer(
|
||||
outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS),
|
||||
tex->data, GX_BUFFER_DIM(256, 256),
|
||||
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) |
|
||||
|
@ -567,7 +561,6 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
|
|||
blip_clear(runner->core->getAudioChannel(runner->core, 1));
|
||||
}
|
||||
|
||||
gspWaitForPPF();
|
||||
_drawTex(runner->core, faded);
|
||||
}
|
||||
|
||||
|
@ -584,13 +577,12 @@ static void _drawScreenshot(struct mGUIRunner* runner, const color_t* pixels, un
|
|||
}
|
||||
|
||||
GSPGPU_FlushDataCache(newPixels, 256 * height * sizeof(u32));
|
||||
C3D_SafeDisplayTransfer(
|
||||
C3D_SyncDisplayTransfer(
|
||||
(u32*) newPixels, GX_BUFFER_DIM(256, height),
|
||||
tex->data, GX_BUFFER_DIM(256, 256),
|
||||
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) |
|
||||
GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB565) |
|
||||
GX_TRANSFER_OUT_TILED(1) | GX_TRANSFER_FLIP_VERT(1));
|
||||
gspWaitForPPF();
|
||||
linearFree(newPixels);
|
||||
|
||||
_drawTex(runner->core, faded);
|
||||
|
|
Loading…
Reference in New Issue