gemot encubed  

Go Back   gemot encubed > Gemot > Technical Issues

Technical Issues For bug reports, problem solving, and help running Japanese software.

Reply
 
Thread Tools Display Modes
  #1  
Old 2011-03-13, 09:01
Polarem Polarem is offline
Member
 
Join Date: Jan 2011
Posts: 11
Default rlBabel-GenMap with RealLive 1.5.0.4 and 1.6.2.3

Hi, does anyone have experience with rlBabel-GenMap? I'd like to make a .map file for RealLive 1.6.2.3 (for Clannad ME), but don't know where to start.

The patched version at http://www.assembla.com/code/clannad...lBabel-GenMap/ is claimed to support RealLive 1.5.0.4, but when I tried it, my resulting (non-functional) 1.5.0.4.map is different from their copy at http://www.assembla.com/code/clannad...nodes/current/, so I'm guessing that they uploaded an incomplete/broken patch.

The result was the same whether I compiled the code using VC++ 2008 in Win7 (English locale), or VC++2005 in WinXP (Japanese locale)

Please help!
Reply With Quote
  #2  
Old 2011-04-20, 01:21
Richard 23's Avatar
Richard 23 Richard 23 is offline
Regular
 
Join Date: Jun 2006
Location: Washington, USA
Posts: 67
Default whither map

experience with rlBabel-Genmap? hoho, I expect most people would wisely spend a few seconds with it at most, relieved that it worked, assuming it did, and then thankfully forget the experience ever happened.

no offense to haeleth and other ha4xx0rz who have taken a hammer to the code over the years, but it's a necessarily hacky and nasty bit of work that employs a host of techniques that are mostly discouraged in final release code. this is simply because for about a decade RealLive was a moving target with an exaggerated gait.

for rlBabel to do it's stuff, it needs to have access to information about the canvas on which it dynamically lays out text and graphics, otherwise would be like trying to perform calligraphy in a darkened closet wearing a bag over one's head on a couple of hits of acid using only a pickle.

unfortunately what's actually available to a plugin dll via an official accessible structure isn't all that helpful for rendering text:

Quote:
Originally Posted by RealLive DLL Structures
Code:
// グラフィックバンク構造体 (Graphics Bank Structure)
#define		REALLIVE_BANK_MAX		16
typedef struct REALLIVE_BANK_STRUCTtag{
	void **pp;	// アドレスポインターへのポインター(32ビット)
                        // [32 bit address pointer]
	int  *xl;	// Xサイズ [X Size]
	int  *yl;	// Yサイズ [Y Size]
}REALLIVE_BANK_STRUCT;

// RealLive構造体 [RealLive Structure]
typedef struct REALLIVE_DLL_STRUCTtag{
	int size;			// 構造体のサイズ [size of structure]

	HWND hwin;		// ウィンドウのハンドル [window handle]

	int *A;			// Aフラグ [ A flags ]
	int *B;			// Bフラグ [ A flags ]
	int *C;			// Cフラグ [ A flags ]
	int *D;			// Dフラグ [ A flags ]
	int *E;			// Eフラグ [ A flags ]
	int *F;			// Fフラグ [ A flags ]
 
	int *G;			// Gフラグ(グローバル) [ A flags ] (Global)
	int *Z;			// Zフラグ(グローバル) [ A flags ] (Global)

	char **S;			// S文字列                  [ S strings ]
	char **M;			// M文字列(グローバル) [ M strings ] (Global)

	REALLIVE_BANK_STRUCT bank[REALLIVE_BANK_MAX];		// グラフィックバンク
                                                                                        // [ Graphics Bank ]

	char *exe_basedir;	// RealLiveの起動場所 [ RealLive setup directories ]
	char *sav_folder;	// セーブフォルダ [ Saved Game directory ]
	char *bgm_folder;	// BGMフォルダ [ BGM directory ]
	char *koe_folder;	// KOEフォルダ  [ KOE (voice) directory ]
	char *mov_folder;	// MOVフォルダ [ MOV directory ]
	char *dat_basedir;	// その他のデータフォルダがある場所 [ data directory; lotso junku ]

	int **ppH;			// Hフラグ         [ H flags ]
	int *cntH;			// Hフラグ確保数 [ H secure flags ] 

	int **ppI;			// Iフラグ         [ I flags ]
	int *cntI;			// Iフラグ確保数 [ I secure flags ]
	
	int **ppJ;			// Jフラグ         [ J flags ]
	int *cntJ;			// Jフラグ確保数 [ J secure flags ]

}REALLIVE_DLL_STRUCT;
So MapGen throws a bunch of commands at any given RealLive interpreter and searches through it's memory partition to deduce which memory locations are being used for global storage of several vital compositing properties. Local variables are less desirable because when they go out of scope something more effective at crashing the application might take their place.

Looking into the code itself is not for the feignt of heart or those who take it on faith that programming, like public health scolds and press releases are based in solid science and knowledge. The truth may set you free, but it tends to shatter the perception of professionalism in our betters. Ha!

I'm only blathering on about rlBabel-MapGen because I've been updating and reworking the code for compatibility with three versions of RealLive for #fluffy's Little Busters! effort. Kyousuke always harps on us about how we "should treat everything as a mission." And so we do, just to shut him up! ;-)

But back to whatever specific question you had. I forgot.

Quote:
Originally Posted by Polarem
Hi, does anyone have experience with rlBabel-GenMap? I'd like to make a .map file for RealLive 1.6.2.3 (for Clannad ME), but don't know where to start.
Oh, right. That thing.

Quote:
Originally Posted by Polarem
The patched version at http://www.assembla.com/code/clannad...lBabel-GenMap/ is claimed to support RealLive 1.5.0.4, but when I tried it, my resulting (non-functional) 1.5.0.4.map is different from their copy at http://www.assembla.com/code/clannad...nodes/current/, so I'm guessing that they uploaded an incomplete/broken patch.
Oh right. That wouldn't surprise me at all, really. MapGen doesn't simply identify a single address for each property that rlBabel requires in order to work (without constantly crashing), it generates a list of several for each. MapGen then puts its hands over its eyes and entrusts fate with the final selection. When I initially used it years ago to generate a map file, I was a bit bemused to find that more than one variable would point to the same address. So, there's room for a little human error in the process; the machine isn't yet a able to replace human beings completely in the visual novel equation. ;-)

So map generation is a little fuzzy at times. Here's a sample output to put anyone still reading this to a deep and comfortable sleep:

(hidden for your sanity)
Spoiler


And a slightly hand tuned version still in work as I go about testing to make sure the less obvious variables have actually been identified....

Quote:
Originally Posted by rlBabel-MapGen + R23
Code:
RlBabel Map File for RealLive 1.5.2.4 (124 bytes)

map_version              0x00000002         2
CurrentScenario         0x00640ed8   6557400
ScenarioPtr              0x00def568  14611816
InstructionPtr           0x00def580  14611840
FontName                0x00a8bdb8  11058616
FontQuality             0x009f834c  10453836
CurrentWindow           0x01483f80  21512064
GlobalNameVars          0x006c6b50   7105360
LocalNameVars           0x0148acdc  21540060
WindowContentsSize      0x00000e16      3606
CurrentName             0x0137508c  20402316
WindowSize              0x00000077       119
NameMod                 0x006dc0b4   7192756
WindowStateSize         0x000000b6       182
StateMojiSize           0x015f5774  23025524
StateMojiRepX           0x015f5778  23025528
StateMojiRepY           0x015f577c  23025532
StateIndent             0x015f5798  23025560
StateOriginX            0x015f5790  23025552
StateOriginY            0x015f5794  23025556
StateWindPosX           0x015f5720  23025440
StateWindPosY           0x015f5724  23025444
Caption                 0x006daba4   7187364
SetDlgItemTextA_ptr     0x003822e0   3678944
GetDlgItemTextA_ptr     0x003822f8   3678968
SetWindowTextA_ptr      0x003820d0   3678416
CreateDialogParamA_ptr  0x00382070   3678320
DialogBoxParamA_ptr     0x00382028   3678248
GetGlyphOutlineA_ptr    0x0062a04c   6463564
EnumFontFamiliesA_ptr   0x0062a034   6463540
CreateFontA_ptr         0x0062a048   6463560
Quote:
Originally Posted by Polarem
The result was the same whether I compiled the code using VC++ 2008 in Win7 (English locale), or VC++2005 in WinXP (Japanese locale)
[/quote]

Well, there's your problem right there! Just kidding.

R23
Reply With Quote
  #3  
Old 2011-04-21, 21:05
Polarem Polarem is offline
Member
 
Join Date: Jan 2011
Posts: 11
Default

Thanks for your detailed, informative and entertaining post!

So, if I've understood correctly: The 5 addresses listed under "Font Name" are the POSSIBILITIES that RlBabel-genMap identified... and then it picks one at random to put in the map? How on earth did has it manage to work over the years? ^^; Or did the introduction of new variables in newer RealLives break compatibility with genMap's algorithms?

Your map reader displays info in a much tidier way than genMap's output file; glad to see good programming and formatting practices! (yes, my programming world crumbled when I waded through the source code of rlBabel, rlBabel-genMap, and rlDev)

Regardless of how painful it can be, I'm still keen to get the system up and running, so I'm very interested in your work. Would you be willing to release it when you've finished? I'd be happy to make further tweaks to get it to work with RealLive 1.5.0.4 and 1.6.2.3, if it doesn't already.
Reply With Quote
  #4  
Old 2011-05-04, 08:22
Richard 23's Avatar
Richard 23 Richard 23 is offline
Regular
 
Join Date: Jun 2006
Location: Washington, USA
Posts: 67
Default rlBabeling

Quote:
Originally Posted by Polarem View Post
Thanks for your detailed, informative and entertaining post!
It was an accident. Honest!

Sadly, while I followed it up with another post bursting with technical info, it was lost. Boo.

Quote:
Originally Posted by Polarem View Post
So, if I've understood correctly: The 5 addresses listed under "Font Name" are the POSSIBILITIES that RlBabel-genMap identified... and then it picks one at random to put in the map? How on earth did has it manage to work over the years? ^^; Or did the introduction of new variables in newer RealLives break compatibility with genMap's algorithms?
Well, the map generator source doesn't have much in the way of documentation and the there are nearly as many search algorithms employed as there are variables sought. The location of the variables moves with every version released, obviously. rlBabel's prime directive -- formatting English text by inserting line breaks at standard text delimiters, doesn't really require that all the variables be identified correctly. For most games only a subset of possible features are even in play.

It would be necessary to include all the possible features in a test file or break into the a running instance of the application with a debugger to check that all the addresses are actually correct.

Quote:
Originally Posted by Polarem View Post
Your map reader displays info in a much tidier way than genMap's output file; glad to see good programming and formatting practices! (yes, my programming world crumbled when I waded through the source code of rlBabel, rlBabel-genMap, and rlDev)
Word! I wrote a quickie perl script to display and edit map files without resorting to fumbling around in a hex editor.

Quote:
Originally Posted by Polarem View Post
Regardless of how painful it can be, I'm still keen to get the system up and running, so I'm very interested in your work. Would you be willing to release it when you've finished? I'd be happy to make further tweaks to get it to work with RealLive 1.5.0.4 and 1.6.2.3, if it doesn't already.
Sherwood! PM me and we'll establish an underhanded data exchange channel. ;-)

Open question to Anyone: Does the PE executable format include an option for relocating the imports table to an unnamed pe container at the end of the binary file that would be handled by the default exe loader? I suspect that VisualArt's is using a custom loader, but I haven't investigated the load process with a debugger.

RealLive versions 1.5.2.4 and 1.5.9.1 both contain relocated import tables not dumped by standard PE tools and not handled by ApiHijack -- a standard method of patching functions imported from Windows DLLs (shared libraries).

Relocating the imports table after the resources also complicates RealLive localization -- translating the resources (Menus and Dialogs) shifts the relocated imports table, breaking the string table pointers, so localizing the application requires patching the imports table as well. Punks!

NOTE: attached is rlmap.pl, a map viewer/editor. I appended the .txt extension to skateboard around the file filter. Muhahaha!

R23
Attached Files
File Type: txt rlmap.pl.txt (5.6 KB, 136 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed to extend rlBabel's proportional text support Polarem Production & Help 0 2011-02-03 01:41
Working GenMap/rlDev with Reallive 1.5+ Komari Technical Issues 0 2009-08-21 10:13
a question about rldev and rlbabel Unregistered Technical Issues 1 2007-09-03 23:19
rlBabel Problem :( Help plz Ayane Technical Issues 9 2007-07-19 03:14
More fun with RealLive Haeleth General Discussion 37 2006-03-10 07:31


All times are GMT -8. The time now is 14:51.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.