English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 09 May 2018, 01:10   #1
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Where to store program data if running from a CD?

An upcoming project stores it's program data in the folder where the program is executed (if possible).

But if the program is executed from a CDROM, then obviously this is not possible.

Where would the best place be to save this data ? Or should it not save any data if the program has not been installed to a HD ?
alpine9000 is offline  
Old 09 May 2018, 01:26   #2
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,252
If you have a floppy drive you could save the data on a floppy, or if you have a Hard Disk you could save the data directly on HD. Years ago there was also a device that allowed to write or delete data from a CD-Rom but this was only virtual, in fact the data was written on the Hard Disk.
AMIGASYSTEM is offline  
Old 09 May 2018, 01:31   #3
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
I was more talking about what folder on the file system to use.
alpine9000 is offline  
Old 09 May 2018, 08:43   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
You can try ENVARC: (create your dir here if you have several files to write).

Or put a config file there or in ENV: which will tell where the files go.
meynaf is offline  
Old 11 May 2018, 03:06   #5
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
You can try ENVARC: (create your dir here if you have several files to write).

Or put a config file there or in ENV: which will tell where the files go.
ENVARC: works well as a fallback, but doesn't seem to exist in KS1.3?

I got a requester asking for ENVARC: when I tried to write to it.
alpine9000 is offline  
Old 11 May 2018, 08:23   #6
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by alpine9000 View Post
ENVARC: works well as a fallback, but doesn't seem to exist in KS1.3?

I got a requester asking for ENVARC: when I tried to write to it.
1.3 probably does not have this.

But... Do people really mount a CD-ROM on 1.3 ?
meynaf is offline  
Old 11 May 2018, 08:26   #7
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
1.3 probably does not have this.

But... Do people really mount a CD-ROM on 1.3 ?
Who knows what crazy stuff people do in emulation :-)

It’s not a big deal, just like to know which configurations won’t work.
alpine9000 is offline  
Old 11 May 2018, 08:29   #8
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,000
ENVARC: is a bad idea.

Firstly it only works if it has been set up during the boot process.

Secondly it is copied to RAM during boot, so it eats up memory.

Thirdly it only works if you have a Save/Use/Cancel concept similar to that of the preferences. You read the settings from ENV: and write them to either ENV: or both ENV: and ENVARC: depending on whether the user clicked on Use or Save.

IMHO S: is a good place for text-based settings files.

SYS:Prefs/Presets is another good location, but you have to create these directories if they don't exist.

Actually you should ask the user and store the result in an ENV/ENVARC variable. If ENV or ENVARC don't exist, use S: as default.
thomas is offline  
Old 11 May 2018, 08:32   #9
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by thomas View Post
ENVARC: is a bad idea.

Firstly it only works if it has been set up during the boot process.

Secondly it is copied to RAM during boot, so it eats up memory.

Thirdly it only works if you have a Save/Use/Cancel concept similar to that of the preferences. You read the settings from ENV: and write them to either ENV: or both ENV: and ENVARC: depending on whether the user clicked on Use or Save.

IMHO S: is a good place for text-based settings files.

SYS:Prefs/Presets is another good location, but you have to create these directories if they don't exist.

Actually you should ask the user and store the result in an ENV/ENVARC variable. If ENV or ENVARC don't exist, use S: as default.
It’s not text based data, it’s binary.

You make a good point re wasting ram.
alpine9000 is offline  
Old 11 May 2018, 08:48   #10
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by thomas View Post
ENVARC: is a bad idea.
All places are a bad idea, but one has to be found.


Quote:
Originally Posted by thomas View Post
Firstly it only works if it has been set up during the boot process.
If you have a CDROM installed then you probably have booted something that has setup ENVARC:...


Quote:
Originally Posted by thomas View Post
Secondly it is copied to RAM during boot, so it eats up memory.
Fully or just ENVARC:sys ?
Does the copy process also duplicates all subdirs in here ?


Quote:
Originally Posted by thomas View Post
Thirdly it only works if you have a Save/Use/Cancel concept similar to that of the preferences. You read the settings from ENV: and write them to either ENV: or both ENV: and ENVARC: depending on whether the user clicked on Use or Save.
Why wouldn't it work ? ENVARC: is an assign like all others.


Quote:
Originally Posted by thomas View Post
IMHO S: is a good place for text-based settings files.
This, too, is a bad idea. S: is for storing scripts, not settings. It has been abused too many times already.


Quote:
Originally Posted by thomas View Post
SYS:Prefs/Presets is another good location, but you have to create these directories if they don't exist.
Even worse, Presets are for default settings of system prefs, not for user data.


Quote:
Originally Posted by thomas View Post
Actually you should ask the user and store the result in an ENV/ENVARC variable. If ENV or ENVARC don't exist, use S: as default.
Opening a requester to ask the user is indeed the only "clean" solution.


Quote:
Originally Posted by alpine9000 View Post
It’s not text based data, it’s binary.
Saved game ?

Perhaps you could remove the ability to run from CD directly and make a limited install only containing the main exe. This way you always have a dir you can count on.
meynaf is offline  
Old 11 May 2018, 09:10   #11
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
Saved game ?

Perhaps you could remove the ability to run from CD directly and make a limited install only containing the main exe. This way you always have a dir you can count on.
Yes, game progress and hiscore data. It's only 180 bytes, but that would be 180 bytes of ram the user will possibly never get back if I used ENVARC, even after the game is long forgotten.

This problem might be a bit theoretical. The most common case of an Amiga with a CDROM (CD32) is handled using nonvolatile.library and saving to NVRAM. I wonder how many CD equipped Amigas are actually out there being used for newly released games. I am guessing not many.
alpine9000 is offline  
Old 21 June 2018, 00:15   #12
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Nonvolatile: ?
volvo_0ne is offline  
Old 21 June 2018, 00:56   #13
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,334
Quote:
Originally Posted by thomas View Post
IMHO S: is a good place for text-based settings files.
IMHO it is not. S: is for scripts. It's even part of the path.
idrougge is offline  
Old 21 June 2018, 10:47   #14
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,007
How about a SYS:Prefs/YourGame/ directory? It seems some programs/system components use that kind of solution nowadays...

Or SYS:Storage/YourGame/ even though Storage has traditionally been for disabled Devs: stuff, but anyway I've seen that kind of solution already too.

Maybe I'd prefer the Prefs one, because your data is kind of prefs stuff for a game
jPV is offline  
Old 21 June 2018, 16:44   #15
Cobe
Registered User
 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 41
Posts: 1,004
Quote:
Originally Posted by alpine9000 View Post
Yes, game progress and hiscore data. It's only 180 bytes, but that would be 180 bytes of ram the user will possibly never get back if I used ENVARC, even after the game is long forgotten.

This problem might be a bit theoretical. The most common case of an Amiga with a CDROM (CD32) is handled using nonvolatile.library and saving to NVRAM. I wonder how many CD equipped Amigas are actually out there being used for newly released games. I am guessing not many.
If you're gonna save to cd32's nvram already, you could just instruct hd users to install nonvolatile.lib and set the folder wherever they want, or you could make a script for them to set that up. It could be good practice for all the future releases too.
Cobe is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Workbench program from CLI (at startup.) Pheonix support.Other 47 28 January 2022 05:24
Running simple C program Sim085 Coders. General 10 30 January 2018 13:43
Use the Data Disk when running FS-UAE Arcade? Frodelius support.FS-UAE 4 10 July 2017 23:19
How to load data and keep your main loop running? alkis Coders. Asm / Hardware 12 09 September 2013 20:13
External windows program communicating with program running inside WinUAE xxxxx support.WinUAE 10 19 February 2013 09:27

Posting Rules
You may not post new threads
You may not 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


All times are GMT +2. The time now is 03:45.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08763 seconds with 15 queries