Subversion Repositories pentevo

Rev

Rev 883 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "std.h"
  2. #pragma hdrstop
  3.  
  4. #include "emul.h"
  5.  
  6. #define SND_TEST_FAILURES
  7. //#define SND_TEST_SHOWSTAT
  8. #include "mods.h"
  9.  
  10. //#include "9x.h"
  11. #include "resource.h"
  12.  
  13. //------- Alone Coder ---------
  14. #include <winioctl.h>
  15.  
  16. #ifndef INVALID_SET_FILE_POINTER
  17. #define INVALID_SET_FILE_POINTER (DWORD)-1
  18. #endif
  19.  
  20. typedef unsigned int UINT32;
  21. typedef signed int INT32;
  22. typedef unsigned short UINT16;
  23. typedef signed short INT16;
  24. typedef unsigned char UINT8;
  25. typedef signed char INT8;
  26. unsigned frametime = 111111; //Alone Coder (GUI value for conf.frame)
  27. //~------- Alone Coder ---------
  28.  
  29. unsigned nmi_pending = 0;
  30.  
  31. bool ConfirmExit();
  32. BOOL WINAPI ConsoleHandler(DWORD CtrlType);
  33.  
  34. #include "sndrender/emul_2203.h" //Dexus
  35. #include "sndrender/sndrender.h"
  36. #include "emul.h"
  37. #include "sndrender/sndchip.h"
  38. #include "sndrender/sndcounter.h"
  39. #include "init.h"
  40. #include "funcs.h"
  41. #include "debug.h"
  42. #include "vars.h"
  43. #include "dx.h"
  44. #include "draw.h"
  45. #include "mainloop.h"
  46. #include "iehelp.h"
  47. #include "util.h"
  48.  
  49. void m_nmi(ROM_MODE page);
  50. void showhelp(const char *anchor)
  51. {
  52.    OnEnterGui(); //Alone Coder 0.36.6
  53.    showhelppp(anchor); //Alone Coder 0.36.6
  54.    OnExitGui(); //Alone Coder 0.36.6
  55. }
  56.  
  57. static LONG __stdcall filter(EXCEPTION_POINTERS *pp)
  58. {
  59.    color(CONSCLR_ERROR);
  60.    printf("\nexception %08lX at eip=%p\n",
  61.                 pp->ExceptionRecord->ExceptionCode,
  62.                 pp->ExceptionRecord->ExceptionAddress);
  63. #if _M_IX86
  64.    printf("eax=%08lX ebx=%08lX ecx=%08lX edx=%08lX\n"
  65.           "esi=%08lX edi=%08lX ebp=%08lX esp=%08lX\n",
  66.           pp->ContextRecord->Eax, pp->ContextRecord->Ebx,
  67.           pp->ContextRecord->Ecx, pp->ContextRecord->Edx,
  68.           pp->ContextRecord->Esi, pp->ContextRecord->Edi,
  69.           pp->ContextRecord->Ebp, pp->ContextRecord->Esp);
  70. #endif
  71. #if _M_IX64
  72.    printf("rax=%016I64X rbx=%016I64X rcx=%016I64X rdx=%016I64X\n"
  73.           "rsi=%016I64X rdi=%016I64X rbp=%016I64X rsp=%016I64X\n",
  74.           pp->ContextRecord->Rax, pp->ContextRecord->Rbx,
  75.           pp->ContextRecord->Rcx, pp->ContextRecord->Rdx,
  76.           pp->ContextRecord->Rsi, pp->ContextRecord->Rdi,
  77.           pp->ContextRecord->Rbp, pp->ContextRecord->Rsp);
  78. #endif
  79.    color();
  80.    return EXCEPTION_CONTINUE_SEARCH;
  81. }
  82.  
  83. static volatile bool Exit = false;
  84.  
  85. bool ConfirmExit()
  86. {
  87.     if(!conf.ConfirmExit)
  88.         return true;
  89.  
  90.     return MessageBox(wnd, "Exit ?", "Unreal", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES;
  91. }
  92.  
  93. BOOL WINAPI ConsoleHandler(DWORD CtrlType)
  94. {
  95.     switch(CtrlType)
  96.     {
  97.     case CTRL_C_EVENT:
  98.     case CTRL_BREAK_EVENT:
  99.         if(ConfirmExit())
  100.             Exit = true;
  101.         return TRUE;
  102.     }
  103.     return FALSE;
  104. }
  105.  
  106. int __cdecl main(int argc, char **argv)
  107. {
  108.  
  109.    DWORD Ver = GetVersion();
  110.  
  111.    WinVerMajor = (DWORD)(LOBYTE(LOWORD(Ver)));
  112.    WinVerMinor = (DWORD)(HIBYTE(LOWORD(Ver)));
  113.  
  114.    CONSOLE_SCREEN_BUFFER_INFO csbi;
  115.    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
  116.    nowait = *(unsigned*)&csbi.dwCursorPosition;
  117.  
  118.    SetThreadAffinityMask(GetCurrentThread(), 1);
  119.  
  120.    SetConsoleCtrlHandler(ConsoleHandler, TRUE);
  121.  
  122.    color(CONSCLR_TITLE);
  123.    printf("UnrealSpeccy %s by SMT, %s\n", VERS_STRING_, __DATE__);
  124.    printf("Integrated YM2203 version 1.4A by Tatsuyuki Satoh, Jarek Burczynski, Alone Coder\n"); //Dexus
  125. #ifdef __ICL
  126.    printf("Intel C++ Compiler: %d.%02d\n", __ICL/100, __ICL % 100);
  127. #endif
  128.    color();
  129.    // http://sourceforge.net/projects/unrealspeccy/
  130.    // http://alonecoder.narod.ru/
  131.    // http://dlcorp.ucoz.ru/forum/22
  132.    printf(" *** new versions & sources -> http://dlcorp.nedopc.com/viewforum.php?f=8 ***\n");
  133.  
  134. #ifndef DEBUG
  135.    SetUnhandledExceptionFilter(filter);
  136. #endif
  137.  
  138.    _set_error_mode(_OUT_TO_MSGBOX);
  139.    load_spec_colors();
  140.    init_all(argc-1, argv+1);
  141. //   applyconfig();
  142.    sound_play();
  143.    color();
  144.  
  145.    mainloop(Exit);
  146.    return 0;
  147. }
  148.  
  149. COMPUTER::COMPUTER()
  150. {
  151.     for(unsigned i = 0; i < 4; i++) // [vv] ─ы  єфюсёЄтр юЄырфъш
  152.     {
  153.         fdd[i].Id = u8(i);
  154.     }
  155. }
  156.