flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > INI file shortcuts...

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4037
Location: vpcmpistri
bitRAKE 27 Dec 2007, 22:34
Code:
; sizeof.dest must be defined!
macro GPPS dest,item {
  match x=:y,item \{
    invoke GetPrivateProfileString,INI.\#x,INI.\#y,x\#.\#y,dest,sizeof.\#dest,INI.file
  \}
}
macro WPPS item,dest {
  match x=:y,item \{
    invoke WritePrivateProfileString,INI.\#x,INI.\#y,dest,INI.file
  \}
}    
...these are from a recent project. First layout the INI string you need:
Code:
; section and key names
INI:
  .LOCALIZATION TCHAR 'LOCALIZATION',0
  .TITLE        TCHAR 'TITLE',0
  .PROMPT0      TCHAR 'PROMPT0',0
  .PROMPT1      TCHAR 'PROMPT1',0
  .PATHS        TCHAR 'PATHS',0
  .GAME         TCHAR 'GAME',0
  .LIBRARY      TCHAR 'LIBRARY',0

; section.key defaults
LOCALIZATION:
  .TITLE   TCHAR 'Custom Scenery:',0
  .PROMPT0 TCHAR 'Select Custom Scenery Library Folder:',0
  .PROMPT1 TCHAR 'Select Themed Folder:',0

PATHS:
  .GAME    TCHAR 'C:\Program Files\',0    
...and then just:
Code:
GPPS gPath,PATHS:GAME

WPPS PATHS:GAME,gPath    
Need to have a sizeof.gPath defined. Yes, I'm am this lazy - add more to it later. Maybe to build the string table automatically or something.
Post 27 Dec 2007, 22:34
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.