Apply guideline styles for PS2 files

This commit is contained in:
Francisco Javier Trujillo Mata 2019-01-10 09:37:09 +01:00
parent 840da62e20
commit 29948c0878
2 changed files with 28 additions and 14 deletions

View File

@ -45,7 +45,8 @@ typedef struct ps2_video
} ps2_video_t;
// PRIVATE METHODS
static GSGLOBAL *init_GSGlobal(void) {
static GSGLOBAL *init_GSGlobal(void)
{
GSGLOBAL *gsGlobal = gsKit_init_global();
gsGlobal->Mode = GS_MODE_NTSC;
@ -72,25 +73,29 @@ static GSGLOBAL *init_GSGlobal(void) {
return gsGlobal;
}
static GSTEXTURE * prepare_new_texture(void) {
static GSTEXTURE * prepare_new_texture(void)
{
GSTEXTURE *texture = calloc(1, sizeof(*texture));
return texture;
}
static void init_ps2_video(ps2_video_t *ps2) {
static void init_ps2_video(ps2_video_t *ps2)
{
ps2->gsGlobal = init_GSGlobal();
ps2->menuTexture = prepare_new_texture();
ps2->coreTexture = prepare_new_texture();
}
static void deinitTexture(GSTEXTURE *texture) {
static void deinitTexture(GSTEXTURE *texture)
{
free(texture->Mem);
free(texture->Clut);
texture->Mem = NULL;
texture->Clut = NULL;
}
static void color_correction32(uint32_t *buffer, uint32_t dimensions) {
static void color_correction32(uint32_t *buffer, uint32_t dimensions)
{
uint32_t i;
uint32_t x32;
for (i = 0; i < dimensions; i++) {
@ -99,7 +104,8 @@ static void color_correction32(uint32_t *buffer, uint32_t dimensions) {
}
}
static void color_correction16(uint16_t *buffer, uint32_t dimensions) {
static void color_correction16(uint16_t *buffer, uint32_t dimensions)
{
uint32_t i;
uint16_t x16;
for (i = 0; i < dimensions; i++) {
@ -108,12 +114,14 @@ static void color_correction16(uint16_t *buffer, uint32_t dimensions) {
}
}
static bool texture_need_prepare(GSTEXTURE *texture, int width, int height, int PSM, int filter) {
static bool texture_need_prepare(GSTEXTURE *texture, int width, int height, int PSM, int filter)
{
return !texture->Mem || texture->Width != width || texture->Height != height || texture->PSM != PSM;
}
static void transfer_texture(GSTEXTURE *texture, const void *frame,
int width, int height, bool rgb32, int filter, bool color_correction) {
int width, int height, bool rgb32, int filter, bool color_correction)
{
int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool changed = texture_need_prepare(texture, width, height, rgb32, PSM);
@ -138,7 +146,8 @@ static void transfer_texture(GSTEXTURE *texture, const void *frame,
texture->Mem = (void *)frame;
}
static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) {
static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture)
{
uint32_t size = gsKit_texture_size(texture->Width, texture->Height, texture->PSM);
texture->Vram = gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER);
if(texture->Vram == GSKIT_ALLOC_ERROR) {
@ -146,7 +155,8 @@ static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) {
}
}
static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect) {
static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect)
{
float x1, y1, x2, y2;
if (force_aspect) {
float width_proportion = (float)gsGlobal->Width / (float)texture->Width;
@ -180,7 +190,8 @@ static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition,
GS_TEXT);
}
static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height) {
static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height)
{
int PSM = ps2->rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool coreVRAMClear = texture_need_prepare(ps2->coreTexture, width, height, PSM, ps2->core_filter);
ps2->clearVRAM = ps2->clearVRAM || coreVRAMClear;
@ -190,7 +201,8 @@ static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height) {
}
}
static void refreshScreen(ps2_video_t *ps2) {
static void refreshScreen(ps2_video_t *ps2)
{
gsKit_sync_flip(ps2->gsGlobal);
gsKit_queue_exec(ps2->gsGlobal);

View File

@ -43,7 +43,8 @@ static u32 gsKit_fontm_clut[16] = { 0x00000000, 0x11111111, 0x22222222, 0x333333
0x80888888, 0x80999999, 0x80AAAAAA, 0x80BBBBBB, \
0x80CCCCCC, 0x80DDDDDD, 0x80EEEEEE, 0x80FFFFFF };
static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) {
static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
{
if(gsKit_fontm_unpack(gsFontM) == 0) {
gsFontM->Texture->Width = FONTM_TEXTURE_WIDTH;
gsFontM->Texture->Height = FONTM_TEXTURE_HEIGHT;
@ -54,7 +55,8 @@ static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) {
}
}
static void ps2_upload_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) {
static void ps2_upload_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
{
int pgindx;
int TexSize = gsKit_texture_size(gsFontM->Texture->Width, gsFontM->Texture->Height, gsFontM->Texture->PSM);