Mercurial > sdl-ios-xcode
annotate src/video/xbios/SDL_xbios_milan.h @ 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 | 6405314a7c07 |
children |
rev | line source |
---|---|
4195 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2009 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 #include "SDL_config.h" | |
23 | |
24 /* | |
25 Milan Xbios video functions | |
26 | |
27 Patrice Mandin | |
28 */ | |
29 | |
30 #ifndef _SDL_xbios_milan_h | |
31 #define _SDL_xbios_milan_h | |
32 | |
33 #include "SDL_xbios.h" | |
34 | |
35 /*--- Defines ---*/ | |
36 | |
37 /* Cookies */ | |
38 #ifndef C__MIL | |
39 #define C__MIL 0x5F4D494CL | |
40 #endif | |
41 | |
42 #ifndef C__VDI | |
43 #define C__VDI 0x5F564449L | |
44 #endif | |
45 | |
46 /* Vsetscreen() parameters */ | |
47 #define MI_MAGIC 0x4D49 | |
48 | |
49 enum { | |
50 CMD_GETMODE=0, | |
51 CMD_SETMODE, | |
52 CMD_GETINFO, | |
53 CMD_ALLOCPAGE, | |
54 CMD_FREEPAGE, | |
55 CMD_FLIPPAGE, | |
56 CMD_ALLOCMEM, | |
57 CMD_FREEMEM, | |
58 CMD_SETADR, | |
59 CMD_ENUMMODES | |
60 }; | |
61 | |
62 enum { | |
63 ENUMMODE_EXIT=0, | |
64 ENUMMODE_CONT | |
65 }; | |
66 | |
67 enum { | |
68 BLK_ERR=0, | |
69 BLK_OK, | |
70 BLK_CLEARED | |
71 }; | |
72 | |
4198
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
73 /* scrFlags */ |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
74 #define SCRINFO_OK 1 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
75 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
76 /* scrClut */ |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
77 #define NO_CLUT 0 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
78 #define HARD_CLUT 1 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
79 #define SOFT_CLUT 2 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
80 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
81 /* scrFormat */ |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
82 #define INTERLEAVE_PLANES 0 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
83 #define STANDARD_PLANES 1 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
84 #define PACKEDPIX_PLANES 2 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
85 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
86 /* bitFlags */ |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
87 #define STANDARD_BITS 1 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
88 #define FALCON_BITS 2 |
6405314a7c07
Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
89 #define INTEL_BITS 8 |
4195 | 90 |
91 /*--- Structures ---*/ | |
92 | |
93 typedef struct _scrblk { | |
94 unsigned long size; /* size of strukture */ | |
95 unsigned long blk_status; /* status bits of blk */ | |
96 unsigned long blk_start; /* Start Adress */ | |
97 unsigned long blk_len; /* length of memblk */ | |
98 unsigned long blk_x; /* x pos in total screen*/ | |
99 unsigned long blk_y; /* y pos in total screen */ | |
100 unsigned long blk_w; /* width */ | |
101 unsigned long blk_h; /* height */ | |
102 unsigned long blk_wrap; /* width in bytes */ | |
103 } __attribute__((packed)) SCRMEMBLK; | |
104 | |
105 typedef struct screeninfo { | |
106 unsigned long size; /* Size of structure */ | |
107 unsigned long devID; /* device id number */ | |
108 unsigned char name[64]; /* Friendly name of Screen */ | |
109 unsigned long scrFlags; /* some Flags */ | |
110 unsigned long frameadr; /* Adress of framebuffer */ | |
111 unsigned long scrHeight; /* visible X res */ | |
112 unsigned long scrWidth; /* visible Y res */ | |
113 unsigned long virtHeight; /* virtual X res */ | |
114 unsigned long virtWidth; /* virtual Y res */ | |
115 unsigned long scrPlanes; /* color Planes */ | |
116 unsigned long scrColors; /* # of colors */ | |
117 unsigned long lineWrap; /* # of Bytes to next line */ | |
118 unsigned long planeWarp; /* # of Bytes to next plane */ | |
119 unsigned long scrFormat; /* screen Format */ | |
120 unsigned long scrClut; /* type of clut */ | |
121 unsigned long redBits; /* Mask of Red Bits */ | |
122 unsigned long greenBits; /* Mask of Green Bits */ | |
123 unsigned long blueBits; /* Mask of Blue Bits */ | |
124 unsigned long alphaBits; /* Mask of Alpha Bits */ | |
125 unsigned long genlockBits;/* Mask of Genlock Bits */ | |
126 unsigned long unusedBits; /* Mask of unused Bits */ | |
127 unsigned long bitFlags; /* Bits organisation flags */ | |
128 unsigned long maxmem; /* max. memory in this mode */ | |
129 unsigned long pagemem; /* needed memory for one page */ | |
130 unsigned long max_x; /* max. possible width */ | |
131 unsigned long max_y; /* max. possible heigth */ | |
132 } __attribute__((packed)) SCREENINFO; | |
133 | |
134 /*--- Functions prototypes ---*/ | |
135 | |
136 void SDL_XBIOS_ListMilanModes(_THIS, int actually_add); | |
137 | |
138 #endif /* _SDL_xbios_milan_h */ |