Error with Mac APP

Previous topic - Next topic

Kyo

Hi,
I compiled my game for Mac (both X86 and uni) and after 1 Month of Test I have always the same error.....
In Win 7/8/8.1 and Android the game work fine.

This is my configuration:
osx Mavericks 10.9.4 Niresh
Processore Intel® Core™ i7-3630QM di 3a gen. with Intel® Turbo Boost Technology 2.0
Hard disk 500 GB
4,096 (1x) MB, DDR3 RAM (1,600 MHz)
AMD Radeon HD 7670M (2GB memory)

I test with game downloaded from iTunes, and all game works fine!
I test a simple demo of GLB and work fine.

I have in my code:
- SETSCREEN 1366,768,FALSE
- Z Project - universal screen size scaling system
- This Code
Code (glbasic) Select

IMPORT "C" void __stdcall glTexParameteri(unsigned int flag0, unsigned int flag1, unsigned int flag2);
GLOBAL GL_CLAMP_TO_EDGE%                                   = 0x812F
GLOBAL GL_TEXTURE_2D%                                      = 0x0DE1
GLOBAL GL_TEXTURE_WRAP_S%                                  = 0x2802
GLOBAL GL_TEXTURE_WRAP_T%                                  = 0x2803
 


This is the Mac report error

Code (glbasic) Select

Process:         MacOSX [665]
Path:            /Users/USER/Desktop/CC.app/Contents/MacOS/MacOSX
Identifier:      com.xxxxxxxxxx.su
Version:         0.001.0 (0.001.0)
Code Type:       X86 (Native)
Parent Process:  launchd [155]
Responsible:     MacOSX [665]
User ID:         501

Date/Time:       2014-08-25 20:36:38.454 +0200
OS Version:      Mac OS X 10.9.4 (13E28)
Report Version:  11
Anonymous UUID:  837315DB-9B27-D1B8-3358-C3D336BA4671


Crashed Thread:  1

Exception Type:  EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Thread 0:: Dispatch queue: com.apple.main-thread
0   dyld                          0x8feaa322 misaligned_stack_error + 0
1   com.xxxxxxxxxx.su          0x000b2662 OpenGLRainbows::PolyEnd() + 28
2   com.xxxxxxxxxx.su          0x00065396 __GLBASIC__::ENDPOLY() + 26
3   com.xxxxxxxxxx.su          0x00047cd8 __GLBASIC__::z_drawstage(int, int, int, double, double, double, double, double, double, double) + 680
4   com.xxxxxxxxxx.su          0x0004f916 __GLBASIC__::Update_Logo_samp() + 182
5   com.xxxxxxxxxx.su          0x00006600 __GLBASIC__::__MainGameSub_() + 2560
6   com.xxxxxxxxxx.su          0x0008d8d7 SDL_main + 817
7   com.xxxxxxxxxx.su          0x000633a0 -[SDLMain applicationDidFinishLaunching:] + 88
8   com.apple.Foundation          0x951ff732 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 49
9   com.apple.CoreFoundation      0x95a305a4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
10  com.apple.CoreFoundation      0x9591204b _CFXNotificationPost + 3435
11  com.apple.Foundation          0x951ee21f -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
12  com.apple.AppKit              0x944f1575 -[NSApplication _postDidFinishNotification] + 367
13  com.apple.AppKit              0x944f1215 -[NSApplication _sendFinishLaunchingNotification] + 239
14  com.apple.AppKit              0x944edb44 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 840
15  com.apple.AppKit              0x944ed431 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 277
16  libobjc.A.dylib                0x9355e304 -[NSObject performSelector:withObject:withObject:] + 77
17  com.apple.Foundation          0x9520e47a __76-[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]_block_invoke + 121
18  com.apple.Foundation          0x9520dfb1 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 430
19  com.apple.Foundation          0x9520ddbb _NSAppleEventManagerGenericHandler + 218
20  com.apple.AE                  0x98f54b15 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 387
21  com.apple.AE                  0x98f23ed6 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 44
22  com.apple.AE                  0x98f23dce aeProcessAppleEvent + 318
23  com.apple.HIToolbox            0x9ba08571 AEProcessAppleEvent + 55
24  com.apple.AppKit              0x944e9148 _DPSNextEvent + 1089
25  com.apple.AppKit              0x944e8870 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
26  com.apple.AppKit              0x944db15c -[NSApplication run] + 727
27  com.xxxxxxxxxx.su          0x000631c8 CustomApplicationMain + 428
28  com.xxxxxxxxxx.su          0x00063643 main + 280
29  com.xxxxxxxxxx.su          0x000022ee _start + 228
30  com.xxxxxxxxxx.su          0x00002209 start + 41

Thread 1 Crashed:
0   libsystem_kernel.dylib        0x92cdc046 __workq_kernreturn + 10
1   libsystem_pthread.dylib        0x97e27dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib        0x97e2bcce start_wqthread + 30

Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib        0x92cdc992 kevent64 + 10
1   libdispatch.dylib              0x9be49899 _dispatch_mgr_invoke + 238
2   libdispatch.dylib              0x9be49532 _dispatch_mgr_thread + 52

Thread 3:
0   libsystem_kernel.dylib        0x92cdc046 __workq_kernreturn + 10
1   libsystem_pthread.dylib        0x97e27dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib        0x97e2bcce start_wqthread + 30

Thread 4:
0   libsystem_kernel.dylib        0x92cdc046 __workq_kernreturn + 10
1   libsystem_pthread.dylib        0x97e27dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib        0x97e2bcce start_wqthread + 30

Thread 5:
0   libsystem_kernel.dylib        0x92cdc046 __workq_kernreturn + 10
1   libsystem_pthread.dylib        0x97e27dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib        0x97e2bcce start_wqthread + 30

Thread 6:
0   libsystem_kernel.dylib        0x92cdc046 __workq_kernreturn + 10
1   libsystem_pthread.dylib        0x97e27dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib        0x97e2bcce start_wqthread + 30

Thread 7:
0   libsystem_kernel.dylib        0x92cd6f7a mach_msg_trap + 10
1   libsystem_kernel.dylib        0x92cd616c mach_msg + 68
2   com.apple.CoreFoundation      0x95978bf9 __CFRunLoopServiceMachPort + 169
3   com.apple.CoreFoundation      0x959781d1 __CFRunLoopRun + 1393
4   com.apple.CoreFoundation      0x959779ea CFRunLoopRunSpecific + 394
5   com.apple.CoreFoundation      0x9597784b CFRunLoopRunInMode + 123
6   com.apple.AppKit              0x94692b88 _NSEventThread + 283
7   libsystem_pthread.dylib        0x97e265fb _pthread_body + 144
8   libsystem_pthread.dylib        0x97e26485 _pthread_start + 130
9   libsystem_pthread.dylib        0x97e2bcf2 thread_start + 34

Thread 1 crashed with X86 Thread State (32-bit):
  eax: 0x00100170  ebx: 0x00001103  ecx: 0xb0080f9c  edx: 0x92cdc046
  edi: 0x97e27c69  esi: 0xb0081000  ebp: 0xb0080fc8  esp: 0xb0080f9c
   ss: 0x00000023  efl: 0x00000282  eip: 0x92cdc046   cs: 0x0000000b
   ds: 0x00000023   es: 0x00000023   fs: 0x00000023   gs: 0x0000000f
  cr2: 0x0146b000
 
Logical CPU:     0
Error Code:      0x00100170
Trap Number:     132


External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 5
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 1938
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=151.7M resident=71.3M(47%) swapped_out_or_unallocated=80.4M(53%)
Writable regions: Total=149.6M written=14.8M(10%) resident=21.7M(14%) swapped_out=0K(0%) unallocated=128.0M(86%)

REGION TYPE                      VIRTUAL
===========                      =======
CG backing stores                  5684K
CG image                             12K
CG raster data                       12K
CG shared images                    172K
CoreServices                         64K
IOKit                              4096K
Kernel Alloc Once                     4K
MALLOC                            114.1M
MALLOC (admin)                       48K
Memory Tag 242                       12K
Memory Tag 249                      156K
Stack                              67.1M
VM_ALLOCATE                        16.4M
__DATA                             16.7M
__IMAGE                             528K
__IMPORT                              8K
__LINKEDIT                         46.8M
__OBJC                             1848K
__PAGEZERO                            4K
__TEXT                            104.9M
__UNICODE                           544K
mapped file                       154.6M
shared memory                         4K
===========                      =======
TOTAL                             533.5M

Model: MacPro3,1, BootROM Niresh12495.com, 4 processors, Intel Core i7, 2.39 GHz, 4 GB, SMC 1.30f3
Graphics: ATI Mobility Radeon HD 7670, ATI Mobility Radeon HD 7670, PCIe, 2048 MB
Memory Module: BANK 2/DIMM1, 4 GB, DDR3, 1600 MHz, N/A, N/A
Bluetooth: Version 4.2.6f1 14216, 3 services, 22 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
PCI Card: ATI Mobility Radeon HD 7670, Display Controller, Slot-1
Serial ATA Device: TOSHIBA MQ01ABF050, 500,11 GB
Serial ATA Device: TSSTcorp CDDVDW SN-208DN
USB Device: Hub
USB Device: USB to ATA/ATAPI bridge
USB Device: USB2.0-CRW
USB Device: TOSHIBA Web Camera - HD
USB Device: Mass Storage Device
USB Device: USB Optical Mouse
USB Device: Bluetooth USB Host Controller
USB Device: Hub
Thunderbolt Bus:


Kitty Hello

Crash is in ENDPOLY... Can you post a minimal example that crahes?

Gesendet von meinem GT-N7100 mit Tapatalk


Kyo

it is possible that the problem is here?

Code (glbasic) Select

STARTPOLY num
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\
POLYVECTOR x1,y1,0,0,color
POLYVECTOR x1,y1+y2,0,sy,color
POLYVECTOR x1+x2,y1+y2,sx,sy,color
POLYVECTOR x1+x2,y1,sx,0,color
ENDPOLY


How do I post a demo of the error?
My game has a lot of code and a lot of calls to STARTPOLY
I do not know what that genrated the error.

Kyo

Yes the problem it's:
Code (glbasic) Select

                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\


but now i have the Backgroud scroll with 1 line Black Pikel.
How to fix????

spacefractal

hoe about move glTexParameteri before STARTPOLY?

Also its could been some sourt of unsupported feature on Mac in one of the parameter.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kyo

Quote from: spacefractal on 2014-Aug-25
hoe about move glTexParameteri before STARTPOLY?

Also its could been some sourt of unsupported feature on Mac in one of the parameter.

If i move before startpoly, don't work .....
And now, how fis this?
I have black line in the middle of the 2 images of the background... it's horrible

MrTAToad

Yes, you can't do anything within START/ENDPOLY blocks.

What you could try doing is splitting the routine into two, so that you can modify the texture parameters.

Kyo

Quote from: MrTAToad on 2014-Aug-25
Yes, you can't do anything within START/ENDPOLY blocks.

What you could try doing is splitting the routine into two, so that you can modify the texture parameters.

I don't know how ....

Kyo

Please help, I have to fix this problem!

MrTAToad

Could try :

Code (glbasic) Select

                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\
STARTPOLY num,1
                POLYVECTOR x1,y1,0,0,color
                POLYVECTOR x1,y1+y2,0,sy,color
                POLYVECTOR x1+x2,y1+y2,sx,sy,color
                POLYVECTOR x1+x2,y1,sx,0,color
                ENDPOLY


Or perhaps change the 1 to 2

Moru

It's much easier to help you if you can create a minimal testprogram that crashes. Include all needed data, zip it up and attach it to your post here.

Kyo

Quote from: MrTAToad on 2014-Aug-26
Could try :

Code (glbasic) Select

                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\
STARTPOLY num,1
                POLYVECTOR x1,y1,0,0,color
                POLYVECTOR x1,y1+y2,0,sy,color
                POLYVECTOR x1+x2,y1+y2,sx,sy,color
                POLYVECTOR x1+x2,y1,sx,0,color
                ENDPOLY


Or perhaps change the 1 to 2

I try, but don't work, with flag 1 or 2  becomes worse ....


Quote from: Moru on 2014-Aug-26
It's much easier to help you if you can create a minimal testprogram that crashes. Include all needed data, zip it up and attach it to your post here.

I found the error, read the whole discussion ...   :'(

Other solution????  :nw:



Kyo

Ok I prepared a small example.

If you go to the end of the code, you see:

Code (glbasic) Select

IMPORT "C" void __stdcall glTexParameteri(unsigned int flag0, unsigned int flag1, unsigned int flag2);
GLOBAL GL_CLAMP_TO_EDGE%                                   = 0x812F
GLOBAL GL_TEXTURE_2D%                                      = 0x0DE1
GLOBAL GL_TEXTURE_WRAP_S%                                  = 0x2802
GLOBAL GL_TEXTURE_WRAP_T%                                  = 0x2803


FUNCTION z_drawstage: num%,x%,y%,flip=0,xzoom = 0, yzoom = 0, adv_x = 0, Scale# = 1, color=0xFFFFFF, lungh = -1
LOCAL sx,sy,x1,y1,x2,y2

GETSPRITESIZE num,sx,sy

IF lungh >= 0 THEN sx = lungh

IF xzoom <> 0 THEN xzoom = x_zoom + xzoom
IF yzoom <> 0 THEN yzoom = y_zoom + yzoom

IF xzoom <> 0 THEN x = x - adv_x


IF xzoom = 0 THEN xzoom = x_zoom
IF yzoom = 0 THEN yzoom = y_zoom



x1=(x_offset+(x*xzoom)) * Scale#
x2=(sx*xzoom) * Scale#
y1=(y_offset+(y*yzoom)) * Scale#
y2=(sy*yzoom) * Scale#


STARTPOLY num
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\
POLYVECTOR x1,y1,0,0,color
POLYVECTOR x1,y1+y2,0,sy,color
POLYVECTOR x1+x2,y1+y2,sx,sy,color
POLYVECTOR x1+x2,y1,sx,0,color
ENDPOLY
ENDFUNCTION



if you put in Rem, the two lines or put on STARTPOLY num), you see the error:
Code (glbasic) Select

//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);// Changed \\
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);// Changed \\


The BG sprites are 301px W X 300 px H, i remove 1 PX to overlay the sprites:

Code (glbasic) Select

IF i = 1 THEN x = 0
IF i = 2 THEN x = 300
IF i = 3 THEN x = 600

MrTAToad

Could always subtract 0.5 from x1 and y1 - that works!

spacefractal

you could also convert it to integer to make sure its dosent get somewhere a float, which often seen the issue. This is was im do when im scaling my game to make sure you dont seen black lines.

can been done something like x=INTERGER(x)
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/