mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-03 16:51:27 +00:00
Clean up some methods
This commit is contained in:
@@ -16,20 +16,99 @@ lib_LIBRARIES = libpspgu.a
|
|||||||
|
|
||||||
noinst_HEADERS = guInternal.h
|
noinst_HEADERS = guInternal.h
|
||||||
|
|
||||||
libpspgu_a_SOURCES = callbackFin.c callbackSig.c guInternal.c resetValues.c sceGuAlphaFunc.c sceGuAmbient.c \
|
libpspgu_a_SOURCES = \
|
||||||
sceGuAmbientColor.c sceGuBeginObject.c sceGuBlendFunc.c sceGuBoneMatrix.c sceGuBreak.c sceGuCallList.c \
|
guInternal.c \
|
||||||
sceGuCallMode.c sceGuCheckList.c sceGuClear.c sceGuClearColor.c sceGuClearDepth.c sceGuClearStencil.c \
|
resetValues.c \
|
||||||
sceGuClutLoad.c sceGuClutMode.c sceGuColor.c sceGuColorFunc.c sceGuColorMaterial.c sceGuContinue.c \
|
sceGuAlphaFunc.c \
|
||||||
sceGuCopyImage.c sceGuDepthBuffer.c sceGuDepthFunc.c sceGuDepthMask.c sceGuDepthOffset.c \
|
sceGuAmbient.c \
|
||||||
sceGuDepthRange.c sceGuDisable.c sceGuDispBuffer.c sceGuDisplay.c sceGuDrawArray.c sceGuDrawArrayN.c \
|
sceGuAmbientColor.c \
|
||||||
sceGuDrawBezier.c sceGuDrawBuffer.c sceGuDrawBufferList.c sceGuDrawSpline.c sceGuEnable.c sceGuEndObject.c \
|
sceGuBeginObject.c \
|
||||||
sceGuFinish.c sceGuFog.c sceGuFrontFace.c sceGuGetAllStatus.c sceGuGetMemory.c sceGuGetStatus.c sceGuInit.c \
|
sceGuBlendFunc.c \
|
||||||
sceGuLight.c sceGuLightAtt.c sceGuLightColor.c sceGuLightMode.c sceGuLightSpot.c sceGuLogicalOp.c \
|
sceGuBoneMatrix.c \
|
||||||
sceGuMaterial.c sceGuModelColor.c sceGuMorphWeight.c sceGuOffset.c sceGuPatchDivide.c sceGuPatchFrontFace.c \
|
sceGuBreak.c \
|
||||||
sceGuPatchPrim.c sceGuPixelMask.c sceGuScissor.c sceGuSendCommandf.c sceGuSendCommandi.c sceGuSendList.c \
|
sceGuCallList.c \
|
||||||
sceGuSetAllStatus.c sceGuSetCallback.c sceGuSetDither.c sceGuSetMatrix.c sceGuSetStatus.c sceGuShadeModel.c \
|
sceGuCallMode.c \
|
||||||
sceGuSignal.c sceGuSpecular.c sceGuStart.c sceGuStencilFunc.c sceGuStencilOp.c \
|
sceGuCheckList.c \
|
||||||
sceGuSwapBuffers.c sceGuSync.c sceGuTerm.c sceGuTexEnvColor.c sceGuTexFilter.c sceGuTexFlush.c sceGuTexFunc.c \
|
sceGuClear.c \
|
||||||
sceGuTexImage.c sceGuTexLevelMode.c sceGuTexMapMode.c sceGuTexMode.c sceGuTexOffset.c sceGuTexProjMapMode.c \
|
sceGuClearColor.c \
|
||||||
sceGuTexScale.c sceGuTexSlope.c sceGuTexSync.c sceGuTexWrap.c sceGuViewport.c vram.c
|
sceGuClearDepth.c \
|
||||||
|
sceGuClearStencil.c \
|
||||||
|
sceGuClutLoad.c \
|
||||||
|
sceGuClutMode.c \
|
||||||
|
sceGuColor.c \
|
||||||
|
sceGuColorFunc.c \
|
||||||
|
sceGuColorMaterial.c \
|
||||||
|
sceGuContinue.c \
|
||||||
|
sceGuCopyImage.c \
|
||||||
|
sceGuDepthBuffer.c \
|
||||||
|
sceGuDepthFunc.c \
|
||||||
|
sceGuDepthMask.c \
|
||||||
|
sceGuDepthOffset.c \
|
||||||
|
sceGuDepthRange.c \
|
||||||
|
sceGuDisable.c \
|
||||||
|
sceGuDispBuffer.c \
|
||||||
|
sceGuDisplay.c \
|
||||||
|
sceGuDrawArray.c \
|
||||||
|
sceGuDrawArrayN.c \
|
||||||
|
sceGuDrawBezier.c \
|
||||||
|
sceGuDrawBuffer.c \
|
||||||
|
sceGuDrawBufferList.c \
|
||||||
|
sceGuDrawSpline.c \
|
||||||
|
sceGuEnable.c \
|
||||||
|
sceGuEndObject.c \
|
||||||
|
sceGuFinish.c \
|
||||||
|
sceGuFog.c \
|
||||||
|
sceGuFrontFace.c \
|
||||||
|
sceGuGetAllStatus.c \
|
||||||
|
sceGuGetMemory.c \
|
||||||
|
sceGuGetStatus.c \
|
||||||
|
sceGuInit.c \
|
||||||
|
sceGuLight.c \
|
||||||
|
sceGuLightAtt.c \
|
||||||
|
sceGuLightColor.c \
|
||||||
|
sceGuLightMode.c \
|
||||||
|
sceGuLightSpot.c \
|
||||||
|
sceGuLogicalOp.c \
|
||||||
|
sceGuMaterial.c \
|
||||||
|
sceGuModelColor.c \
|
||||||
|
sceGuMorphWeight.c \
|
||||||
|
sceGuOffset.c \
|
||||||
|
sceGuPatchDivide.c \
|
||||||
|
sceGuPatchFrontFace.c \
|
||||||
|
sceGuPatchPrim.c \
|
||||||
|
sceGuPixelMask.c \
|
||||||
|
sceGuScissor.c \
|
||||||
|
sceGuSendCommandf.c \
|
||||||
|
sceGuSendCommandi.c \
|
||||||
|
sceGuSendList.c \
|
||||||
|
sceGuSetAllStatus.c \
|
||||||
|
sceGuSetCallback.c \
|
||||||
|
sceGuSetDither.c \
|
||||||
|
sceGuSetMatrix.c \
|
||||||
|
sceGuSetStatus.c \
|
||||||
|
sceGuShadeModel.c \
|
||||||
|
sceGuSignal.c \
|
||||||
|
sceGuSpecular.c \
|
||||||
|
sceGuStart.c \
|
||||||
|
sceGuStencilFunc.c \
|
||||||
|
sceGuStencilOp.c \
|
||||||
|
sceGuSwapBuffers.c \
|
||||||
|
sceGuSync.c \
|
||||||
|
sceGuTerm.c \
|
||||||
|
sceGuTexEnvColor.c \
|
||||||
|
sceGuTexFilter.c \
|
||||||
|
sceGuTexFlush.c \
|
||||||
|
sceGuTexFunc.c \
|
||||||
|
sceGuTexImage.c \
|
||||||
|
sceGuTexLevelMode.c \
|
||||||
|
sceGuTexMapMode.c \
|
||||||
|
sceGuTexMode.c \
|
||||||
|
sceGuTexOffset.c \
|
||||||
|
sceGuTexProjMapMode.c \
|
||||||
|
sceGuTexScale.c \
|
||||||
|
sceGuTexSlope.c \
|
||||||
|
sceGuTexSync.c \
|
||||||
|
sceGuTexWrap.c \
|
||||||
|
sceGuViewport.c \
|
||||||
|
vram.c
|
||||||
|
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* PSP Software Development Kit - https://github.com/pspdev
|
|
||||||
* -----------------------------------------------------------------------
|
|
||||||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2005 Jesper Svennevid
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "guInternal.h"
|
|
||||||
|
|
||||||
void callbackFin(int id, void* arg)
|
|
||||||
{
|
|
||||||
GuSettings* settings = (GuSettings*)arg;
|
|
||||||
if (settings->fin)
|
|
||||||
settings->fin(id & 0xffff);
|
|
||||||
}
|
|
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* PSP Software Development Kit - https://github.com/pspdev
|
|
||||||
* -----------------------------------------------------------------------
|
|
||||||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2005 Jesper Svennevid
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "guInternal.h"
|
|
||||||
|
|
||||||
#include <pspkernel.h>
|
|
||||||
|
|
||||||
void callbackSig(int id, void* arg)
|
|
||||||
{
|
|
||||||
GuSettings* settings = (GuSettings*)arg;
|
|
||||||
|
|
||||||
settings->signal_history[(settings->signal_offset++) & 15] = id & 0xffff;
|
|
||||||
|
|
||||||
if (settings->sig)
|
|
||||||
settings->sig(id & 0xffff);
|
|
||||||
|
|
||||||
sceKernelSetEventFlag(settings->kernel_event_flag,1);
|
|
||||||
}
|
|
@@ -11,7 +11,7 @@
|
|||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <pspdisplay.h>
|
#include <pspdisplay.h>
|
||||||
|
|
||||||
void drawRegion(int x, int y, int width, int height)
|
static inline void drawRegion(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
sendCommandi(REGION1, (y << 10) | x);
|
sendCommandi(REGION1, (y << 10) | x);
|
||||||
sendCommandi(REGION2, (((y + height) - 1) << 10) | ((x + width) - 1));
|
sendCommandi(REGION2, (((y + height) - 1) << 10) | ((x + width) - 1));
|
||||||
|
@@ -235,6 +235,25 @@ static unsigned int __attribute__((aligned(16))) ge_init_list[] =
|
|||||||
ZV(END),
|
ZV(END),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void callbackFin(int id, void* arg)
|
||||||
|
{
|
||||||
|
GuSettings* settings = (GuSettings*)arg;
|
||||||
|
if (settings->fin)
|
||||||
|
settings->fin(id & 0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void callbackSig(int id, void* arg)
|
||||||
|
{
|
||||||
|
GuSettings* settings = (GuSettings*)arg;
|
||||||
|
|
||||||
|
settings->signal_history[(settings->signal_offset++) & 15] = id & 0xffff;
|
||||||
|
|
||||||
|
if (settings->sig)
|
||||||
|
settings->sig(id & 0xffff);
|
||||||
|
|
||||||
|
sceKernelSetEventFlag(settings->kernel_event_flag,1);
|
||||||
|
}
|
||||||
|
|
||||||
void sceGuInit(void)
|
void sceGuInit(void)
|
||||||
{
|
{
|
||||||
PspGeCallbackData callback;
|
PspGeCallbackData callback;
|
||||||
|
@@ -8,19 +8,18 @@
|
|||||||
|
|
||||||
#include "guInternal.h"
|
#include "guInternal.h"
|
||||||
|
|
||||||
static int tbpcmd_tbl[8] = { 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 }; // 0x30A18
|
static inline int getExp(int val)
|
||||||
static int tbwcmd_tbl[8] = { 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf }; // 0x30A38
|
|
||||||
static int tsizecmd_tbl[8] = { 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf }; // 0x30A58
|
|
||||||
|
|
||||||
int getExp(int val)
|
|
||||||
{
|
{
|
||||||
return 31 - __builtin_clz(val & 0x3FF);
|
return 31 - __builtin_clz(val & 0x3FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sceGuTexImage(int mipmap, int width, int height, int tbw, const void* tbp)
|
void sceGuTexImage(int mipmap, int width, int height, int tbw, const void *tbp)
|
||||||
{
|
{
|
||||||
sendCommandi(tbpcmd_tbl[mipmap],((unsigned int)tbp) & 0xffffff);
|
GECommand texAddr = (GECommand)(TEX_ADDR0 + mipmap);
|
||||||
sendCommandi(tbwcmd_tbl[mipmap],((((unsigned int)tbp) >> 8) & 0x0f0000)|tbw);
|
GECommand texBufWidth = (GECommand)(TEX_BUF_WIDTH0 + mipmap);
|
||||||
sendCommandi(tsizecmd_tbl[mipmap],(getExp(height) << 8)|(getExp(width)));
|
GECommand texSize = (GECommand)(TEX_SIZE0 + mipmap);
|
||||||
|
sendCommandi(texAddr, ((unsigned int)tbp) & 0xffffff);
|
||||||
|
sendCommandi(texBufWidth, ((((unsigned int)tbp) >> 8) & 0x0f0000) | tbw);
|
||||||
|
sendCommandi(texSize, (getExp(height) << 8) | (getExp(width)));
|
||||||
sceGuTexFlush();
|
sceGuTexFlush();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user