Preparing for release!
parent
719dd8e88e
commit
4af7546cf3
|
@ -243,7 +243,7 @@ SOURCE=..\..\FreeImage241\Source\FreeImageLib\Release\FreeImage.lib
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\fmod375\fmodstatic.lib
|
||||
SOURCE=..\..\fmodapi375win\api\lib\fmodvc.lib
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
@ -3,5 +3,3 @@
|
|||
|
||||
#include "../stdutil/stdutil.cpp"
|
||||
|
||||
#include "../stdutil/shareprot.cpp"
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#ifndef STD_H
|
||||
#define STD_H
|
||||
|
||||
#include "../../fmodapi375win/api/inc/fmod.h"
|
||||
|
||||
#include "../config/config.h"
|
||||
#include "../stdutil/stdutil.h"
|
||||
|
||||
|
@ -24,8 +26,6 @@
|
|||
#include <dinput.h>
|
||||
#include <d3d.h>
|
||||
|
||||
#include "../../fmod375/fmod.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#endif
|
|
@ -1,150 +0,0 @@
|
|||
|
||||
#ifdef DEMO
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <windows.h>
|
||||
#include "shareprot.h"
|
||||
#include "stdutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef PRO //Blitz3D?
|
||||
#define PRODUCT 0xce57abd1
|
||||
#else
|
||||
#ifdef PLUS //BlitzPlus?
|
||||
#define PRODUCT 0x7abd57ec
|
||||
#else //Blitz2D!
|
||||
#define PRODUCT 0x4feb9567
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEMO_RUNS 30
|
||||
|
||||
#define REG_MUNG (PRODUCT^0xce57abd7)
|
||||
#define SYS_MUNG (PRODUCT^0x7adb57ec)
|
||||
|
||||
#define REG_PRODUCT (PRODUCT^0x677fcb37)
|
||||
#define SYS_PRODUCT (PRODUCT^0x4feba567)
|
||||
|
||||
static void expired(){
|
||||
MessageBox( 0,
|
||||
|
||||
"This demo verson has expired!\n\n"
|
||||
"Please visit www.blitzbasic.com to buy the full version.",
|
||||
|
||||
"Demo expired",MB_OK );
|
||||
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
static int tohex( int n ){
|
||||
return n<10 ? n+'0' : n+'a'-10;
|
||||
}
|
||||
|
||||
static string getSysFileName(){
|
||||
//get system file...
|
||||
char dir[MAX_PATH];
|
||||
GetSystemDirectory( dir,MAX_PATH );
|
||||
char file[128];
|
||||
char *p=file,t=(char)0xbd;
|
||||
*p++='\\'^t;
|
||||
*p++='m'^t;
|
||||
*p++='s'^t;
|
||||
*p++='v'^t;
|
||||
*p++='c'^t;
|
||||
*p++=tohex((SYS_PRODUCT)&0xf)^t;
|
||||
*p++=tohex((SYS_PRODUCT>>8)&0xf)^t;
|
||||
*p++=tohex((SYS_PRODUCT>>16)&0xf)^t;
|
||||
*p++=tohex((SYS_PRODUCT>>24)&0xf)^t;
|
||||
*p++='.'^t;
|
||||
*p++='s'^t;
|
||||
*p++='y'^t;
|
||||
*p++='s'^t;
|
||||
*p++=0;
|
||||
for( p=file;*p;++p ) *p^=t;
|
||||
return string( dir )+string( file );
|
||||
}
|
||||
|
||||
static string getRegKeyName(){
|
||||
return string( "software\\Brlconfig\\"+itoa(REG_PRODUCT) );
|
||||
}
|
||||
|
||||
static bool setCount( int cnt ){
|
||||
|
||||
HKEY hkey;
|
||||
if( RegCreateKey( HKEY_LOCAL_MACHINE,getRegKeyName().c_str(),&hkey )==ERROR_SUCCESS ){
|
||||
int val=cnt^REG_MUNG;
|
||||
LONG n=RegSetValueEx( hkey,0,0,REG_DWORD,(const BYTE*)&val,4 );
|
||||
RegCloseKey( hkey );
|
||||
if( n!=ERROR_SUCCESS ) return false;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FILE *f=fopen( getSysFileName().c_str(),"wb" ) ){
|
||||
int val=cnt^SYS_MUNG;
|
||||
int n=fwrite( &val,4,1,f );
|
||||
fclose(f);
|
||||
if( n!=1 ) return false;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int getCount(){
|
||||
|
||||
int reg_cnt=DEMO_RUNS+1,sys_cnt=DEMO_RUNS+1;
|
||||
|
||||
HKEY hkey;
|
||||
if( RegOpenKey( HKEY_LOCAL_MACHINE,getRegKeyName().c_str(),&hkey )==ERROR_SUCCESS ){
|
||||
int ty=0,sz=4;
|
||||
RegQueryValueEx( hkey,0,0,(DWORD*)&ty,(BYTE*)®_cnt,(DWORD*)&sz );
|
||||
if( ty!=REG_DWORD ) reg_cnt=0;
|
||||
else{
|
||||
reg_cnt^=REG_MUNG;
|
||||
if( reg_cnt<0 || reg_cnt>DEMO_RUNS ) reg_cnt=0;
|
||||
}
|
||||
RegCloseKey( hkey );
|
||||
}
|
||||
|
||||
if( FILE *f=fopen( getSysFileName().c_str(),"rb" ) ){
|
||||
if( fread( &sys_cnt,4,1,f )!=1 ) sys_cnt=0;
|
||||
else{
|
||||
sys_cnt^=SYS_MUNG;
|
||||
if( sys_cnt<0 || sys_cnt>DEMO_RUNS ) sys_cnt=0;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return sys_cnt==reg_cnt ? sys_cnt : 0;
|
||||
}
|
||||
|
||||
void shareProtStart(){
|
||||
|
||||
if( int cnt=getCount() ) setCount( cnt-1 );
|
||||
}
|
||||
|
||||
int shareProtCheck(){
|
||||
|
||||
return getCount();
|
||||
}
|
||||
|
||||
void shareProtAssert(){
|
||||
|
||||
if( !getCount() ) shareProtJump( expired );
|
||||
}
|
||||
|
||||
_declspec(naked) void _stdcall shareProtJump( void(*target)() ){
|
||||
_asm{
|
||||
mov eax,4[esp]
|
||||
mov [esp],0x12345678 ;return
|
||||
mov 4[esp],0x12345678 ;param
|
||||
mov 8[esp],0x12345678 ;more...
|
||||
call eax
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
#ifndef SHAREPROT_H
|
||||
#define SHAREPROT_H
|
||||
|
||||
//bump counter
|
||||
void shareProtStart();
|
||||
|
||||
//return counter
|
||||
int shareProtCheck();
|
||||
|
||||
//error if counter==0
|
||||
void shareProtAssert();
|
||||
|
||||
//clean stack then jump! Never returns!
|
||||
void _stdcall shareProtJump( void(*target)() );
|
||||
|
||||
#endif
|
|
@ -192,14 +192,6 @@ LIB32=link.exe -lib
|
|||
# Name "stdutil - Win32 Blitz3DDemo"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shareprot.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shareprot.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
|
||||
#include "../config/config.h"
|
||||
|
||||
/*
|
||||
#ifdef DEMO
|
||||
#include "shareprot.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
|
Loading…
Reference in New Issue