IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

This section is for any editing topics that don't fit into any of the other forums, any questions on how to mod belong in Editing Discussion

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Auto-Replace files in GTA3.img

 Command line software?
 
Mister X  
Posted: Saturday, Aug 11 2012, 18:11
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



Hello!

Anyone know how to do automatic operation on gta3.img without doing any click onto stupid buttons?

The problem on that I want to do that onto Vice City.

Any IMG tool for vice doesn't support this kind of operation.

Spark has a command line version,but work only with SA (very silly thing) so is inusable.

Any advice? happy.gif
PM
  Top
 

 
Mister X  
Posted: Tuesday, Aug 14 2012, 10:18
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



I guess isn't possible,uh?

Well,good enough...

But before I make my "decision" I want to be sure....

Anyone know a similar tool?


There are few for SA,and (I think) it's normal that for VC there aren't anyone,but....



VERY sorry for double post,it's kind of "urgent"....
PM
  Top
 

 
fastman92  
Posted: Tuesday, Aug 14 2012, 11:13
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



I have written IMG class for C++ that works with version 1 (GTA III, GTA SA) and version 2 (GTA SA)
All you have to do is command-line tool, since i provide you a class only.
http://www.mediafire.com/?sh0zzhfq4g7tcee
Users WebsitePMMSN
  Top
 

 
Mister X  
Posted: Tuesday, Aug 14 2012, 13:05
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (fastman92 @ Tuesday, Aug 14 2012, 11:13)
I have written IMG class for C++ that works with version 1 (GTA III, GTA SA) and version 2 (GTA SA)
All you have to do is command-line tool, since i provide you a class only.
http://www.mediafire.com/?sh0zzhfq4g7tcee

Sorry but I'm not so good with C++ to make a complete application confused.gif
The code is very well written,but hard to understand for me (I studied c++ for only 6-7 months).

All I want to do is replace 3 files (I know name of that,and they are disposed in the same folder of exutable) that are inside gta3.img.

Can't compile it only to do this operation?

Or at least tell me a VERY basic script to how open the gta3.img and do that....


I know it's a lot of work,but this would complete my mod,and off course I would be very happy tounge2.gif

This post has been edited by Mister X on Tuesday, Aug 14 2012, 13:09
PM
  Top
 

 
fastman92  
Posted: Tuesday, Aug 14 2012, 13:47
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



Add this to project:
#include "IMG.h"

And add CPP file to Visual Studio source files, it's where you can add files, you list of files of project.

Examples:

Display file names in command line (requires <iostream> )
CODE
IMG archive;
archive.OpenArchive("gta3.img");

auto it = archive.begin();

while(it < archive.end())
{
 cout << it -> Name << endl;

 it++;
}

archive.CloseArchive();


Get file size of specified file by name:
CODE
IMG archive;
archive.OpenArchive("gta3.img");

std::cout << "Size of stand.dff in bytes: " << archive.GetFileRefByName("stand.dff").GetFilesize() << endl;

archive.CloseArchive();


Add or replace file (if exists), requires #include <stdio.h> for fopen, fseek and ftell
CODE
IMG archive;
archive.OpenArchive("gta3.img");

// Load whole file into memory
FILE* fp = fopen("stand.dff", "r");
fseek(fp, 0, SEEK_END);  // set position to end
unsigned int FileSize = ftell(fp);  // get current position, If it's on ending then it's filesize, right?

char* Buffer = new char[FileSize];  // allocate memory depending on FileSize, as much as it needs

fseek(fp, 0, SEEK_SET);     // get back to beginning of file
fread(Buffer, 1, FileSize, fp);
archive.AddOrReplaceFile("stand.dff", Buffer, FileSize);
delete Buffer;       // Don't forget to deallocate memory, it's not neccessary now
fclose(fp);        // Don't forget to close file handle of standup.dff
archive.CloseArchive();     // Don't forget to close archive.
Users WebsitePMMSN
  Top
 

 
Mister X  
Posted: Tuesday, Aug 14 2012, 16:33
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



I'm to f*cking rusty to know perfectly what you're saying blush.gif

I'm using Dev-C++ (Only used that for learning porpoises) and I don't understand some things:

After I've write insert IMG.h to Devc++ resource and correctly included it to MY simple software,and after I included the IMG.cpp files inside my project and I compile it,It return (after a LOT of missing .h files) even LOT of other error (like 126 C:\Dev-Cpp\include\stdafx.h `_QERShadersTable' does not name a type or 189 C:\Users\Alex\Desktop\IMG\IMG.cpp `IMG_version' is not a class or namespace ).

You have to be more "specific" to WHAT part of code I've to past into my software.


SORRY for STUPID question (I know it's frustrating) but this is the last piece of my puzzle-project confused.gif


I've done only simple software in c++ (like an agenda or a photo viewer) and I never used this kind of external files.
PM
  Top
 

 
fastman92  
Posted: Tuesday, Aug 14 2012, 16:46
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



I think IMG class may not be compiled in Dev C++ because of unsupported this kind of expression:
IMG_version::VERSION_2

Try to remove IMG_version:: or download Visual Studio 2012.

PM sent.
Users WebsitePMMSN
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG