annotate src/hermes/x86_main.asm @ 4324:1496aa09e41e SDL-1.2

Steven Noonan to sdl While trying to build the SDLMain.m included with SDL 1.2.14, with #define SDL_USE_NIB_FILE 1: /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function '-[SDLMain fixMenu:withAppName:]': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122: warning: 'sizeToFit' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function 'main': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: warning: 'poseAsClass:' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: error: 'poseAsClass:' is unavailable (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377: warning: passing argument 2 of 'NSApplicationMain' from incompatible pointer type Eric Wing to Sam I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method. This was deprecated in Obj-C 2.0 and not retained in 64-bit. I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that. Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason). Three thoughts come to mind. 1) The Info.plist has properties to control things related to the startup class and nib. NSPrincipalClass, NSMainNibFile Maybe principle class needs to be SDLApplication and we can delete the poseAs 2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics. 3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance): @interface SDLApplication : NSApplication @end @implementation SDLApplication /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end So instead, we change this to: (warning written in mail and untested) @interface NSApplication (SDLApplication) - (void) terminate:(id)sender; @end @implementation NSApplication (SDLApplication) /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line). Perhaps you could ask the bug reporter to try this solution (#3). And if that fails, maybe try #1. -Eric Steven Noonan to Sam The suggested change (diff below) seems to work fine. - Steven
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Oct 2009 21:07:12 +0000
parents 540466e900db
children
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 ; x86 format converters for HERMES
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
3 ; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4 ; This source code is licensed under the GNU LGPL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 ; Please refer to the file COPYING.LIB contained in the distribution for
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 ; licensing conditions
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9 ; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 ;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 BITS 32
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13
1873
eb4d9d99849b Renamed, per Mike's comment on bug #157
Sam Lantinga <slouken@libsdl.org>
parents: 1871
diff changeset
14 %include "common.inc"
1871
9ff9a58fa1e3 Fixed bug #157
Sam Lantinga <slouken@libsdl.org>
parents: 1227
diff changeset
15
9ff9a58fa1e3 Fixed bug #157
Sam Lantinga <slouken@libsdl.org>
parents: 1227
diff changeset
16 SDL_FUNC _ConvertX86
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18 SECTION .text
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
20 ;; _ConvertX86:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 ;; [ESP+8] ConverterInfo*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22 ;; --------------------------------------------------------------------------
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 ;; ConverterInfo (ebp+..)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 ;; 0: void *s_pixels
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 ;; 4: int s_width
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 ;; 8: int s_height
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 ;; 12: int s_add
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 ;; 16: void *d_pixels
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 ;; 20: int d_width
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 ;; 24: int d_height
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 ;; 28: int d_add
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 ;; 32: void (*converter_function)()
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 ;; 36: int32 *lookup
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 _ConvertX86:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 push ebp
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 mov ebp,esp
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39 ; Save the registers used by the blitters, necessary for optimized code
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 pusha
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 mov eax,[ebp+8]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 cmp dword [eax+4],BYTE 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 je endconvert
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47 mov ebp,eax
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 mov esi,[ebp+0]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 mov edi,[ebp+16]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52 y_loop:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53 mov ecx,[ebp+4]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54
3983
540466e900db Removed textrels from hermes code.
Ryan C. Gordon <icculus@icculus.org>
parents: 1873
diff changeset
55 call [ebp+32]
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 add esi,[ebp+12]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58 add edi,[ebp+28]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
59
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 dec dword [ebp+8]
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 jnz y_loop
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
62
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 ; Restore the registers used by the blitters, necessary for optimized code
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 popa
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 pop ebp
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
67
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
68 endconvert:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
69 ret
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
70
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
71
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72
1199
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
73 %ifidn __OUTPUT_FORMAT__,elf
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
74 section .note.GNU-stack noalloc noexec nowrite progbits
2d6dc7de1145 From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents: 1166
diff changeset
75 %endif