iOS: Try to fix corrupted pixels on button borders, add workflow

This commit is contained in:
UnknownShadow200 2024-04-24 21:35:36 +10:00
parent ade1769719
commit 6d555a3059
14 changed files with 101 additions and 93 deletions

34
.github/workflows/build_ios.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Build latest (iOS)
on: [push]
concurrency:
group: ${{ github.ref }}-ios
cancel-in-progress: true
jobs:
build:
if: github.ref_name == github.event.repository.default_branch
runs-on: macOS-11
steps:
- uses: actions/checkout@v3
- name: Compile iOS build
id: compile
run: |
cd ios
xcodebuild -sdk iphoneos -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
cd build/Release-iphoneos
mkdir Payload
mv ClassiCube.app Payload/ClassiCube.app
zip -r cc.ipa Payload
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile iOS build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ios/build/Release-iphoneos/cc.ipa'
DEST_NAME: 'cc.ipa'

View File

@ -38,6 +38,12 @@ jobs:
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-n64.elf'
DEST_NAME: 'ClassiCube-n64.elf'
- uses: ./.github/actions/upload_build - uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }} if: ${{ always() && steps.compile.outcome == 'success' }}
with: with:

View File

@ -24,6 +24,13 @@ jobs:
NOTIFY_MESSAGE: 'Failed to compile Saturn build' NOTIFY_MESSAGE: 'Failed to compile Saturn build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'build-saturn/ClassiCube-saturn.elf'
DEST_NAME: 'build-saturn/ClassiCube-saturn.elf'
- uses: ./.github/actions/upload_build - uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }} if: ${{ always() && steps.compile.outcome == 'success' }}
with: with:

View File

@ -15,8 +15,23 @@ static cc_bool renderingDisabled;
/*########################################################################################################################* /*########################################################################################################################*
*---------------------------------------------------------General---------------------------------------------------------* *---------------------------------------------------------General---------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static void InitGLState(void) {
glClearDepth(1.0f);
glDepthMask(GL_TRUE);
glShadeModel(GL_SMOOTH);
glDisable(GL_ALPHA_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
}
void Gfx_Create(void) { void Gfx_Create(void) {
if (!Gfx.Created) glKosInit(); if (!Gfx.Created) glKosInit();
glViewport(0, 0, vid_mode->width, vid_mode->height);
InitGLState();
Gfx.MinTexWidth = 8; Gfx.MinTexWidth = 8;
Gfx.MinTexHeight = 8; Gfx.MinTexHeight = 8;

View File

@ -32,7 +32,7 @@ void LWidget_CalcOffsets(void) {
flagYOffset = Display_ScaleY(6); flagYOffset = Display_ScaleY(6);
} }
void LWidget_DrawBorder(struct Context2D* ctx, BitmapCol color, int insetX, int insetY, static void LWidget_DrawInsetBorder(struct Context2D* ctx, BitmapCol color, int insetX, int insetY,
int x, int y, int width, int height) { int x, int y, int width, int height) {
Context2D_Clear(ctx, color, Context2D_Clear(ctx, color,
x + insetX, y, x + insetX, y,
@ -48,6 +48,22 @@ void LWidget_DrawBorder(struct Context2D* ctx, BitmapCol color, int insetX, int
insetX, height - 2 * insetY); insetX, height - 2 * insetY);
} }
void LWidget_DrawBorder(struct Context2D* ctx, BitmapCol color, int borderX, int borderY,
int x, int y, int width, int height) {
Context2D_Clear(ctx, color,
x, y,
width, borderY);
Context2D_Clear(ctx, color,
x, y + height - borderY,
width, borderY);
Context2D_Clear(ctx, color,
x, y,
borderX, height);
Context2D_Clear(ctx, color,
x + width - borderX, y,
borderX, height);
}
/*########################################################################################################################* /*########################################################################################################################*
*------------------------------------------------------ButtonWidget-------------------------------------------------------* *------------------------------------------------------ButtonWidget-------------------------------------------------------*
@ -70,11 +86,10 @@ static void LButton_DrawBase(struct Context2D* ctx, int x, int y, int width, int
static void LButton_DrawBorder(struct Context2D* ctx, int x, int y, int width, int height) { static void LButton_DrawBorder(struct Context2D* ctx, int x, int y, int width, int height) {
BitmapCol backColor = Launcher_Theme.ButtonBorderColor; BitmapCol backColor = Launcher_Theme.ButtonBorderColor;
#ifdef CC_BUILD_IOS #ifdef CC_BUILD_IOS
int xoff = 0; /* TODO temp hack */ LWidget_DrawBorder(ctx, backColor, oneX, oneY, x, y, width, height);
#else #else
int xoff = oneX; LWidget_DrawInsetBorder(ctx, backColor, oneX, oneY, x, y, width, height);
#endif #endif
LWidget_DrawBorder(ctx, backColor, xoff, oneY, x, y, width, height);
} }
static void LButton_DrawHighlight(struct Context2D* ctx, int x, int y, int width, int height, cc_bool active) { static void LButton_DrawHighlight(struct Context2D* ctx, int x, int y, int width, int height, cc_bool active) {

View File

@ -47,7 +47,7 @@ static const char* kb_table_upper[] =
"Caps", "Shift", "Space", "Close" "Caps", "Shift", "Space", "Close"
}; };
extern void LWidget_DrawBorder(struct Context2D* ctx, BitmapCol color, int insetX, int insetY, extern void LWidget_DrawBorder(struct Context2D* ctx, BitmapCol color, int borderX, int borderY,
int x, int y, int width, int height); int x, int y, int width, int height);
static void VirtualKeyboard_Init(void) { static void VirtualKeyboard_Init(void) {

View File

@ -41,7 +41,6 @@ __BEGIN_DECLS
#define GL_GEQUAL 0x0206 #define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207 #define GL_ALWAYS 0x0207
#define GL_DEPTH_TEST 0x0B71 #define GL_DEPTH_TEST 0x0B71
#define GL_DEPTH_BITS 0x0D56
#define GL_DEPTH_FUNC 0x0B74 #define GL_DEPTH_FUNC 0x0B74
#define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_WRITEMASK 0x0B72
@ -146,7 +145,6 @@ GLAPI void glClear(GLuint mode);
/* Depth Testing */ /* Depth Testing */
GLAPI void glClearDepth(GLfloat depth); GLAPI void glClearDepth(GLfloat depth);
GLAPI void glClearDepthf(GLfloat depth);
GLAPI void glDepthMask(GLboolean flag); GLAPI void glDepthMask(GLboolean flag);
GLAPI void glDepthFunc(GLenum func); GLAPI void glDepthFunc(GLenum func);
GLAPI void glDepthRange(GLclampf n, GLclampf f); GLAPI void glDepthRange(GLclampf n, GLclampf f);
@ -186,7 +184,6 @@ GLAPI void gldcVertexPointer(GLsizei stride, const GLvoid *pointer);
/* Array Data Submission */ /* Array Data Submission */
GLAPI void glDrawArrays(GLenum mode, GLint first, GLsizei count); GLAPI void glDrawArrays(GLenum mode, GLint first, GLsizei count);
GLAPI void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
/* Transformation / Matrix Functions */ /* Transformation / Matrix Functions */

View File

@ -5,21 +5,12 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <malloc.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if defined(__APPLE__) || defined(__WIN32__)
/* Linux + Kos define this, OSX does not, so just use malloc there */
static inline void* memalign(size_t alignment, size_t size) {
(void) alignment;
return malloc(size);
}
#else
#include <malloc.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
#define AV_FORCE_INLINE static inline #define AV_FORCE_INLINE static inline
#else #else

View File

@ -8,10 +8,6 @@ static const void* VERTEX_PTR;
GLuint i = count; \ GLuint i = count; \
while(i--) while(i--)
void _glInitAttributePointers() {
VERTEX_PTR = NULL;
}
/* Generating PVR vertices from the user-submitted data gets complicated, particularly /* Generating PVR vertices from the user-submitted data gets complicated, particularly
* when a realloc could invalidate pointers. This structure holds all the information * when a realloc could invalidate pointers. This structure holds all the information

View File

@ -27,8 +27,6 @@ void APIENTRY glKosInit() {
AUTOSORT_ENABLED = config.autosort_enabled; AUTOSORT_ENABLED = config.autosort_enabled;
_glInitSubmissionTarget(); _glInitSubmissionTarget();
_glInitMatrices();
_glInitAttributePointers();
_glInitContext(); _glInitContext();
_glInitTextures(); _glInitTextures();
@ -51,19 +49,19 @@ void APIENTRY glKosSwapBuffers() {
pvr_wait_ready(); pvr_wait_ready();
pvr_scene_begin(); pvr_scene_begin();
if(aligned_vector_header(&OP_LIST.vector)->size > 2) { if(aligned_vector_size(&OP_LIST.vector) > 2) {
pvr_list_begin(GPU_LIST_OP_POLY); pvr_list_begin(GPU_LIST_OP_POLY);
SceneListSubmit((Vertex*) aligned_vector_front(&OP_LIST.vector), aligned_vector_size(&OP_LIST.vector)); SceneListSubmit((Vertex*) aligned_vector_front(&OP_LIST.vector), aligned_vector_size(&OP_LIST.vector));
pvr_list_finish(); pvr_list_finish();
} }
if(aligned_vector_header(&PT_LIST.vector)->size > 2) { if(aligned_vector_size(&PT_LIST.vector) > 2) {
pvr_list_begin(GPU_LIST_PT_POLY); pvr_list_begin(GPU_LIST_PT_POLY);
SceneListSubmit((Vertex*) aligned_vector_front(&PT_LIST.vector), aligned_vector_size(&PT_LIST.vector)); SceneListSubmit((Vertex*) aligned_vector_front(&PT_LIST.vector), aligned_vector_size(&PT_LIST.vector));
pvr_list_finish(); pvr_list_finish();
} }
if(aligned_vector_header(&TR_LIST.vector)->size > 2) { if(aligned_vector_size(&TR_LIST.vector) > 2) {
pvr_list_begin(GPU_LIST_TR_POLY); pvr_list_begin(GPU_LIST_TR_POLY);
SceneListSubmit((Vertex*) aligned_vector_front(&TR_LIST.vector), aligned_vector_size(&TR_LIST.vector)); SceneListSubmit((Vertex*) aligned_vector_front(&TR_LIST.vector), aligned_vector_size(&TR_LIST.vector));
pvr_list_finish(); pvr_list_finish();

View File

@ -107,12 +107,9 @@ GL_FORCE_INLINE void memcpy_vertex(Vertex *dest, const Vertex *src) {
#endif #endif
} }
void _glInitAttributePointers();
void _glInitContext(); void _glInitContext();
void _glInitMatrices();
void _glInitSubmissionTarget(); void _glInitSubmissionTarget();
void _glInitTextures();
GLubyte _glInitTextures();
extern TextureObject* TEXTURE_ACTIVE; extern TextureObject* TEXTURE_ACTIVE;
extern GLboolean TEXTURES_ENABLED; extern GLboolean TEXTURES_ENABLED;

View File

@ -7,7 +7,6 @@
#include <dc/fmath.h> #include <dc/fmath.h>
#include <dc/matrix3d.h> #include <dc/matrix3d.h>
#include "types.h"
#include "private.h" #include "private.h"
#include "sh4_math.h" #include "sh4_math.h"

View File

@ -37,17 +37,6 @@ void _glInitContext() {
scissor_rect.y = 0; scissor_rect.y = 0;
scissor_rect.width = vid_mode->width; scissor_rect.width = vid_mode->width;
scissor_rect.height = vid_mode->height; scissor_rect.height = vid_mode->height;
glClearDepth(1.0f);
glDepthMask(GL_TRUE);
glShadeModel(GL_SMOOTH);
glDisable(GL_ALPHA_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
} }
GLAPI void APIENTRY glEnable(GLenum cap) { GLAPI void APIENTRY glEnable(GLenum cap) {
@ -141,10 +130,6 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
} }
/* Depth Testing */ /* Depth Testing */
GLAPI void APIENTRY glClearDepthf(GLfloat depth) {
glClearDepth(depth);
}
GLAPI void APIENTRY glClearDepth(GLfloat depth) { GLAPI void APIENTRY glClearDepth(GLfloat depth) {
/* We reverse because using invW means that farther Z == lower number */ /* We reverse because using invW means that farther Z == lower number */
GPUSetClearDepth(MIN(1.0f - depth, PVR_MIN_Z)); GPUSetClearDepth(MIN(1.0f - depth, PVR_MIN_Z));
@ -272,10 +257,6 @@ Viewport VIEWPORT = {
0, 0, 640, 480, 320.0f, 240.0f, 320.0f, 240.0f 0, 0, 640, 480, 320.0f, 240.0f, 320.0f, 240.0f
}; };
void _glInitMatrices() {
glViewport(0, 0, vid_mode->width, vid_mode->height);
}
/* Set the GL viewport */ /* Set the GL viewport */
void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
VIEWPORT.x = x; VIEWPORT.x = x;
@ -326,25 +307,6 @@ GL_FORCE_INLINE void _updatePVRTextureContext(PolyContext *context, GLshort text
} }
} }
GL_FORCE_INLINE int _calc_pvr_face_culling() {
if(!CULLING_ENABLED) {
return GPU_CULLING_SMALL;
} else {
return GPU_CULLING_CW;
}
}
GL_FORCE_INLINE void _updatePVRBlend(PolyContext* context) {
if(BLEND_ENABLED || ALPHA_TEST_ENABLED) {
context->gen.alpha = GPU_ALPHA_ENABLE;
} else {
context->gen.alpha = GPU_ALPHA_DISABLE;
}
context->blend.src = PVR_BLEND_SRCALPHA;
context->blend.dst = PVR_BLEND_INVSRCALPHA;
}
void apply_poly_header(PolyHeader* header, PolyList* activePolyList) { void apply_poly_header(PolyHeader* header, PolyList* activePolyList) {
TRACE(); TRACE();
@ -357,25 +319,17 @@ void apply_poly_header(PolyHeader* header, PolyList* activePolyList) {
ctx.fmt.uv = GPU_UVFMT_32BIT; ctx.fmt.uv = GPU_UVFMT_32BIT;
ctx.gen.color_clamp = GPU_CLRCLAMP_DISABLE; ctx.gen.color_clamp = GPU_CLRCLAMP_DISABLE;
ctx.gen.culling = _calc_pvr_face_culling(); ctx.gen.culling = CULLING_ENABLED ? GPU_CULLING_CW : GPU_CULLING_SMALL;
ctx.depth.comparison = DEPTH_TEST_ENABLED ? GPU_DEPTHCMP_GEQUAL : GPU_DEPTHCMP_ALWAYS; ctx.depth.comparison = DEPTH_TEST_ENABLED ? GPU_DEPTHCMP_GEQUAL : GPU_DEPTHCMP_ALWAYS;
ctx.depth.write = DEPTH_MASK_ENABLED ? GPU_DEPTHWRITE_ENABLE : GPU_DEPTHWRITE_DISABLE; ctx.depth.write = DEPTH_MASK_ENABLED ? GPU_DEPTHWRITE_ENABLE : GPU_DEPTHWRITE_DISABLE;
ctx.gen.shading = (SHADE_MODEL == GL_SMOOTH) ? GPU_SHADE_GOURAUD : GPU_SHADE_FLAT; ctx.gen.shading = (SHADE_MODEL == GL_SMOOTH) ? GPU_SHADE_GOURAUD : GPU_SHADE_FLAT;
ctx.gen.clip_mode = SCISSOR_TEST_ENABLED ? GPU_USERCLIP_INSIDE : GPU_USERCLIP_DISABLE;
ctx.gen.fog_type = FOG_ENABLED ? GPU_FOG_TABLE : GPU_FOG_DISABLE;
if(SCISSOR_TEST_ENABLED) { ctx.gen.alpha = (BLEND_ENABLED || ALPHA_TEST_ENABLED) ? GPU_ALPHA_ENABLE : GPU_ALPHA_DISABLE;
ctx.gen.clip_mode = GPU_USERCLIP_INSIDE; ctx.blend.src = PVR_BLEND_SRCALPHA;
} else { ctx.blend.dst = PVR_BLEND_INVSRCALPHA;
ctx.gen.clip_mode = GPU_USERCLIP_DISABLE;
}
if(FOG_ENABLED) {
ctx.gen.fog_type = GPU_FOG_TABLE;
} else {
ctx.gen.fog_type = GPU_FOG_DISABLE;
}
_updatePVRBlend(&ctx);
if(ctx.list_type == GPU_LIST_OP_POLY) { if(ctx.list_type == GPU_LIST_OP_POLY) {
/* Opaque polys are always one/zero */ /* Opaque polys are always one/zero */

View File

@ -80,7 +80,7 @@ static void _glInitializeTextureObject(TextureObject* txr, unsigned int id) {
txr->mipmap_bias = GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS; txr->mipmap_bias = GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS;
} }
GLubyte _glInitTextures() { void _glInitTextures() {
memset(TEXTURE_USED, 0, sizeof(TEXTURE_USED)); memset(TEXTURE_USED, 0, sizeof(TEXTURE_USED));
// Initialize zero as an actual texture object though because apparently it is! // Initialize zero as an actual texture object though because apparently it is!
@ -98,7 +98,6 @@ GLubyte _glInitTextures() {
#endif #endif
yalloc_init(YALLOC_BASE, YALLOC_SIZE); yalloc_init(YALLOC_BASE, YALLOC_SIZE);
return 1;
} }
GLuint APIENTRY gldcGenTexture(void) { GLuint APIENTRY gldcGenTexture(void) {