Changeset 690


Ignore:
Timestamp:
Mar 6, 2013, 7:33:15 PM (7 years ago)
Author:
alloc
Message:

Daodan: Cleaning up code (a few comments, old commented out stuff removed), ugly wine-crash fix for DaodanGL

Location:
Daodan/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/BFW_Utility.h

    r677 r690  
    2525//int __cdecl AUrMessageBox(int Buttons, char *Message, ...);
    2626
    27 extern uint32_t COgConsoleLines;
    28 extern uint32_t COgFadeTimeValue;
    29 extern uint32_t COgDefaultTextShade;
    30 extern uint32_t COgDefaultTextShadow;
    31 
    32 extern FILE* ONgFileStartup;
    33 
    3427#endif
  • Daodan/src/Daodan.c

    r689 r690  
    5555bool opt_usedaodanbsl = true;
    5656bool opt_border = true;
    57 bool opt_shadow = false;
    5857bool opt_topmost = false;
    5958
     
    144143        if (patch_alttab)
    145144        {
     145                // 0xC3 = ret, so makes those functions just have a "ret" instruction at their start
    146146                DDrPatch_Byte  ((char*)UUrPlatform_Initialize, 0xC3);
    147147                DDrPatch_Byte  ((char*)UUrPlatform_Terminate, 0xC3);
     
    313313                        else if (!_stricmp(name, "border"))
    314314                                opt_border = !_stricmp(inifile_cleanstr(value), "true");
    315                         else if (!_stricmp(name, "shadow"))
    316                                 opt_shadow = !_stricmp(inifile_cleanstr(value), "true");
    317315                        else if (!_stricmp(name, "topmost"))
    318316                                opt_topmost = !_stricmp(inifile_cleanstr(value), "true");
     
    589587        DDrStartupMessage("daodan attached!");
    590588       
     589        // Tell Oni to not load non levelX_final-files by default:
    591590        opt_ignore_private_data = false;
     591
     592        // Enable sound by default:
    592593        opt_sound = true;
    593594       
  • Daodan/src/Daodan.h

    r677 r690  
    1212
    1313extern bool opt_border;
    14 extern bool opt_shadow;
    1514extern bool opt_topmost;
    1615
  • Daodan/src/Daodan_Cheater.c

    r689 r690  
    104104                case cheat_bigbadboss:
    105105                {
    106                         GameState* GameState = ONgGameState;
    107 
    108106                        Character* player = ONgGameState->PlayerCharacter;
    109107                        //char* player = *((char**)(ONgGameState + GSA_player));
  • Daodan/src/Daodan_WindowHack.c

    r689 r690  
    77#include "BFW_Motoko_Draw.h"
    88#include "oni_gl.h"
    9 
    10 #define DD_CS_DROPSHADOW 0x20000
    119
    1210volatile HWND onihwnd, boxhwnd = NULL;
     
    6563       
    6664        wc.cbSize = sizeof(WNDCLASSEX);
    67         wc.style = (opt_border ? 0 : (opt_shadow ? DD_CS_DROPSHADOW : 0));
     65        wc.style = 0;
    6866        wc.lpfnWndProc = DDrHack_WndProc;
    6967        wc.cbClsExtra = 0;
  • Daodan/src/Oni.h

    r677 r690  
    1515        HWND Window;
    1616} ONtPlatformData;
    17 /*
    18 void __cdecl ONiMain(int ArgCount, char *ArgList[]);
    19 short ONICALL ONrPlatform_Initialize(ONtPlatformData *PlatformData);
    20 LRESULT CALLBACK ONrPlatform_WindowProc(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam);
    21 */
    22 //uint8_t ONICALL ONrCheater(uint32_t cheat);
    2317
    24 //char* ONICALL SSrMessage_Find(char* message_key); //Returns a prompt message from a message key
    25 //void ONICALL ONiGameState_FindAutoPromptMessage(char* Note, void* ptr);
    2618
    27 //
    2819void ONICALL TMrInstance_GetDataPtr_List(
    2920        char Tag[4],            //as in 'ONWC'
  • Daodan/src/Oni_Symbols.h

    r688 r690  
    88#include "BFW_ScriptLang.h"
    99
    10 #define DefVar(type, name, address) static type* _##name = (type*)address
    11 DefVar( onibool,                ai2_deaf,                               0x005ec0c1 );
    1210
    13 DefVar( HINSTANCE,              g_Instance,                             0x0061F9E4 );
     11//Define variables of Oni: #define VARNAME (*((TYPE*)ADDRESS))
    1412
    15 DefVar( gl_api_t*,              gl_api,                                 0x00560604 );
    16 DefVar( gl_engine_t*,   gl_eng,                                 0x00560600 );
    17 DefVar( WORD*,                  gl_gamma_ramp,                  0x0055fdfc );
    18 DefVar( int,                    gl_gamma_ramp_valid,    0x005603fc );
     13// AIs are deaf (ger: "taub")
     14#define ai2_deaf                        (*((onibool*)0x005ec0c1))
    1915
    20 DefVar( char,                   opt_ignore_private_data,0x006370f0 );
    21 DefVar( char,                   opt_sound,                              0x006370fc );
     16// Option "debug" ... but what does it do?
     17#define AKgDebug_DebugMaps      (*((char*)0x002b2204))
    2218
    23 DefVar( char,                   AKgDebug_DebugMaps,             0x002b2204 );
     19// Option "debugfiles" ... but what does it do?
     20#define BFgDebugFileEnable      (*((bool*)0x0055c8d0))
    2421
    25 DefVar( bool,                   BFgDebugFileEnable,             0x0055c8d0 );
     22// Parameter 1 to COrTextArea_Print. Context pointer?
     23#define COgConsoleLines         (*((uint32_t*)0x005cb468))
    2624
    27 DefVar( uint32_t,               COgConsoleLines,                0x005cb468 );
    28 DefVar( uint32_t,               COgDefaultTextShade,    0x00533f70 );
    29 DefVar( uint32_t,               COgDefaultTextShadow,   0x00533f74 );
    30 DefVar( uint32_t,               COgFadeTimeValue,               0x00533f68 );
     25// Default console text color
     26#define COgDefaultTextShade     (*((uint32_t*)0x00533f70))
    3127
    32 DefVar( FILE*,                  ONgFileStartup,                 0x005711b8 );
    33 DefVar( GameState*,             ONgGameState,                   0x005ece7c );
    34 DefVar( ONtPlatformData,ONgPlatformData,                0x0053100c );
     28// Default console text shadow color
     29#define COgDefaultTextShadow    (*((uint32_t*)0x00533f74))
    3530
    36 DefVar( char,                   M3gResolutionSwitch,    0x00531634 );
     31// Console text fade timeout
     32#define COgFadeTimeValue        (*((uint32_t*)0x00533f68))
    3733
    38 DefVar( bool,                   SSgSearchOnDisk,                0x005eb758 );
    39 #undef DefVar
    40 //Yes, I'm aware that there are a few ways this could go wrong
    41 //but in the interests of neatness and not having to go through and rename all the variables
    42 //and use annoying dereferencing, this will do.
     34// Some kind of graphics context?
     35#define g_Instance                      (*((HINSTANCE*)0x0061F9E4))
    4336
    44 //...too bad there is no way to nest #defines...
    45 #define AKgDebug_DebugMaps (*_AKgDebug_DebugMaps)
    46 #define ai2_deaf (*_ai2_deaf)
    47 #define g_Instance (*_g_Instance)
    48 #define M3gResolutionSwitch (*_M3gResolutionSwitch)
    49 #define ONgGameState (*_ONgGameState)
    50 #define ONgPlatformData (*_ONgPlatformData)
    51 #define opt_ignore_private_data (*_opt_ignore_private_data)
    52 #define opt_sound (*_opt_sound)
    53 #define BFgDebugFileEnable (*_BFgDebugFileEnable)
    54 #define SSgSearchOnDisk (*_SSgSearchOnDisk)
    55 #define gl_gamma_ramp (*_gl_gamma_ramp)
    56 #define gl_gamma_ramp_valid (*_gl_gamma_ramp_valid)
    57 #define gl_api (*_gl_api)
    58 #define gl_eng (*_gl_eng)
    59 #define COgConsoleLines (*_COgConsoleLines)
    60 #define COgFadeTimeValue (*_COgFadeTimeValue)
    61 #define COgDefaultTextShade (*_COgDefaultTextShade)
    62 #define COgDefaultTextShadow (*_COgDefaultTextShadow)
    63 #define ONgFileStartup (*_ONgFileStartup)
     37// OpenGL Gamma related
     38#define gl_gamma_ramp           (*((WORD**)0x0055fdfc))
     39
     40// OpenGL Gamma related
     41#define gl_gamma_ramp_valid     (*((int*)0x005603fc))
     42
     43// OpenGL whatev?
     44#define gl_api                          (*((gl_api_t**)0x00560604))
     45
     46// OpenGL whatev?
     47#define gl_eng                          (*((gl_engine_t**)0x00560600))
     48
     49// Value of -switch/-noswitch?
     50#define M3gResolutionSwitch     (*((char*)0x00531634))
     51
     52// Startup.txt file handle
     53#define ONgFileStartup          (*((FILE**)0x005711b8))
     54
     55// Current GameState
     56#define ONgGameState            (*((GameState**)0x005ece7c))
     57
     58// Current ONtPlatformData
     59#define ONgPlatformData         (*((ONtPlatformData*)0x0053100c))
     60
     61// Load non levelX_final-files yes/no
     62#define opt_ignore_private_data (*((char*)0x006370f0))
     63
     64// Play sound yes/no
     65#define opt_sound                       (*((char*)0x006370fc))
     66
     67// Option "findsounds" ... but what does it do?
     68#define SSgSearchOnDisk         (*((bool*)0x005eb758))
    6469
    6570
     71// Method signature for script (BSL) functions
    6672typedef uint16_t        ( ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret);
     73
     74// Used by function definition below: OBJrObjectType_EnumerateObjects
    6775typedef char            ( ONICALL *OBJtEnumCallback_Object)(void *inObject, int inUserData);
    6876
    6977
    70 #undef DefFunc
     78
    7179#define DefFunc( type, name, callingconvention, args, address) typedef type ( callingconvention * _##name ) args; static _##name name = (_##name)address
     80
     81// Orig timing functions, replaced by DDrMachineTime_* if option "usegettickcount" is enabled
    7282DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x04026480);
    7383DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x040264b0);
    7484DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x040263e0);
     85
     86// Code to initialize platform stuff (like disabling system key combination Alt+Tab)
    7587DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x04026010);
    7688DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x04026310);
    7789
     90// Oni's file access methods
    7891DefFunc(FILE*, oni_fopen, __cdecl, (const char*, const char*), 0x0051ea9f);
    7992DefFunc(int, oni_fprintf, __cdecl, (FILE*, const char*, ...), 0x0051ebbf);
    8093DefFunc(int, oni_fflush, __cdecl, (FILE*), 0x0051eab2);
    8194
     95// Oni's main method?
    8296DefFunc(void, ONiMain, __cdecl, (int ArgCount, char *ArgList[]), 0x004d3280);
     97
     98// Initialization code, used to hook in windowed modes
    8399DefFunc(short, ONrPlatform_Initialize, ONICALL, (ONtPlatformData *PlatformData), 0x0050f670);
    84100DefFunc(LRESULT, ONrPlatform_WindowProc, CALLBACK, (HWND Window, UINT Message, WPARAM WParam, LPARAM LParam), 0x0050f7a0);
     101
     102// Retrieves a list of resolutions, replaced by "daodan_enumerate_valid_display_modes"
    85103DefFunc(unsigned int, gl_enumerate_valid_display_modes, ONICALL, (M3tDisplayMode modes[16]), 0x004083a0);
    86104DefFunc(int, gl_platform_set_pixel_format, ONICALL, (HDC hdc), 0x00407b50);
  • Daodan/src/daodan_gl.c

    r689 r690  
    235235                DDrStartupMessage("Using standard Windows gamma adjustment");
    236236
    237                 if (GetDeviceGammaRamp(gl_eng->HDC, gl_gamma_ramp))
     237//WINE CRASH!           if (GetDeviceGammaRamp(gl_eng->HDC, gl_gamma_ramp))
    238238                        gl_gamma_ramp_valid = 1;
    239239        }
Note: See TracChangeset for help on using the changeset viewer.