File Encryption Problem

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
I'm having an odd issue with the file encryption options recently. My issue is that my game's encrypted archive doesn't seem to work properly, that being the game cannot find key parts of my game when it opens up. I used a decrypter to see if the file was in my archive, and there it was. Any ideas on how to solve this?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
It depends on what parts are not showing up.  What error messages do you get?  Are scripts involved?  We need more information.
 

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
The file in question is a file named "TrainerClasses.rvdata2." It's an array containing data for a data class I created, basically as a utility to keep front loading time down. The error message is a generic cannot find file error inside my Crystal Engine - Trainers script. If you need a bit more, the script list is basically the same as the one found in my Pokémon for Ace starter kit.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
Any chance the script call uses File.<something> to open it or search for it?  The File module does not work very well with compressed projects.  I don't think it has anything to do with the encryption.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
2,994
First Language
Tagalog
Primarily Uses
RMVXA
You might want to use load_data (if I remember correctly) for it to be able to load from inside the encrypted archive.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,711
Reaction score
7,365
First Language
German
Primarily Uses
RMMV
The engine has two functions to load data, and only one of them works with encryption - the other cannot open the encrypted file.


I don't know which one is which, but this is the reason why the SES external text script restructures the unencrypted text files for use in game - search for that script and check how it is handled there.
 

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
I looked at the error and this the message I got:

Code:
Trainers:642:in `save_data': No such file or directory - Data/TrainerClasses.rvdata2 (Errno::ENOENT)
	from Trainers:642:in `create_trainer_classes'
	from Trainers:622:in `load_database'
	from Pokémon Battle System:812:in `load_database'
	from Enemy Capture:225:in `load_database'
	from Enemy Equipment:54:in `load_database'
	from Experience Gain Formula:48:in `load_database'
	from Abilities:823:in `load_database'
	from Base Stat Formula:155:in `load_database'
	from Experience Tables:107:in `load_database'
	from Friendship:92:in `load_database'
	from Move Limit:154:in `load_database'
	from Pokedex:179:in `load_database'
	from Weakness Reduction:72:in `load_database'
	from Pokémon Load Screen:87:in `load_database'
	from Ignore Magic Reflect:16:in `load_database'
	from Import Database:29:in `load_database'
	from Data Base Constants:410:in `load_database'
	from DataManager:18:in `init'
	from Video Player:144:in `run'
	from Map Screenshot:971:in `run'
	from Screenshot taker:215:in `run'
	from Main:10:in `block in <main>'
This is the code method that triggered it:

Code:
	def self.create_trainer_classes
		if CRYSTAL::TRAINER::USE_TRAINER_SET && $TEST
			if FileTest.exists?("Data/Trainer Classes.rvdata2")
				data = load_data("Data/Trainer Classes.rvdata2")
				if data[0] == CRYSTAL::TRAINER::TRAINER_CLASSES
					$data_trainers = data[1]
					return
				end
			end
			$data_trainers = [nil]
			CRYSTAL::TRAINER::TRAINER_CLASSES.each { |data|
				$data_trainers.push(RPG::Trainer.new(data))
			}
			set = [CRYSTAL::TRAINER::TRAINER_CLASSES, $data_trainers]
			save_data(set, "Data/Trainer Classes.rvdata2")
		else
			data = load_data("Data/Trainer Classes.rvdata2")
			$data_trainers = data[1]
		end
	end
Does this help? It doesn't seem to be directly tied to "File.open."
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
Look at those scripts again.


One has Data/Trainer<space>Classes.rvdata2 and the other has Data/TrainerClasses.rvdata2 - no space.


You gave us the wrong method - the error is occuring in the save_data method, not in the create_trainer_classes method.  So I'm thinking there's a Data/TrainerClasses.rvdata2 reference in that method, and you need to put a space in the name.


If you can't figure it out with that information, please give us the save_data method from that script, and highlight which one is line 642.
 
Last edited by a moderator:

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
Look at those scripts again.


One has Data/Trainer<space>Classes.rvdata2 and the other has Data/TrainerClasses.rvdata2 - no space.


You gave us the wrong method - the error is occuring in the save_data method, not in the create_trainer_classes method.  So I'm thinking there's a Data/TrainerClasses.rvdata2 reference in that method, and you need to put a space in the name.





 


 That was because I tried seeing if the space was the problem, and when I found out it wasn't I switched everything back. 


It's all good now. I was able to fix it by creating a new data file that contains all the file names in all my directories (even the ones that aren't encrypted), and just use that reference to check for the existence of the files. That seemed the clear everything up, I just need to make sure that I playtest it so that the registry self-compiles itself before I encrypt it.


For Future Reference:


If you're going to encrypt your project, don't use any method linked to File or Filetest to refer to anything in the Graphics or Data folders. They don't work.


With that. I think we're good to lock the topic.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
It helps if you grab the console error messages from the actual error you're trying to solve, not a new one that was created by changes you made when trying to solve it :)   If you'd fixed all the file names correctly, the error message would likely have said something completely different and possibly shown a different line number.
 

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
As I said, it's all good now. It was an issue with the FileTest module not working in the encrypted archive.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

trying to wrap up the boat/ship/castaway tilesets with a great galleon - no promises
Mail from campus: we will have the lessons this semester not remote, if possible. All my my profs: Remote it is.
https://gyazo.com/5a19cfce090a2585b3c0fcb7c699b92c Just finished a stealth system, its not metal gear solid level though, maybe elder scrolls level, it just works.
I ain't dead btw, just trying to keep up with university :)

Forum statistics

Threads
103,100
Messages
997,294
Members
134,568
Latest member
DuncanGallagher
Top