ALLOCMEM.C

Go to the documentation of this file.
00001 //   file allocmem.c
00002 //   Allocate memory for the renderer's multithreading
00003 //   algorithm.
00004 
00005 
00006 #define MODULE_DITHER
00007 
00008 #include "render.h"
00009 
00010 extern HINSTANCE hThisInstance;
00011 
00017 typedef struct LibraryHandleListItem_tag {
00018   HMODULE hLib;          
00019   char   lib_name[1024];  
00020 } LibraryHandleListItem;
00021 
00022 
00023 extern long           *gZbuffer, *gXbuffer,   
00024                       *gZobject, *gXobject,
00025                       *gZglass[],
00026                       *gZglassO[];
00027 extern double         *gZdepth,
00028                       *gZposn,
00029                       *gZglassd[],
00030                       *gZground;
00031 extern unsigned char  *gRed,   *gGreen,   *gBlue,   *gAlfa,
00032                       *gL_Red, *gL_Green, *gL_Blue, *gL_Alfa,
00033                       *gLL_Red,*gLL_Green,*gLL_Blue,*gLL_Alfa;
00034 extern char gszHomeDir[];
00035 
00036 static char *GetRenderReplacementFilename(char *name);
00037 
00038 static LibraryHandleListItem *LibraryHandleList=NULL;  
00039 static long nLibraryHandleListItems=0; 
00040 static THD MainTHD;
00041 
00042 
00043 BOOL AllocateThreadStorage(THD *s){
00044  long i,size,sl,sd,su;
00045  UCHAR *p;
00046  memset(s,0,sizeof(THD));
00047  size=XMAX*((5+2*NGLASS)*sizeof(long)
00048            +(3+1*NGLASS)*sizeof(double)
00049            +(12)*sizeof(UCHAR)
00050            );
00051  sl=sizeof(long)*XMAX;
00052  sd=sizeof(double)*XMAX;
00053  su=sizeof(UCHAR)*XMAX;
00054  if((s->ram=(UCHAR *)X__Malloc(size)) == NULL)return FALSE;
00055  p=s->ram;
00056  s->Zbuffer=(long *)p; p+=sl;
00057  s->Zobject=(long *)p; p+=sl;
00058  s->Xbuffer=(long *)p; p+=sl;
00059  s->Xobject=(long *)p; p+=sl;
00060  for(i=0;i<NGLASS;i++){
00061    s->Zglass[i] =(long *)p; p+=sl;
00062    s->ZglassO[i]=(long *)p; p+=sl;
00063  }
00064  s->Zdepth =(double *)p; p+=sd;
00065  s->Zposn  =(double *)p; p+=sd;
00066  s->Zground=(double *)p; p+=sd;
00067  for(i=0;i<NGLASS;i++){
00068    s->Zglassd[i]=(double *)p; p+=sd;
00069  }
00070  s->Red     =(UCHAR *)p; p+=su;
00071  s->Green   =(UCHAR *)p; p+=su;
00072  s->Blue    =(UCHAR *)p; p+=su;
00073  s->Alfa    =(UCHAR *)p; p+=su;
00074  s->L_Red   =(UCHAR *)p; p+=su;
00075  s->L_Green =(UCHAR *)p; p+=su;
00076  s->L_Blue  =(UCHAR *)p; p+=su;
00077  s->L_Alfa  =(UCHAR *)p; p+=su;
00078  s->LL_Red  =(UCHAR *)p; p+=su;
00079  s->LL_Green=(UCHAR *)p; p+=su;
00080  s->LL_Blue =(UCHAR *)p; p+=su;
00081  s->LL_Alfa =(UCHAR *)p; p+=su;
00082  return TRUE;
00083 }
00084 
00085 void FreeThreadStorage(THD *s){
00086  if(s->ram != NULL)X__Free(s->ram);
00087  memset(s,0,sizeof(THD));
00088  return;
00089 }
00090 
00091 
00105 short AllocateRamBuffers(void){
00106   long i;
00107   THD *s;
00108 #if __DEMO__
00109   if(XMAX > 800){
00110     Render_Message(17,0,NULL);
00111     return FAIL;
00112   }
00113 #endif
00114   s=&MainTHD;
00115   if(!AllocateThreadStorage(s))return FAIL;
00116   gZbuffer=s->Zbuffer;  gZobject=s->Zobject;
00117   gZdepth=s->Zdepth;    gZposn=s->Zposn;
00118   gXbuffer=s->Xbuffer;  gXobject=s->Xobject;
00119   gZground=s->Zground;
00120   for(i=0;i<NGLASS;i++){
00121     gZglass[i] =s->Zglass[i];
00122     gZglassO[i]=s->ZglassO[i];
00123     gZglassd[i]=s->Zglassd[i];
00124   }
00125   gRed    =s->Red;     gGreen   =s->Green;
00126   gBlue   =s->Blue;    gAlfa    =s->Alfa;
00127   gL_Red  =s->L_Red;   gL_Green =s->L_Green;
00128   gL_Blue =s->L_Blue;  gL_Alfa  =s->L_Alfa;
00129   gLL_Red =s->LL_Red;  gLL_Green=s->LL_Green;
00130   gLL_Blue=s->LL_Blue; gLL_Alfa =s->LL_Alfa;
00131   ZskyBuffer=NULL;
00132   DL=NULL; DR=NULL; D1=NULL;  DummyShadow=NULL;
00133   RendererUshortBuffer=NULL; RendererShortBuffer=NULL;
00134   RendererUlongBuffer=NULL; RendererLongBuffer=NULL;
00135   if((ZskyBuffer=(short *)X__Malloc(XMAX*sizeof(short))) == NULL)return FAIL;
00136   if((DL=(double *)X__Malloc(XMAX*sizeof(double))) == NULL)return FAIL;
00137   if((DR=(double *)X__Malloc(XMAX*sizeof(double))) == NULL)return FAIL;
00138   if((D1=(double *)X__Malloc(XMAX*sizeof(double))) == NULL)return FAIL;
00139   if((DummyShadow=(UCHAR *)X__Malloc(XMAX*sizeof(UCHAR))) == NULL)return FAIL;
00140   if((RendererUshortBuffer=(unsigned short *)
00141      X__Malloc(XMAX*sizeof(unsigned short))) == NULL)return FAIL;
00142   if((RendererShortBuffer=(short *)
00143      X__Malloc(XMAX*sizeof(short))) == NULL)return FAIL;
00144   if((RendererUlongBuffer=(unsigned long *)
00145      X__Malloc(XMAX*sizeof(unsigned long))) == NULL)return FAIL;
00146   if((RendererLongBuffer=(long *)
00147      X__Malloc(XMAX*sizeof(long))) == NULL)return FAIL;
00148   if((FullScreenBuffer=(fullscreenbuffer *)
00149     X__Malloc(ResolutionX*ResolutionY*(long)sizeof(fullscreenbuffer))) == NULL)return FAIL;
00150   if(mblurON > 0){
00151     MotionBlurBuffer=(fullscreenbuffer *)
00152       X__Malloc(ResolutionX*ResolutionY*(long)sizeof(fullscreenbuffer));
00153     if(MotionBlurBuffer != NULL)memset(MotionBlurBuffer,
00154        0,ResolutionX*ResolutionY*(long)sizeof(fullscreenbuffer));
00155   }
00156   if(objectIDbufferON)ObjectIdBuffer=(unsigned char *)
00157     X__Malloc(ResolutionX*ResolutionY*(long)sizeof(unsigned char));
00158   fszBuffer=(float *)
00159     X__Malloc(ResolutionX*ResolutionY*(long)sizeof(float));
00160   return OK;
00161 }
00162 
00163 void FreeRamBuffers(void){
00164   long i;
00165   FreeThreadStorage(&MainTHD);
00166   gZbuffer=NULL; gZobject=NULL; gZdepth=NULL; gZposn=NULL;
00167   gXbuffer=NULL; gXobject=NULL; gZground=NULL;
00168   for(i=0;i<NGLASS;i++){
00169     gZglass[i]=NULL; gZglassO[i]=NULL;  gZglassd[i]=NULL;
00170   }
00171   gRed=NULL; gGreen=NULL; gBlue=NULL; gAlfa=NULL;
00172   gL_Red=NULL; gL_Green=NULL; gL_Blue=NULL; gL_Alfa=NULL;
00173   gLL_Red=NULL; gLL_Green=NULL; gLL_Blue=NULL; gLL_Alfa=NULL;
00174   if(FullScreenBuffer != NULL)X__Free(FullScreenBuffer); FullScreenBuffer=NULL;
00175   if(MotionBlurBuffer != NULL)X__Free(MotionBlurBuffer); MotionBlurBuffer=NULL;
00176   if(ObjectIdBuffer != NULL)X__Free(ObjectIdBuffer); ObjectIdBuffer=NULL;
00177   if(fszBuffer != NULL)X__Free(fszBuffer); fszBuffer=NULL;
00178   if(ZskyBuffer != NULL)X__Free(ZskyBuffer); ZskyBuffer=NULL;
00179   if(DL != NULL)X__Free(DL); DL=NULL;
00180   if(DR != NULL)X__Free(DR); DR=NULL;
00181   if(D1 != NULL)X__Free(D1); D1=NULL;
00182   if(DummyShadow != NULL)X__Free(DummyShadow); DummyShadow=NULL;
00183   if(RendererUshortBuffer != NULL)X__Free(RendererUshortBuffer);
00184      RendererUshortBuffer=NULL;
00185   if(RendererShortBuffer != NULL)X__Free(RendererShortBuffer);
00186      RendererShortBuffer=NULL;
00187   if(RendererUlongBuffer != NULL)X__Free(RendererUlongBuffer);
00188      RendererUlongBuffer=NULL;
00189   if(RendererLongBuffer != NULL)X__Free(RendererLongBuffer);
00190      RendererLongBuffer=NULL;
00191 }
00192 
00193 void InitialiseLibraryHandleList(void){
00194  if(LibraryHandleList != NULL)FreeLibraryHandleList();
00195  return;
00196 }
00197 
00198 void FreeLibraryHandleList(void){ 
00199  int i;
00200  LibraryHandleListItem *lp;
00201  //if(debug != NULL)fprintf(debug,"freeing library handles\n");
00202  if((lp=LibraryHandleList) != NULL){
00203    for(i=0;i<nLibraryHandleListItems;i++,lp++){
00204      //if(debug != NULL)fprintf(debug,"Unloading Library[%s]\n",lp->lib_name);
00205      if(lp->hLib != NULL)FreeLibrary(lp->hLib);
00206    }
00207    X__Free(LibraryHandleList);
00208  }
00209  nLibraryHandleListItems=0;
00210  LibraryHandleList=NULL;
00211  //if(debug != NULL)fprintf(debug,"All libraries unloaded\n");
00212  return;
00213 }
00214 
00215 HMODULE AddLoadedLibrary(char *lib_name){ 
00216  int i;
00217  HMODULE hLib;
00218  LibraryHandleListItem *lp;
00219  //if(debug != NULL)fprintf(debug,"Load External Module[%s]\n",lib_name);
00220  if(strlen(lib_name) > 1023)return NULL;
00221  if(nLibraryHandleListItems > 0){ // try to get handle to already loaded module
00222    if((lp=LibraryHandleList) != NULL){
00223      for(i=0;i<nLibraryHandleListItems;i++,lp++){
00224        if(strcmp(lib_name,lp->lib_name) == 0){
00225          //if(debug != NULL)fprintf(debug,"External Module[%s] already loaded\n",lib_name);
00226          return lp->hLib; // found
00227        }
00228      }
00229    }
00230  }
00231  if((hLib=LoadLibrary(lib_name)) == NULL){
00232     //if(debug != NULL)fprintf(debug,"Failed to load DLL\n");
00233     return NULL;
00234  }
00235  if(LibraryHandleList == NULL){
00236   LibraryHandleList=(LibraryHandleListItem *)X__Malloc(sizeof(LibraryHandleListItem));
00237  }
00238  else{
00239   LibraryHandleList=(LibraryHandleListItem *)X__Realloc(LibraryHandleList,
00240           sizeof(LibraryHandleListItem)*(nLibraryHandleListItems+1));
00241  }
00242  if(LibraryHandleList == NULL){
00243    FreeLibrary(hLib);
00244    return NULL;
00245  }
00246  LibraryHandleList[nLibraryHandleListItems].hLib=hLib;
00247  strcpy(LibraryHandleList[nLibraryHandleListItems].lib_name,lib_name);
00248  //if(debug != NULL)fprintf(debug,"Loaded Library added to list[%s]\n",lib_name);
00249  nLibraryHandleListItems++;
00250 
00251 //MessageBox(NULL,lib_name,"New Item",MB_OK);
00252  return hLib;
00253 }
00254 
00255 typedef struct {
00256  char *old,*new;
00257 } discarded_file;
00258 
00259 static long n_render_discarded;
00260 
00261 static discarded_file *discarded_render_file_list;
00262 
00263 #ifdef _SUNSTYLE
00264 void setup_render_discarded_list(){
00265 #else
00266 void setup_render_discarded_list(void){
00267 #endif
00268  n_render_discarded=0; discarded_render_file_list=NULL;
00269 }
00270 
00271 #ifdef _SUNSTYLE
00272 void free_render_discarded_list(){
00273 #else
00274 void free_render_discarded_list(void){
00275 #endif
00276  long i;
00277  if(n_render_discarded > 0 && discarded_render_file_list != NULL){
00278    for(i=0;i<n_render_discarded;i++){
00279      if(discarded_render_file_list[i].old != NULL)
00280         X__Free(discarded_render_file_list[i].old);
00281      if(discarded_render_file_list[i].new != NULL)
00282         X__Free(discarded_render_file_list[i].new);
00283    }
00284  }
00285  n_render_discarded=0; discarded_render_file_list=NULL;
00286 }
00287 
00288 static char *GetRenderReplacementFilename(char *name){
00289  //
00290  // If one of the model or map files has not be found we need to
00291  // prompt for a replacement. However we don't want to have to do
00292  // this every time a new frame is renderer, so when a replacement
00293  // file is selected it is stored in a list. When a new file is needed
00294  // but can't be found we first check to see if it is in the list before
00295  // bothering the user.
00296  //
00297  long i;
00298  char rep_name[258];
00299  discarded_file *temp;
00300  if(n_render_discarded > 0 && discarded_render_file_list != NULL){
00301    for(i=0;i<n_render_discarded;i++){
00302      if(strcmp(discarded_render_file_list[i].old,name) == 0){
00303         if(discarded_render_file_list[i].new == NULL){
00304           Render_Message(85,0,NULL);  /* dropping image */
00305           return NULL;
00306         }
00307         sprintf(rep_name,"%s",discarded_render_file_list[i].old);
00308         Render_Message(86,0,rep_name);  /* replacing */
00309         sprintf(rep_name,"%s",discarded_render_file_list[i].new);
00310         Render_Message(87,0,rep_name);  /* with      */
00311         return discarded_render_file_list[i].new;
00312      }
00313    }
00314  }
00315  if(n_render_discarded == 0)
00316    temp=(discarded_file *)X__Malloc(sizeof(discarded_file));
00317  else
00318    temp=(discarded_file *)X__Realloc(discarded_render_file_list,
00319         sizeof(discarded_file)*(n_render_discarded+1));
00320  if(temp == NULL)return NULL; /* just do nothing - soft landing */
00321  discarded_render_file_list=temp;
00322  if((discarded_render_file_list[n_render_discarded].old=(char *)X__Malloc(256))
00323    == NULL)return NULL;
00324  strcpy(discarded_render_file_list[n_render_discarded].old,name);
00325  /* new = NULL => no replacement just dump */
00326  discarded_render_file_list[n_render_discarded].new=NULL;
00327  Render_Message(88,0,NULL);
00328  if(GetRenderNTnewfile(name,rep_name) == 1){
00329    if(strlen(rep_name) > 4){
00330      if((discarded_render_file_list[n_render_discarded].new=
00331          (char *)X__Malloc(256)) == NULL)return NULL;
00332      strcpy(discarded_render_file_list[n_render_discarded].new,rep_name);
00333    }
00334  }
00335  n_render_discarded++;
00336  return discarded_render_file_list[n_render_discarded-1].new;
00337 }
00338 
00339 FILE *GetRenderRelativeFile(char *fn, char *objectfilename, char *newname){
00340  FILE *Bit_File=NULL;
00341  HANDLE hFile=INVALID_HANDLE_VALUE;
00342  char newfile[512];
00343  if((Bit_File=fopen((char *)fn,"rb")) != NULL){
00344    if(newname != NULL)strcpy(newname,fn);
00345    return Bit_File;
00346  }
00347  hFile=GetRenderRelativeHandle(fn,objectfilename,newfile);
00348  if(hFile == INVALID_HANDLE_VALUE)return NULL;
00349  CloseHandle(hFile);
00350 //MessageBox(NULL,newfile,"Got Good File now open it",MB_OK);
00351  if((Bit_File=fopen((char *)newfile,"rb")) != NULL){
00352    if(newname != NULL)strcpy(newname,newfile);
00353    return Bit_File;
00354  }
00355  return NULL;
00356 }
00357 
00358 HANDLE GetRenderRelativeHandle(char *fn, char *objectfilename, char *newname){
00359  HANDLE Bit_File=INVALID_HANDLE_VALUE;
00360  char *fs,*fp,temp_name[256],*evv;
00361  char path[512],replace[512];
00362  long i,l;
00363  char pref[32],preff[32];
00364  if(newname != NULL)strcpy(newname,fn);
00365  Bit_File=CreateFile(fn,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,
00366       FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00367  if(Bit_File != INVALID_HANDLE_VALUE)return Bit_File;
00368  /* try get the expected filename, try to see if it is elsewhere */
00369  // Try same drive as renderer
00370 //MessageBox(NULL,fn,"Trying to find",MB_OK);
00371  strcpy(temp_name,fn); temp_name[0]=gszHomeDir[0];
00372  Bit_File=CreateFile(temp_name,GENERIC_READ,
00373           FILE_SHARE_READ,NULL,OPEN_EXISTING,
00374           FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00375  if(Bit_File != INVALID_HANDLE_VALUE){
00376    if(newname != NULL)strcpy(newname,temp_name);
00377    return Bit_File;
00378  }
00379  //Try MAP and/or MODEL path
00380  fs=short_form(fn);
00381  for(i=0;i<2;i++){ 
00382    if(i == 0)strcpy(preff,"MAP-PATH");
00383    else      strcpy(preff,"MODEL-PATH");
00384    for(l=1;l<=4;l++){ /*  try the "ini" settings for models and maps*/
00385      sprintf(pref,"%s%ld",preff,l);
00386      GetPrivateProfileString("RPREFERENCES",pref,"$$$",
00387                               temp_name,255,IniFilename);
00388      if(strncmp(temp_name,"$$$",3) == 0)break;
00389      if(temp_name[1] != ':')continue;
00390      if(temp_name[strlen(temp_name)-1] != '\\')strcat(temp_name,"\\");
00391      strcat(temp_name,fs);
00392      Bit_File=CreateFile(temp_name,GENERIC_READ,
00393           FILE_SHARE_READ,NULL,OPEN_EXISTING,
00394           FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00395      if(Bit_File != INVALID_HANDLE_VALUE){
00396        if(newname != NULL)strcpy(newname,temp_name);
00397        return Bit_File; // OK
00398      }
00399    }
00400  }
00401  // for maps now try to see if in same folder as object 
00402  fs=short_form(fn);
00403  if(objectfilename != NULL){ 
00404    strcpy(temp_name,objectfilename);
00405    fp=short_form(temp_name);
00406    strcpy(fp,fs); fs=temp_name;
00407 //{char ttt[512]; sprintf(ttt,"Original name [%s] Model name [%s] trying [%s]",fn,objectfilename,fs);
00408 //MessageBox(NULL,ttt,"Trying same directory as model",MB_OK);}
00409    Bit_File=CreateFile(fs,GENERIC_READ,
00410             FILE_SHARE_READ,NULL,OPEN_EXISTING,
00411             FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00412    if(Bit_File != INVALID_HANDLE_VALUE){
00413      if(newname != NULL)strcpy(newname,fs);  // OK
00414      return Bit_File;
00415    }
00416  } 
00417  // try putting whole path in OpenFX folder
00418  strcpy(temp_name,fn);
00419  if(temp_name[2] == '\\'){
00420    strcpy(temp_name,gszHomeDir); strcat(temp_name,(fn+3));
00421    fs=temp_name;
00422    Bit_File=CreateFile(fs,GENERIC_READ,
00423             FILE_SHARE_READ,NULL,OPEN_EXISTING,
00424             FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00425    if(Bit_File != INVALID_HANDLE_VALUE){
00426      if(newname != NULL)strcpy(newname,fs);  // OK
00427      return Bit_File;
00428    }
00429  }
00430  // before finally giving up try substituting a part of the path.
00431  GetPrivateProfileString("RPREFERENCES","MODEL-ROOT","$$$",
00432                          path,512,IniFilename);
00433  if(strncmp(path,"$$$",3) != 0){
00434    if(path[strlen(path)-1] != '\\')strcat(path,"\\");
00435    strlwr(path);
00436    for(l=1;l<=4;l++){ 
00437      sprintf(pref,"MODEL-ROOT%ld",l);
00438      GetPrivateProfileString("RPREFERENCES",pref,"$$$",
00439                              replace,255,IniFilename);
00440      if(strncmp(replace,"$$$",3) == 0)break;   // no info in INI file
00441      if(replace[1] != ':')continue;            // try next one (invalid entry)
00442      if(replace[strlen(replace)-1] != '\\')strcat(replace,"\\");
00443      strlwr(replace);
00444      if((fs=strstr(fn,replace)) != NULL){   // found string
00445        fs += strlen(replace);
00446        strcpy(temp_name,path);
00447        strcat(temp_name,fs);
00448 //{char ttt[512]; sprintf(ttt,"Original [%s] Trying Path [%s]",fn,temp_name);
00449 //MessageBox(NULL,temp_name,"Inserting replacement path",MB_OK);}
00450        Bit_File=CreateFile(temp_name,GENERIC_READ,
00451                     FILE_SHARE_READ,NULL,OPEN_EXISTING,
00452                       FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00453        if(Bit_File != INVALID_HANDLE_VALUE){
00454          if(newname != NULL)strcpy(newname,temp_name);  // OK
00455          return Bit_File;
00456        }
00457      }
00458    }   
00459  }
00460  // finally ask for the replacement
00461  Render_Message(90,0,fs);
00462  if((fs=GetRenderReplacementFilename(fn)) != NULL){
00463    Bit_File=CreateFile(fs,GENERIC_READ,
00464          FILE_SHARE_READ,NULL,OPEN_EXISTING,
00465          FILE_ATTRIBUTE_READONLY,(HANDLE)NULL);
00466    if(Bit_File != INVALID_HANDLE_VALUE){
00467      if(newname != NULL)strcpy(newname,fs);  // OK
00468      return Bit_File;
00469    }
00470  }
00471  return NULL;
00472 }
00473 
00474 void Render_Message(short number,short query, char *str){
00475   char txt[256];
00476   if(number == 11){
00477     MessageBox(GetFocus(),(LPCTSTR)"Out of memory, no Phong smoothing",(LPCTSTR) "Phong", MB_OK | MB_SYSTEMMODAL );
00478   }
00479   if(renderer_silent)return;
00480   switch(number){
00481     case 0:
00482      LoadString(hThisInstance,IDX_MESSAGE_0,txt,sizeof(txt));
00483      X_message(txt);
00484      break;
00485     case 1:
00486      LoadString(hThisInstance,IDX_MESSAGE_1,txt,sizeof(txt));
00487      X_message(txt);
00488      break;
00489     case 2:
00490      LoadString(hThisInstance,IDX_MESSAGE_2,txt,sizeof(txt));
00491      X_message(txt);
00492      break;
00493     case 3:
00494      LoadString(hThisInstance,IDX_MESSAGE_3,txt,sizeof(txt));
00495      X_message(txt);
00496      break;
00497     case 4:
00498      LoadString(hThisInstance,IDX_MESSAGE_4,txt,sizeof(txt));
00499      X_message(txt);
00500      break;
00501     case 5:
00502      LoadString(hThisInstance,IDX_MESSAGE_5,txt,sizeof(txt));
00503      X_message(txt);
00504      break;
00505     case 6:
00506      LoadString(hThisInstance,IDX_MESSAGE_6,txt,sizeof(txt));
00507      X_message(txt);
00508      break;
00509     case 7:
00510      LoadString(hThisInstance,IDX_MESSAGE_7,txt,sizeof(txt));
00511      X_message(txt);
00512      break;
00513     case 8:
00514      LoadString(hThisInstance,IDX_MESSAGE_8,txt,sizeof(txt));
00515      X_message(txt);
00516      break;
00517     case 9:
00518      LoadString(hThisInstance,IDX_MESSAGE_9,txt,sizeof(txt));
00519      X_message(txt);
00520      break;
00521     case 10:
00522      LoadString(hThisInstance,IDX_MESSAGE_10,txt,sizeof(txt));
00523      X_message(txt);
00524      break;
00525     case 11:
00526      LoadString(hThisInstance,IDX_MESSAGE_11,txt,sizeof(txt));
00527      X_message(txt);
00528      break;
00529     case 12:
00530      LoadString(hThisInstance,IDX_MESSAGE_12,txt,sizeof(txt));
00531      X_message(txt);
00532      break;
00533     case 13:
00534      LoadString(hThisInstance,IDX_MESSAGE_13,txt,sizeof(txt));
00535      X_message(txt);
00536      break;
00537     case 14:
00538      LoadString(hThisInstance,IDX_MESSAGE_14,txt,sizeof(txt));
00539      X_message(txt);
00540      break;
00541     case 15:
00542      LoadString(hThisInstance,IDX_MESSAGE_15,txt,sizeof(txt));
00543      X_message(txt);
00544      break;
00545     case 16:
00546      LoadString(hThisInstance,IDX_MESSAGE_16,txt,sizeof(txt));
00547      X_message(txt);
00548      break;
00549     case 17:
00550      LoadString(hThisInstance,IDX_MESSAGE_17,txt,sizeof(txt));
00551      X_message(txt);
00552      break;
00553     case 18:
00554      LoadString(hThisInstance,IDX_MESSAGE_18,txt,sizeof(txt));
00555      X_message(txt);
00556      break;
00557     case 19:
00558      LoadString(hThisInstance,IDX_MESSAGE_19,txt,sizeof(txt));
00559      MessageBox(GetFocus(),txt,NULL,MB_OK);
00560      break;
00561     case 20:
00562      LoadString(hThisInstance,IDX_MESSAGE_20,txt,sizeof(txt));
00563      X_message(txt);
00564      break;
00565     case 21:
00566      LoadString(hThisInstance,IDX_MESSAGE_21,txt,sizeof(txt));
00567      X_message(txt);
00568      break;
00569     case 22:
00570      LoadString(hThisInstance,IDX_MESSAGE_22,txt,sizeof(txt));
00571      X_message(txt);
00572      break;
00573     case 23:
00574      LoadString(hThisInstance,IDX_MESSAGE_23,txt,sizeof(txt));
00575      X_message(txt);
00576      break;
00577     case 24:
00578      LoadString(hThisInstance,IDX_MESSAGE_24,txt,sizeof(txt));
00579      X_message(txt);
00580      break;
00581     case 25:
00582      LoadString(hThisInstance,IDX_MESSAGE_25,txt,sizeof(txt));
00583      X_message(txt);
00584      break;
00585     case 26:
00586      LoadString(hThisInstance,IDX_MESSAGE_26,txt,sizeof(txt));
00587      X_message(txt);
00588      break;
00589     case 27:
00590      LoadString(hThisInstance,IDX_MESSAGE_27,txt,sizeof(txt));
00591      X_message(txt);
00592      break;
00593     case 28:
00594      LoadString(hThisInstance,IDX_MESSAGE_28,txt,sizeof(txt));
00595      X_message(txt);
00596      break;
00597     case 29:
00598      LoadString(hThisInstance,IDX_MESSAGE_29,txt,sizeof(txt));
00599      X_message(txt);
00600      break;
00601     case 30:
00602      LoadString(hThisInstance,IDX_MESSAGE_30,txt,sizeof(txt));
00603      X_message(txt,str);
00604      break;
00605     case 31:
00606      LoadString(hThisInstance,IDX_MESSAGE_31,txt,sizeof(txt));
00607      X_message(txt);
00608      break;
00609     case 32:
00610      LoadString(hThisInstance,IDX_MESSAGE_32,txt,sizeof(txt));
00611      X_message(txt);
00612      break;
00613     case 33:
00614      LoadString(hThisInstance,IDX_MESSAGE_33,txt,sizeof(txt));
00615      X_message(txt);
00616      break;
00617     case 34:
00618      LoadString(hThisInstance,IDX_MESSAGE_34,txt,sizeof(txt));
00619      X_message(txt,str);
00620      break;
00621     case 35:
00622      LoadString(hThisInstance,IDX_MESSAGE_35,txt,sizeof(txt));
00623      X_message(txt,str);
00624      break;
00625     case 36:
00626      LoadString(hThisInstance,IDX_MESSAGE_36,txt,sizeof(txt));
00627      X_message(txt);
00628      break;
00629     case 37:
00630      LoadString(hThisInstance,IDX_MESSAGE_37,txt,sizeof(txt));
00631      X_message(txt);
00632      break;
00633     case 38:
00634      LoadString(hThisInstance,IDX_MESSAGE_38,txt,sizeof(txt));
00635      X_message(txt);
00636      break;
00637     case 39:
00638      LoadString(hThisInstance,IDX_MESSAGE_39,txt,sizeof(txt));
00639      X_message(txt);
00640      break;
00641     case 40:
00642      LoadString(hThisInstance,IDX_MESSAGE_40,txt,sizeof(txt));
00643      X_message(txt);
00644      break;
00645     case 41:
00646      LoadString(hThisInstance,IDX_MESSAGE_41,txt,sizeof(txt));
00647      X_message(txt);
00648      break;
00649     case 42:
00650      LoadString(hThisInstance,IDX_MESSAGE_42,txt,sizeof(txt));
00651      X_message(txt,str);
00652      break;
00653     case 43:
00654      LoadString(hThisInstance,IDX_MESSAGE_43,txt,sizeof(txt));
00655      X_message(txt);
00656      break;
00657     case 44:
00658      LoadString(hThisInstance,IDX_MESSAGE_44,txt,sizeof(txt));
00659      X_message(txt);
00660      break;
00661     case 45:
00662      LoadString(hThisInstance,IDX_MESSAGE_45,txt,sizeof(txt));
00663      X_message(txt);
00664      break;
00665     case 46:
00666      LoadString(hThisInstance,IDX_MESSAGE_46,txt,sizeof(txt));
00667      X_message(txt,str);
00668      break;
00669     case 47:
00670      LoadString(hThisInstance,IDX_MESSAGE_47,txt,sizeof(txt));
00671      X_message(txt,str);
00672      break;
00673     case 48:
00674      LoadString(hThisInstance,IDX_MESSAGE_48,txt,sizeof(txt));
00675      X_message(txt);
00676      break;
00677     case 49:
00678      LoadString(hThisInstance,IDX_MESSAGE_49,txt,sizeof(txt));
00679      X_message(txt);
00680      break;
00681     case 50:
00682      LoadString(hThisInstance,IDX_MESSAGE_50,txt,sizeof(txt));
00683      X_message(txt);
00684      break;
00685     case 51:
00686      LoadString(hThisInstance,IDX_MESSAGE_51,txt,sizeof(txt));
00687      X_message(txt);
00688      break;
00689     case 52:
00690      LoadString(hThisInstance,IDX_MESSAGE_52,txt,sizeof(txt));
00691      X_message(txt);
00692      break;
00693     case 53:
00694      LoadString(hThisInstance,IDX_MESSAGE_53,txt,sizeof(txt));
00695      X_message(txt);
00696      break;
00697     case 54:
00698      LoadString(hThisInstance,IDX_MESSAGE_54,txt,sizeof(txt));
00699      X_message(txt);
00700      break;
00701     case 55:
00702      break;
00703     case 56:
00704      LoadString(hThisInstance,IDX_MESSAGE_56,txt,sizeof(txt));
00705      X_message(txt);
00706      break;
00707     case 57:
00708      LoadString(hThisInstance,IDX_MESSAGE_57,txt,sizeof(txt));
00709      X_message(txt);
00710      break;
00711     case 58:
00712      LoadString(hThisInstance,IDX_MESSAGE_58,txt,sizeof(txt));
00713      X_message(txt);
00714      break;
00715     case 59:
00716      LoadString(hThisInstance,IDX_MESSAGE_59,txt,sizeof(txt));
00717      X_message(txt);
00718      break;
00719     case 60:
00720      LoadString(hThisInstance,IDX_MESSAGE_60,txt,sizeof(txt));
00721      X_message(txt);
00722      break;
00723     case 61:
00724      LoadString(hThisInstance,IDX_MESSAGE_61,txt,sizeof(txt));
00725      X_message(txt,str);
00726      break;
00727     case 62:
00728      LoadString(hThisInstance,IDX_MESSAGE_62,txt,sizeof(txt));
00729      X_message(txt,str);
00730      break;
00731     case 63:
00732      LoadString(hThisInstance,IDX_MESSAGE_63,txt,sizeof(txt));
00733      X_message(txt);
00734      break;
00735     case 64:
00736      LoadString(hThisInstance,IDX_MESSAGE_64,txt,sizeof(txt));
00737      X_message(txt);
00738      break;
00739     case 65:
00740      LoadString(hThisInstance,IDX_MESSAGE_65,txt,sizeof(txt));
00741      X_message(txt);
00742      break;
00743     case 66:
00744      LoadString(hThisInstance,IDX_MESSAGE_66,txt,sizeof(txt));
00745      X_message(txt,str);
00746      break;
00747     case 67:
00748      LoadString(hThisInstance,IDX_MESSAGE_67,txt,sizeof(txt));
00749      X_message(txt);
00750      break;
00751     case 68:
00752      LoadString(hThisInstance,IDX_MESSAGE_68,txt,sizeof(txt));
00753      X_message(txt);
00754      break;
00755     case 69:
00756      LoadString(hThisInstance,IDX_MESSAGE_69,txt,sizeof(txt));
00757      X_message(txt,str);
00758      break;
00759     case 70:
00760      LoadString(hThisInstance,IDX_MESSAGE_70,txt,sizeof(txt));
00761      X_message(txt);
00762      break;
00763     case 71:
00764      LoadString(hThisInstance,IDX_MESSAGE_71,txt,sizeof(txt));
00765      X_message(txt);
00766      break;
00767     case 72:
00768      LoadString(hThisInstance,IDX_MESSAGE_72,txt,sizeof(txt));
00769      X_message(txt);
00770      break;
00771     case 73:
00772      LoadString(hThisInstance,IDX_MESSAGE_73,txt,sizeof(txt));
00773      X_message(txt,str);
00774      break;
00775     case 74:
00776      LoadString(hThisInstance,IDX_MESSAGE_74,txt,sizeof(txt));
00777      X_message(txt);
00778      break;
00779     case 75:
00780      LoadString(hThisInstance,IDX_MESSAGE_75,txt,sizeof(txt));
00781      X_message(txt);
00782      break;
00783     case 76:
00784      LoadString(hThisInstance,IDX_MESSAGE_76,txt,sizeof(txt));
00785      X_message(txt);
00786      break;
00787     case 77:
00788      LoadString(hThisInstance,IDX_MESSAGE_77,txt,sizeof(txt));
00789      X_message(txt);
00790      break;
00791     case 78:
00792      LoadString(hThisInstance,IDX_MESSAGE_78,txt,sizeof(txt));
00793      X_message(txt,str);
00794      break;
00795     case 79:
00796      LoadString(hThisInstance,IDX_MESSAGE_79,txt,sizeof(txt));
00797      X_message(txt);
00798      break;
00799     case 80:
00800      LoadString(hThisInstance,IDX_MESSAGE_80,txt,sizeof(txt));
00801      X_message(txt);
00802      break;
00803     case 81:
00804      LoadString(hThisInstance,IDX_MESSAGE_81,txt,sizeof(txt));
00805      X_message(txt);
00806      break;
00807     case 82: /* just a new line */
00808      break;
00809     case 83:
00810      LoadString(hThisInstance,IDX_MESSAGE_83,txt,sizeof(txt));
00811      X_message(txt,str);
00812      break;
00813     case 84:
00814      LoadString(hThisInstance,IDX_MESSAGE_84,txt,sizeof(txt));
00815      X_message(txt,str);
00816      break;
00817     case 85:
00818      LoadString(hThisInstance,IDX_MESSAGE_85,txt,sizeof(txt));
00819      X_message(txt);
00820      break;
00821     case 86:
00822      LoadString(hThisInstance,IDX_MESSAGE_86,txt,sizeof(txt));
00823      X_message(txt,str);
00824      break;
00825     case 87:
00826      LoadString(hThisInstance,IDX_MESSAGE_87,txt,sizeof(txt));
00827      X_message(txt,str);
00828      break;
00829     case 88:
00830      LoadString(hThisInstance,IDX_MESSAGE_88,txt,sizeof(txt));
00831      X_message(txt);
00832      break;
00833     case 89:
00834      LoadString(hThisInstance,IDX_MESSAGE_89,txt,sizeof(txt));
00835      X_message(txt,str);
00836      break;
00837     case 90:
00838      LoadString(hThisInstance,IDX_MESSAGE_90,txt,sizeof(txt));
00839      X_message(txt,str);
00840      break;
00841     case 91:
00842      LoadString(hThisInstance,IDX_MESSAGE_91,txt,sizeof(txt));
00843      X_message(txt,str);
00844      break;
00845     case 92:
00846      LoadString(hThisInstance,IDX_MESSAGE_92,txt,sizeof(txt));
00847      X_message(txt);
00848      break;
00849     case 93:
00850      LoadString(hThisInstance,IDX_MESSAGE_93,txt,sizeof(txt));
00851      X_message(txt,str);
00852      break;
00853     case 94:
00854      LoadString(hThisInstance,IDX_MESSAGE_94,txt,sizeof(txt));
00855      X_message(txt);
00856      break;
00857     case 95:
00858      LoadString(hThisInstance,IDX_MESSAGE_95,txt,sizeof(txt));
00859      X_message(txt);
00860      break;
00861     case 96:
00862      LoadString(hThisInstance,IDX_MESSAGE_96,txt,sizeof(txt));
00863      X_message(txt);
00864      break;
00865     case 97:
00866      LoadString(hThisInstance,IDX_MESSAGE_97,txt,sizeof(txt));
00867      X_message(txt);
00868      break;
00869     case 98:
00870      LoadString(hThisInstance,IDX_MESSAGE_98,txt,sizeof(txt));
00871      X_message(txt,str);
00872      break;
00873     case 99:
00874      LoadString(hThisInstance,IDX_MESSAGE_99,txt,sizeof(txt));
00875      X_message(txt);
00876      break;
00877     case 100:
00878      LoadString(hThisInstance,IDX_MESSAGE_100,txt,sizeof(txt));
00879      X_message(txt,str);
00880      break;
00881     default: break;
00882   }
00883 }
00884 
00885 int  X__local_print(const char *format,...){
00886  char line[512];
00887  va_list arg_ptr;
00888  if(renderer_silent)return 1;
00889  va_start(arg_ptr,format);
00890  vsprintf(line,format,arg_ptr);
00891  va_end(arg_ptr);
00892  WindowedRenderString(line);
00893  return 1;
00894 }
00895 

Generated on Sun Apr 27 14:20:13 2014 for OpenFX by  doxygen 1.5.6