main.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. Copyright (C) 2009-2011 id Software LLC, a ZeniMax Media company.
  3. Copyright (C) 2009 Id Software, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #import <UIKit/UIKit.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. int len = strlen( iphoneAppDirectory );
  29. for( int i = len-1; i >= 0; i-- ) {
  30. if ( iphoneAppDirectory[i] == '/' ) {
  31. iphoneAppDirectory[i] = 0;
  32. break;
  33. }
  34. iphoneAppDirectory[i] = 0;
  35. }
  36. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  37. int retVal = UIApplicationMain(argc, argv, nil, nil);
  38. [pool release];
  39. return retVal;
  40. }