Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
r3001
Anmeldungsdatum: 05.11.2004 Beiträge: 137 Wohnort: Wien
|
Verfasst am: 23.07.2006, 00:25 Titel: Externe Dateien in Programm-EXE einbinden - Linker? |
|
|
Hallo!
Derzeit versuche ich mein FreeBASIC-Wissen zu stärken und bastle deshalb an einem kleinen Textadventure herum.
Ich möchte Textdateien für Dialoge und eventuell auch Bildbeschreibungen nutzen, damit das ganze nicht zu unübersichtlich wird. Ich will diese Dateien am Ende in die kompilierte EXE-Datei miteinbinden, so dass man sie nicht mehr im nachhinein bearbeiten kann.
Daher meine Fragen:
- Besitzt FreeBASIC die Möglichkeit, die Dateien in die fertige EXE einzubinden (Linker)?
- Wenn nicht, wie könnte man das Problem anders lösen?
Danke im Voraus!
R
EDIT: Achja, nutze FB 0.16b Stable |
|
Nach oben |
|
 |
Neo187

Anmeldungsdatum: 26.12.2005 Beiträge: 350 Wohnort: Oldenburg
|
Verfasst am: 23.07.2006, 00:56 Titel: |
|
|
moin,
könntest nicht einfach ein Array Dimmen für die Dialoge und sie dann füllen?
Mfg,
Neo187 _________________
 |
|
Nach oben |
|
 |
Michael Frey

Anmeldungsdatum: 18.12.2004 Beiträge: 2577 Wohnort: Schweiz
|
|
Nach oben |
|
 |
r3001
Anmeldungsdatum: 05.11.2004 Beiträge: 137 Wohnort: Wien
|
Verfasst am: 23.07.2006, 10:43 Titel: |
|
|
Erstmal danke für die Antworten!
@Neo187: Nunja, sicherlich wäre das auch möglich, aber ich möchte die Texte doch lieber in seperate Dateien auslagern. So verliere ich nicht so schnell den Überblick, wenn das Projekt größere Ausmaße annehmen soll.
@Michael Frey: Der Link ist interessant, ich werde damit etwas rumspielen. Mal sehen ob ich mein Vorhaben damit umsetzen kann.
R |
|
Nach oben |
|
 |
Sebastian Administrator

Anmeldungsdatum: 10.09.2004 Beiträge: 5969 Wohnort: Deutschland
|
Verfasst am: 31.07.2006, 13:10 Titel: |
|
|
Hallo,
ich würde da mit Ressourcen arbeiten. In VB ganz einfach, in FB muss man ein bisschen tüfteln. Dieser Typ hier wäre geeignet:
http://www.jorgon.freeserve.co.uk/Resource.htm#ste hat Folgendes geschrieben: | The STRINGTABLE resource
The STRINGTABLE resource enables strings to be kept in the EXE to be recovered when needed at run time. For assembler programmers this would be an alternative to keeping the strings in the data segment. Even if you need to use Unicode strings, if you are using GoAsm as your assembler it is usually easier to keep the strings in data rather than to use the STRINGTABLE resource.
If the source file is in ANSI format, strings in the STRINGTABLE resource are automatically converted to Unicode by the Resource Compiler, so there is no need to use the "C" style Unicode indicator L"string". The Resource Compiler regards the L"string" indicator as implicit. The conversion is carried out using the API MultiByteToWideChar. This API uses the current codepage for this conversion, so you need to ensure that at compile time your machine is set to use the same codepage as was used when the source script was made.
If the source file is in Unicode format, then no conversion takes place and codepages are not used: the strings are used as they appear in the resource script.
One reason why the assembler programmer might wish to keep strings in a STRINGTABLE resource rather than in the data segment would be to take advantage of the ability of the system to distinguish strings of different languages at run-time.
The strings are kept in blocks of 16 strings. Each block will have the same language and also the same upper 12-bits of the ID which was specified in the resource script. The least significant 4 bits are blanked out and are not be recorded because it is assumed that the IDs run in sequence in each block from 0 to 0Fh. To make this assumption valid, if the string IDs are not in sequence the Resource Compiler has to insert empty strings. To reduce space requirements, therefore, it is best to keep the identifiers sequential.
To recover one of the strings call LoadString giving the string identifier. It will then be copied into a buffer with a nul terminator.
The syntax for the STRINGTABLE resource is as follows:-
STRINGTABLE
[defining-statements]
BEGIN
stringID "string"
.........
END
Where,
stringID is
a 16 bit number which identifies the string
an expression which resolves to that number
"string" is a quoted string of not more than 4097 characters, or an expression which is defined elsewhere as a string.
If the string straddles more than one line the Resource Compiler inserts a space and a line feed character (ASCII 0Ah) at the line break and all leading spaces on the next line in your resource script are suppressed. |
Viele Grüße!
Sebastian
BTW: Bin wieder da!  _________________
Die gefährlichsten Familienclans | Opas Leistung muss sich wieder lohnen - für 6 bis 10 Generationen! |
|
Nach oben |
|
 |
|