extern vhandle AddVariable( char *vbl_name ) /******************************************/ { vhandle var_handle; var_handle = GetVariableByName( vbl_name ); if( var_handle == NO_VAR ) var_handle = NewVariable( vbl_name ); return( var_handle ); }
UnlitTexEffect::UnlitTexEffect(ID3D10Device* pDXDevice, ID3D10Effect* effect): Effect(pDXDevice, effect), m_pMtxWVP(GetVariableBySemantic("WorldViewProjection")->AsMatrix()), m_pDiffuseMap(GetVariableByName("diffuseMap")->AsShaderResource()), m_pInputLayout(0), m_VertexStride(0) { ASSERT(m_pMtxWVP->IsValid() != 0, ""); ASSERT(m_pDiffuseMap->IsValid() != 0, ""); CreateInputLayout<VertexPosNormTanTex>(pDXDevice, this, &m_pInputLayout, m_VertexStride); }
void ScriptEngine::parseVar(char * c, char ** args) { // $VARIABLE = value NamedVar var; if (_numVars == MAX_VARIABLES) { WriteLine(PSTR("Maximum variables in use.\r\n")); return; } if ( var = GetVariableByName((++c)), !strcmp(var.name,"!FOUND")) { // new variable var = GetNextAvailVariable(); StringCopy(var.name,c); var.val.val16 = atol(args[1]); if (!AddVariable(var)) WriteLine(PSTR("Problem writing variable to EEPROM.")); } else { // reassigning an instantiated variable var.val.val16 = atoi(args[1]); eeprom_write_block((const void*)&var,(void*)&Variables[var.slot], sizeof(NamedVar)); } }
/////////////////////////////////////////////////////[ class ScriptEngine void ScriptEngine::parseEcho(char ** args) { if (*args[0] == '%') { // register uint8 * reg = Register::GetRegisterByName(++(args[0])); if (reg) { WriteRAM(args[0],0); Register::WriteRegister(reg); WriteLine(PSTR("\r\n")); } } else if (*args[0] == '$') { NamedVar v = GetVariableByName(++args[0]); if (!strcmp(v.name,"!FOUND")) { WriteLine(PSTR("Unknown variable.\r\n")); return; } char buff[25]; sprintf_P(buff,PSTR("$%8s --> %d\r\n"),v.name,v.val.val16); WriteRAM(buff); } }
extern void GUImain( void ) /*************************/ { int argc = 0; char **argv = NULL; char *dir; char *drive; char *inf_name; char *tmp_path; char *arc_name; char *new_inf; char current_dir[_MAX_PATH]; bool ret = FALSE; dlg_state state; GUIMemOpen(); GUIGetArgs( &argv, &argc ); #if defined( __NT__ ) if( CheckWin95Uninstall( argc, argv ) ) return; #endif #ifdef __WINDOWS__ if( CheckForSetup32( argc, argv ) ) return; #endif // initialize paths and env. vbls. if( !SetupPreInit() ) return; if( !GetDirParams( argc, argv, &inf_name, &tmp_path, &arc_name ) ) return; if( !SetupInit() ) return; GUIDrainEvents(); // push things along FileInit( arc_name ); InitGlobalVarList(); strcpy( current_dir, tmp_path ); while( InitInfo( inf_name, tmp_path ) ) { ret = DoMainLoop( &state ); if( state == DLG_DONE ) break; // if( CancelSetup == TRUE || !ret ) break; if( CancelSetup == TRUE ) break; // if( !ret ) break; // look for another SETUP.INF if( GetVariableByName( "SetupPath" ) == NO_VAR ) { if( DirParamStack( &inf_name, &tmp_path, Stack_IsEmpty ) == FALSE ) { // "IsEmpty"? DirParamStack( &inf_name, &tmp_path, Stack_Pop ); // "Pop" CloseDownMessage( ret ); CancelSetup = FALSE; ret = TRUE; } else { CloseDownMessage( ret ); break; } } else { if( GetVariableIntVal( "IsMultiInstall" ) ) { // push current script on stack DirParamStack( &inf_name, &tmp_path, Stack_Push ); // "Push" } new_inf = GUIMemAlloc( _MAX_PATH ); drive = GUIMemAlloc( _MAX_DRIVE ); dir = GUIMemAlloc( _MAX_PATH ); if( new_inf == NULL || drive == NULL || dir == NULL ) { GUIMemFree( new_inf ); GUIMemFree( drive ); GUIMemFree( dir ); break; } // construct new path relative to previous ReplaceVars( new_inf, GetVariableStrVal( "SetupPath" ) ); _splitpath( current_dir, drive, dir, NULL, NULL ); _makepath( inf_name, drive, dir, new_inf, NULL ); _splitpath( inf_name, drive, dir, NULL, NULL ); _makepath( tmp_path, drive, dir, NULL, NULL ); // strcpy( current_dir, tmp_path ); GUIMemFree( new_inf ); GUIMemFree( drive ); GUIMemFree( dir ); } /* if */ FreeGlobalVarList( FALSE ); FreeDefaultDialogs(); FreeAllStructs(); ConfigModified = FALSE; } /* while */ FileFini(); FreeGlobalVarList( TRUE ); FreeDefaultDialogs(); FreeAllStructs(); FreeDirParams( &inf_name, &tmp_path, &arc_name ); CloseDownProgram(); }
extern bool DoMainLoop( dlg_state * state ) /*****************************************/ { const char *diag_list[MAX_DIAGS + 1]; const char *diags; const char *dstdir; int dstlen; bool got_disk_sizes = FALSE; int i; char newdst[_MAX_PATH]; char *next; bool ret = FALSE; SetupTitle(); // display initial dialog diags = GetVariableStrVal( "DialogOrder" ); if( stricmp( diags, "" ) == 0 ) { diags = "Welcome"; } i = 0; for( ;; ) { diag_list[i] = diags; next = strchr( diags, ',' ); if( next == NULL ) break; *next = '\0'; diags = next + 1; ++i; } diag_list[i + 1] = NULL; /* process installation dialogs */ i = 0; for( ;; ) { if( i < 0 ) break; if( diag_list[i] == NULL ) { if( GetVariableIntVal( "DoCopyFiles" ) == 1 ) { if( !CheckDrive( TRUE ) ) { i = 0; } } if( GetVariableByName( "SetupPath" ) != NO_VAR ) { ret = TRUE; break; } if( diag_list[i] == NULL ) { StatusShow( TRUE ); ret = SetupOperations(); StatusShow( FALSE ); if( ret ) DoDialog( "Finished" ); break; } } if( stricmp( diag_list[i], "GetDiskSizesHere" ) == 0 ) { if( *state == DLG_NEXT ) { dstdir = GetVariableStrVal( "DstDir" ); dstlen = strlen( dstdir ); if( dstlen != 0 && (dstdir[dstlen - 1] == '\\' || dstdir[dstlen - 1] == '/') ) { strcpy( newdst, dstdir ); if( dstlen == 3 && dstdir[1] == ':' ) { newdst[dstlen] = '.'; newdst[dstlen + 1] = '\0'; } else { newdst[dstlen - 1] = '\0'; } SetVariableByName( "DstDir", newdst ); } SimSetNeedGetDiskSizes(); ResetDiskInfo(); got_disk_sizes = TRUE; } } else { *state = DoDialog( diag_list[i] ); GUIWndDirty( NULL ); StatusCancelled(); } if( *state == DLG_CAN ) { if( MsgBox( NULL, "IDS_QUERYABORT", GUI_YES_NO ) == GUI_RET_YES ) { CancelSetup = TRUE; break; } } else if( *state == DLG_DONE ) { CancelSetup = TRUE; break; } if( got_disk_sizes ) { if( !CheckDrive( FALSE ) ) { break; } } if( *state == DLG_SAME ) { /* nothing */ } else if( *state == DLG_NEXT || *state == DLG_SKIP ) { if( SkipDialogs ) { ++i; } else { for( ;; ) { ++i; if( diag_list[i] == NULL ) break; if( CheckDialog( diag_list[i] ) ) break; } } } else if( *state == DLG_PREV ) { for( ;; ) { --i; if( i < 0 ) break; if( CheckDialog( diag_list[i] ) ) break; } } else if( *state == DLG_START ) { i = 0; } } /* for */ return( ret ); }
extern vhandle SetVariableByName( char *vbl_name, const char *strval ) /********************************************************************/ { return( DoSetVariable( GetVariableByName( vbl_name ), strval, vbl_name ) ); }
extern const char *GetVariableStrVal( const char *vbl_name ) /**********************************************************/ { return( VarGetStrVal( GetVariableByName( vbl_name ) ) ); }
extern int GetVariableIntVal( const char *vbl_name ) /**************************************************/ { return( VarGetIntVal( GetVariableByName( vbl_name ) ) ); }