Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Tool to inject data into class files  (Read 5383 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2007-12-10 02:05:10 »

Here is the tool i created for injecting byte data directly into the class file for my 2007 entry.

It reduces the overhead that embedding data as a Hexadecimal String in the source creates.

The tool creates a new Attribute in which the data is embedded. This Attribute is then injected at an valid point into the class file.

Feel free to use it or modify it just let me know if it is useful or if you make beneficial changes Smiley

http://www.cuteandcuddlypet.com.au/moogie/DataInjector.zip

http://unlimited.woogley.net/hosted/moogie/DataInjector.zip

p.s. the source is not very well commented, read at your own peril Tongue
Offline tom
« Reply #1 - Posted 2007-12-10 08:34:30 »

Thanks!!!

This is great. Reduced the jar by over 50 bytes.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2007-12-10 09:28:12 »

glad it helped Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #3 - Posted 2007-12-10 21:49:38 »

If the data you are injecting has some logically different components, e.g. different images, etc, then you might find by re-arranging the order of these data components may yield a few extra bytes.

Offline Morre

JGO Knight


Medals: 2
Projects: 10


I'm Dragonene on IRC.


« Reply #4 - Posted 2007-12-18 23:50:06 »

Tried, but to no avail. It never finds the || with the loop you provided in the readme. If changed to the actual two first characters it worked, dunno what's wrong.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #5 - Posted 2007-12-19 02:42:07 »

Ah, i just realised that the magic symbols (i.e. ||) are actually part of the image data payload of the sprites i had embedded in my game last year!

So yes, currently you have to append || to the start of your data that you are embedding. Or you could change it to what ever you want... just make sure you change the code looking for the magic symbols.
Offline Morre

JGO Knight


Medals: 2
Projects: 10


I'm Dragonene on IRC.


« Reply #6 - Posted 2007-12-19 10:33:08 »

Problem is adding || makes java say the program's been altered :/

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #7 - Posted 2007-12-19 10:40:39 »

when you say add || where are you adding it to?

are you adding it as part of the data you are embedding or injecting it before embedding your data into the class file?

if you do the later then you will need to increase the size of the attribute payload by two to incorporate the two extra bytes. By adding it as part of the data you are going to embed, there is no need to increase the size of the attribute payload.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (26 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (34 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!