mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
iOS: Try to log unhandled objective C errors
This commit is contained in:
parent
e492db93f6
commit
2c07e5fdf1
@ -294,15 +294,7 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
|||||||
gfx_stride = strideSizes[fmt];
|
gfx_stride = strideSizes[fmt];
|
||||||
|
|
||||||
if (fmt == VERTEX_FORMAT_COLOURED) {
|
if (fmt == VERTEX_FORMAT_COLOURED) {
|
||||||
/* it's necessary to unbind the texture, otherwise the alpha from the last bound texture */
|
|
||||||
/* gets used - because D3DTSS_ALPHAOP texture stage state is still set to D3DTOP_SELECTARG1 */
|
|
||||||
Xe_SetTexture(xe, 0, NULL);
|
Xe_SetTexture(xe, 0, NULL);
|
||||||
/* IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, fmt == VERTEX_FORMAT_COLOURED ? D3DTOP_DISABLE : D3DTOP_MODULATE); */
|
|
||||||
/* IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, fmt == VERTEX_FORMAT_COLOURED ? D3DTOP_DISABLE : D3DTOP_SELECTARG1); */
|
|
||||||
/* SetTexture(NULL) seems to be enough, not really required to call SetTextureStageState */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fmt == VERTEX_FORMAT_COLOURED) {
|
|
||||||
Xe_SetShader(xe, SHADER_TYPE_PIXEL, shdr_col_ps, 0);
|
Xe_SetShader(xe, SHADER_TYPE_PIXEL, shdr_col_ps, 0);
|
||||||
Xe_SetShader(xe, SHADER_TYPE_VERTEX, shdr_col_vs, 0);
|
Xe_SetShader(xe, SHADER_TYPE_VERTEX, shdr_col_vs, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,7 +282,28 @@ static int alert_completed;
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
static void LogUnhandled(NSString* str) {
|
||||||
|
if (!str) return;
|
||||||
|
const char* src = [str UTF8String];
|
||||||
|
if (!src) return;
|
||||||
|
|
||||||
|
cc_string msg = String_FromReadonly(src);
|
||||||
|
Platform_Log(msg.buffer, msg.length);
|
||||||
|
Logger_Log(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Should really be handled elsewhere, in Logger or ErrorHandler
|
||||||
|
static void LogUnhandledNSErrors(NSException* ex) {
|
||||||
|
// last chance to log exception details before process dies
|
||||||
|
LogUnhandled(@"About to die from unhandled NSException..");
|
||||||
|
LogUnhandled([ex name]);
|
||||||
|
LogUnhandled([ex reason]);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
NSSetUncaughtExceptionHandler(LogUnhandledNSErrors);
|
||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CCAppDelegate class]));
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CCAppDelegate class]));
|
||||||
}
|
}
|
||||||
@ -381,12 +402,13 @@ void Window_Init(void) {
|
|||||||
// keyboard now shifts up
|
// keyboard now shifts up
|
||||||
Window_Main.SoftKeyboard = SOFT_KEYBOARD_SHIFT;
|
Window_Main.SoftKeyboard = SOFT_KEYBOARD_SHIFT;
|
||||||
Input_SetTouchMode(true);
|
Input_SetTouchMode(true);
|
||||||
Gui_SetTouchUI(true);
|
|
||||||
Input.Sources = INPUT_SOURCE_NORMAL;
|
Input.Sources = INPUT_SOURCE_NORMAL;
|
||||||
|
Gui_SetTouchUI(true);
|
||||||
|
|
||||||
DisplayInfo.Depth = 32;
|
DisplayInfo.Depth = 32;
|
||||||
DisplayInfo.ScaleX = 1; // TODO dpi scale
|
DisplayInfo.ScaleX = 1; // TODO dpi scale
|
||||||
DisplayInfo.ScaleY = 1; // TODO dpi scale
|
DisplayInfo.ScaleY = 1; // TODO dpi scale
|
||||||
|
NSSetUncaughtExceptionHandler(LogUnhandledNSErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_Free(void) { }
|
void Window_Free(void) { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user