main.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright (C) 2009 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #import <UIKit/UIKit.h>
  16. #import "Doom_App.h"
  17. #include <unistd.h>
  18. #include <string.h>
  19. extern char iphoneAppDirectory[1024];
  20. extern int myargc;
  21. extern char **myargv;
  22. int main(int argc, char *argv[]) {
  23. // save for doom
  24. myargc = argc;
  25. myargv = argv;
  26. // get the app directory based on argv[0]
  27. strcpy( iphoneAppDirectory, argv[0] );
  28. char * slashPosition = strrchr( iphoneAppDirectory, '/' );
  29. if ( slashPosition != NULL ) {
  30. *slashPosition = 0;
  31. } else {
  32. iphoneAppDirectory[0] = 0;
  33. }
  34. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  35. NSString * classString = NSStringFromClass([DoomApp class]);
  36. int retVal = UIApplicationMain(argc, argv, nil, classString );
  37. [pool release];
  38. return retVal;
  39. }