Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 55 posts ]  Go to page 1, 2  Next
    Xilef
  Thu Jan 02, 2014 12:32 am
User avatar
Staff

Big Dumb Guy

Location: UK
I was a bit fed up that the only custom Game.exe projects out there were written in simplified Chinese and they are 100% written in 1 main file.

I basically rewrote it in English and hid the windows specific functions (and types) behind some classes, so the bulk of the RGSS stuff is in main.cpp and there is an RGSS3 binding written in RGSS3.h and .cpp as a class.

xiGameSrc.zip

this is by no means tidy code, but hopefully things are easier to navigate compared to the other custom game.exe projects.

This is a visual c++ 2013 project for RGSS3 projects.


Top Top
Profile      
 

    Amy
  Thu Jan 02, 2014 1:45 am
User avatar
Staff

Big Dumb Guy
Wow. I have way too many things to play around with but this just made top of the list. There's exciting stuff being done these days :o

Potentially daft question, but would this is aid cross-platforming?


Top Top
Profile      
 

    Xilef
  Thu Jan 02, 2014 2:19 am
User avatar
Staff

Big Dumb Guy

Location: UK
Yes it would if someone were to rewrite the DLLs, I can very easily write this to be a cross platform executable but it still relies on the original windows DLLs


Top Top
Profile      
 

    Glitchfinder
  Thu Jan 02, 2014 5:07 am
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Xilef wrote:
Yes it would if someone were to rewrite the DLLs, I can very easily write this to be a cross platform executable but it still relies on the original windows DLLs


Meh, this is why theory and I embedded Ruby directly into an executable we were working on.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 12:15 am
User avatar
Staff

Big Dumb Guy

Location: UK
I think it's worth re-writing the RGSS libraries so .so and .dylib creation is possible.

I'm at the stage of trying to get Ruby hooks in my own executable right now :U


Top Top
Profile      
 

    Drago del Fato
  Fri Jan 03, 2014 11:21 am
Dark Slayer
User avatar
Member

L1 Slime

Location: Somewhere with a heater on...
Also I think there should be some Licensing issues with this. Are you allowed to distribute RGSS DLL with this custom Game.exe like that? One workaround I see is distributing the game without it but making the user download RTP (of which you can probably only use the RGSS DLL).

_________________
RAGE - A 2D Game Engine with Ruby scripting!. 0.0.3 - beta out!
Check it out here! https://github.com/ArekX/RAGE#releases


Visit my little scripts corner here. :)


Top Top
Profile      
 

    Nuri Yuri
  Fri Jan 03, 2014 11:55 am
Nyu~
User avatar
Member

Party Mascot

Location: France
@Drago del Fato : When we distribute our game, we are allowed, RPG Maker put the RGSS DLL in the installer.
@Xilef : Your program can only launch games in debug mode for the moment x)
But it's a good way to do it: using classes :3
Now for the Ruby hooks you'll have a lot of matters, good luck to find how to properly call the ruby functions...

_________________


Top Top
Profile      
 

    Drago del Fato
  Fri Jan 03, 2014 2:42 pm
Dark Slayer
User avatar
Member

L1 Slime

Location: Somewhere with a heater on...
@Nuri Yuri
Just because they distribute it themselves doesn't mean they allow everyone to distribute them in any way they please. RGSS DLL, in this instance, is being used in a way it was not intended for (i.e. by a custom Game.exe) so they might have a problem with this, I'm not a lawyer though.

@Xilef
What kind of Ruby hooks do you actually mean?

_________________
RAGE - A 2D Game Engine with Ruby scripting!. 0.0.3 - beta out!
Check it out here! https://github.com/ArekX/RAGE#releases


Visit my little scripts corner here. :)


Top Top
Profile      
 

    Amy
  Fri Jan 03, 2014 3:39 pm
User avatar
Staff

Big Dumb Guy
Using this exe or not, the actual game still must be made in RPG Maker, so it shouldn't be a problem. Don't quote me on that though. You're still distributing a game made with RPG Maker, you've just neglected to include their exe to run it and added your own.


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 4:32 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Drago del Fato, there are no licensing issues as this is a clean-room program, it has no RGSS code and does not supply any RGSS code, you can use any compatible DLL with this program and it'll be fine.

And yes, the Eval() method in the RGSS3 class will set the $TEST flag to true, change that to false to stop the debug mode.


Top Top
Profile      
 

    Amy
  Fri Jan 03, 2014 4:34 pm
User avatar
Staff

Big Dumb Guy
(You can also just not code anything that uses $TEST, as none of debug mode is hard coded, it can all be taken out.)


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 4:59 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Seems the way most people hook with RGSS3 is abuse the Eval function and call some Win32API stuff to initialise their bindings, which is not ideal at all.

I remember discussing the idea of having custom DLL code running on a thread with a messaging system between RGSS and the thread so as to run the Win32API with little over-head, sounds a bit painful but if we can't find the addresses of the other ruby functions:
viewtopic.php?f=48&t=75669

Some help with the guess-work would be cool...!


Top Top
Profile      
 

    Nuri Yuri
  Fri Jan 03, 2014 7:04 pm
Nyu~
User avatar
Member

Party Mascot

Location: France
Expand to see the code.

I've shearched some functions, rb_define_sigleton_method, rb_define_method , rb_define_global_function , rb_define_class should work with the __cdecl calling convention...

_________________


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 7:16 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Nuri Yuri wrote:
I've shearched some functions, rb_define_sigleton_method, rb_define_method , rb_define_global_function , rb_define_class should work with the __cdecl calling convention...

I can see that what you've posted is for RGSS1xx, we're dealing with RGSS301 which as you know is pretty well locked down (I have seen some assembly style function calling used around it [__fastcall maybe?], so that might be something I'll try next).

All I can find in RGSS301 that are C declared are the functions below:
Content Hidden


I tried a brute-force approach with testing every pointer on the DLL from 0x0 to 0x10FFFFFF for the rb_define_module and running an in-game script that detects for the module to exist but none of those pointers worked, so I'm out of ideas time to do some analysis of __fastcall.


Top Top
Profile      
 

    Nuri Yuri
  Fri Jan 03, 2014 7:28 pm
Nyu~
User avatar
Member

Party Mascot

Location: France
You're using RGSS301.dll XD
My pointers are for RGSS300.dll, can you send me RGSS301.dll ?

You'll never find anything by using Ruby, eval should probably not call rb_define_anything but rb_module_new that won't help you to create a module because it's like Module.new x)

Edit : Just forget about _fastcall, it isn't fastcall it's some new optimisation feature that send arguments in random register before calling the function when the function isn't exported.

_________________


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 7:39 pm
User avatar
Staff

Big Dumb Guy

Location: UK
RGSS301.dll comes with VXAce, I was unable to locate 300, care to send me 300?

Here's 301
www.battleworldrpg.net/hbgames/RGSS301.dll

Of course, I'd rather get this working on 301 because that's the version that every gets these days when they use VXAce


Top Top
Profile      
 

    Nuri Yuri
  Fri Jan 03, 2014 7:46 pm
Nyu~
User avatar
Member

Party Mascot

Location: France
I got RMVX.Ace the day it was released so I've the RGSS300.dll x)
https://www.mediafire.com/?gbw8yb2gk80o7cl

I'll watch how it's done in RGSS301.dll ^^

_________________


Top Top
Profile      
 

    Xilef
  Fri Jan 03, 2014 8:13 pm
User avatar
Staff

Big Dumb Guy

Location: UK
From looking at those address I can see that my brute force programming detected ruby functions around those RGSS10X pointers you posted earlier, but I had no way of testing their functions, how did you figure them out for RMXP?

Edit: meant to write 300 not 10x, still getting confused with all these DLLs hanging around


Top Top
Profile      
 

    Drago del Fato
  Fri Jan 03, 2014 9:19 pm
Dark Slayer
User avatar
Member

L1 Slime

Location: Somewhere with a heater on...
Well those are standard ruby API functions which are always incorporated when you embed Ruby and they haven't changed much even today (I'm working currently with Ruby 2.1.0 on my engine and I didn't have to change a thing) so there is high chance that you can use them even here, but if they aren't in export table of the DLL there isn't much you can do about it, also take note that those are C functions, not C++.

_________________
RAGE - A 2D Game Engine with Ruby scripting!. 0.0.3 - beta out!
Check it out here! https://github.com/ArekX/RAGE#releases


Visit my little scripts corner here. :)


Top Top
Profile      
 

    Nuri Yuri
  Fri Jan 03, 2014 9:26 pm
Nyu~
User avatar
Member

Party Mascot

Location: France
The RGSS and Ruby functions are programmed in C/C++ so to make ruby functions work, the rb_define_method/class/module/etc... function should be called somewhere in the RGSS DLL.

For the functions like ruby_xfree, ruby_xmalloc or the functions like rb_gv_get that are called nowhere, I just watch something that looks like the assembly version of them.
To test them :
Expand to see the code.

Expand to see the code.

I started to search function's pointers in RGSS301 :
Expand to see the code.

@Drago del Fato : Using ruby API will make your Game crash, I tried Win32API.new("socket.so","Init_Socket","","").call() looong time ago and the result was "RGSS Player a cessé de fonctionner.". But it's right : the arguments of the functions didn't change.

_________________


Top Top
Profile      
 

    Drago del Fato
  Fri Jan 03, 2014 10:00 pm
Dark Slayer
User avatar
Member

L1 Slime

Location: Somewhere with a heater on...
@Nuri Yuri
When I was saying Ruby API I didn't mean using it from RGSS (btw it's not possible to load a mingw/gcc compiled .so library with MSVC compiled Ruby. Took me a while to learn that one. :/). I meant using it directly from Game.exe (i.e. the same thing you just wrote).

---

It might be useful to know that there is a workaround to loading ruby extensions with embedded ruby, it's just that they have to be loaded statically (which also means a lot of fiddling with ruby code). I currently can load both DL (had to change the code a little) and Zlib extensions statically (but not Socket extension though, but I've coded my own network interaction, I'm not giving up though xD). Just be sure to use extern "C" { } to specify the call to Init_extname() while in C++.

_________________
RAGE - A 2D Game Engine with Ruby scripting!. 0.0.3 - beta out!
Check it out here! https://github.com/ArekX/RAGE#releases


Visit my little scripts corner here. :)


Top Top
Profile      
 

    Xilef
  Sat Jan 04, 2014 9:38 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Nuri Yuri wrote:
The RGSS and Ruby functions are programmed in C/C++ so to make ruby functions work, the rb_define_method/class/module/etc... function should be called somewhere in the RGSS DLL.

For the functions like ruby_xfree, ruby_xmalloc or the functions like rb_gv_get that are called nowhere, I just watch something that looks like the assembly version of them.
To test them :
Expand to see the code.

Expand to see the code.

I started to search function's pointers in RGSS301 :
Expand to see the code.

@Drago del Fato : Using ruby API will make your Game crash, I tried Win32API.new("socket.so","Init_Socket","","").call() looong time ago and the result was "RGSS Player a cessé de fonctionner.". But it's right : the arguments of the functions didn't change.

That address for define module didn't work for me the first time round, I'll try them all out tonight and see about writting a wrapper to easily get native classes into RGSS.


Top Top
Profile      
 

    Nuri Yuri
  Sun Jan 05, 2014 11:52 am
Nyu~
User avatar
Member

Party Mascot

Location: France
rb_define_module don't work ?
It's weird x)

_________________


Top Top
Profile      
 

    Xilef
  Sun Jan 05, 2014 2:22 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Where would I call the define class and define methods in the exe? Just before GameMain or after initialise3 or anywhere else? I'm getting a crash with define_class at the moment

EDIT: Got it all working now, guess it's time to write a wrapper for this stuff

When I have time I'll search for the rb_define_class_variable rb_data_object_alloc pointers

EDIT2: As an update on where I'm going with this, I'm attempting to get an OpenGL render loop on top of the game screen, I have some ideas for this and some tests have proven successful (I can insert OpenGL draw calls, albeit they flicker like crazy because it's mixed with GDI).

What I'm going to try is drawing OpenGL to a framebuffer and copying the memory to an RGSS3 picture, which can be drawn by the game when it wants, I need some help with accessing the picture class though, so if anyone wants to help me here then please do


Top Top
Profile      
 

    Glitchfinder
  Sun Jan 05, 2014 6:03 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Xilef wrote:
Where would I call the define class and define methods in the exe? Just before GameMain or after initialise3 or anywhere else? I'm getting a crash with define_class at the moment

EDIT: Got it all working now, guess it's time to write a wrapper for this stuff

When I have time I'll search for the rb_define_class_variable rb_data_object_alloc pointers

EDIT2: As an update on where I'm going with this, I'm attempting to get an OpenGL render loop on top of the game screen, I have some ideas for this and some tests have proven successful (I can insert OpenGL draw calls, albeit they flicker like crazy because it's mixed with GDI).

What I'm going to try is drawing OpenGL to a framebuffer and copying the memory to an RGSS3 picture, which can be drawn by the game when it wants, I need some help with accessing the picture class though, so if anyone wants to help me here then please do


The picture class, or the bitmap class? If it's the bitmap class, there are some copies of a .dll source in my post history that take the address for a bitmap that Ruby provides, and loads them into moddable memory.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Xilef
  Sun Jan 05, 2014 6:11 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Glitchfinder wrote:
The picture class, or the bitmap class? If it's the bitmap class, there are some copies of a .dll source in my post history that take the address for a bitmap that Ruby provides, and loads them into moddable memory.

I don't see an exposed bitmap class for RGSS3, I was going to go and mess about with the picture class until I find a handle to something vaguely bitmap-esque.

Anything that gives access to a raw image that can be displayed within a standard RGSS3 game is what I'm looking for

Is Sprite_Picture useful at all for this?


Top Top
Profile      
 

    Glitchfinder
  Sun Jan 05, 2014 6:22 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Xilef wrote:
Glitchfinder wrote:
The picture class, or the bitmap class? If it's the bitmap class, there are some copies of a .dll source in my post history that take the address for a bitmap that Ruby provides, and loads them into moddable memory.

I don't see an exposed bitmap class for RGSS3, I was going to go and mess about with the picture class until I find a handle to something vaguely bitmap-esque.

Anything that gives access to a raw image that can be displayed within a standard RGSS3 game is what I'm looking for

Is Sprite_Picture useful at all for this?


I got the data via having a Bitmap instance in RGSS, and passing it to the dll via bitmapInstance.__ID__, I think. It's been a while since I've done it, so I'm not sure what the specific call was. You can find one of the posts with a .dll source here, if you want to take a look. And, I just checked to be sure. RGSS, RGSS2, and RGSS3 all use the Bitmap class, as stated.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Xilef
  Sun Jan 05, 2014 6:34 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Okay thanks, I found the source so I'm all set, cheers.

EDIT: The .__id__ left shift thing doesn't seem to work (At least with RGSS301), so I'm scratching my head at this point

Perhaps there is a different calling convention between Win32API and an internal call


Top Top
Profile      
 

    Nuri Yuri
  Sun Jan 05, 2014 9:29 pm
Nyu~
User avatar
Member

Party Mascot

Location: France
You can send a bitmap to a C function or create the bitmap in the function before returning it ^^'
Expand to see the code.

_________________


Top Top
Profile      
 

    Xilef
  Sun Jan 05, 2014 9:59 pm
User avatar
Staff

Big Dumb Guy

Location: UK
I'm currently trying to send the bitmap to a C function


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 55 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group