Author Topic: Bug report - Xan's BG1 friendship path for BGEE  (Read 4288 times)

Offline agb1

  • Planewalker
  • *****
  • Posts: 30
Bug report - Xan's BG1 friendship path for BGEE
« on: January 19, 2016, 08:44:28 AM »
I noticed this recently in a user's install log:

Setup-XanBG1Friend.exe --no-exit-pause --noautoupdate --language 0 --skip-at-view --quick-log --force-install-list 0 --logapp
[Setup-XanBG1Friend.exe] WeiDU version 23800
Using Language [English]

Using .\lang\en_us/dialog.tlk

Installing [Xan's friendship path for BG1] [v9bgee]

Windows conversion with CP1252
'bg1npc\iconv' is not recognized as an internal or external command,
operable program or batch file.

Copying 1 file ...
loading 1 tra file

The conv_tra.bat script in xanbg1friend folder references bg1npc\iconv instead of xanbg1friend\iconv:

:: Use a parameter to the script (%1) to specify the directory that must be converted
:: Use a parameter to the script (%2) to specify the encoding of the files to convert

:: Prevent display of DOS command lines
@echo off

if not exist xanbg1friend\%1\utf8 mkdir xanbg1friend\%1\utf8

:: Since the pattern matching in Windows considers that "fu.tra_utf8" also matches "*.tra", we have to
:: handle the file extension by ourselfves in order to avoid all those tra_utf8_utf8 etc files
:: Use %%~ni instead of %%~nxi (x is for extension) and specify the tra extension
for %%i in (xanbg1friend\%1\*.tra) do bg1npc\iconv -f %2 -t UTF-8 "xanbg1friend\%1\%%~ni.tra" > "xanbg1friend\%1\utf8\%%~ni.tra"

Rather than just fixing that script, I suggest switching to use the newer HANDLE_CHARSETS method, which would allow you to remove conv_tra.bat and conv_tra.sh.  Just replace the current ALWAYS block in xanbg1friend.tp2 with this:

ALWAYS
  ACTION_DEFINE_ASSOCIATIVE_ARRAY tra#charsets BEGIN
     "English" => "CP1252"
     "Russian" => "CP1251"
     "German" => "CP1252"
     "French" => "CP1252"
     "Italian" => "CP1252"
  END
  ACTION_DEFINE_ARRAY tra#reload BEGIN O#XanBG1 END
  LAF HANDLE_CHARSETS
    STR_VAR
       charset_table = tra#charsets
       tra_path        = EVAL ~%MOD_FOLDER%~
       iconv_path.    = EVAL ~%MOD_FOLDER%~
       reload_array  = tra#reload
  END
END

Edited to use original charsets table imstead of infer_charsets, just in case.
« Last Edit: January 22, 2016, 12:03:45 AM by agb1 »

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Bug report - Xan's BG1 friendship path for BGEE
« Reply #1 on: June 05, 2017, 08:25:50 AM »
I put up a local v10 with:

Code: [Select]
// Setup
BACKUP ~XanBG1Friend/Backup~
AUTHOR ~Kulyok http://forums.pocketplane.net~
VERSION ~v10~ /* Thanks to Isaya for changes for v9 for BGEE; Kaeloree did the rest, BGEE-wise */
README ~XanBG1Friend/Readme-XanBG1Friend.txt~


// BG:EE TRA compatibility
ALWAYS
  ACTION_DEFINE_ASSOCIATIVE_ARRAY tra#charsets BEGIN
     "English" => "CP1252"
     "Russian" => "CP1251"
     "German" => "CP1252"
     "French" => "CP1252"
     "Italian" => "CP1252"
  END
  ACTION_DEFINE_ARRAY tra#reload BEGIN O#XanBG1 END
  LAF HANDLE_CHARSETS
    STR_VAR
       charset_table = tra#charsets
       tra_path        = EVAL ~%MOD_FOLDER%~
       iconv_path.    = EVAL ~%MOD_FOLDER%~
       reload_array  = tra#reload
  END
END


// Languages
AUTO_TRA ~XanBG1Friend/%s~
LANGUAGE ~English~ ~English~ ~XanBG1Friend/English/O#XanBG1.tra~
LANGUAGE ~Russian~ ~Russian~ ~XanBG1Friend/Russian/O#XanBG1.tra~
LANGUAGE ~German (Translated by Steffen)~ ~German~ ~XanBG1Friend/German/O#XanBG1.tra~
LANGUAGE ~French (Translated by Eleima)~ ~French~ ~XanBG1Friend/French/O#XanBG1.tra~
LANGUAGE ~Italian (Translated by totuccio5)~ ~Italian~ ~XanBG1Friend/Italian/O#XanBG1.tra~

// Component
BEGIN ~Xan's friendship path for BG1~


which gives me the error message "FAILURE:
ERROR: no tabulated charset could be found for language english".

I have no experience with ACTION_DEFINE_ASSOCIATIVE_ARRAY, can someone point me to the problem?

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Bug report - Xan's BG1 friendship path for BGEE
« Reply #2 on: June 05, 2017, 08:38:47 AM »
OK, new question: Is it correct that

Code: [Select]
  ACTION_DEFINE_ARRAY fl#reload BEGIN O#XanBG1 END

   LAF HANDLE_CHARSETS
    INT_VAR
      infer_charset = 1
    STR_VAR
      tra_path = EVAL ~%MOD_FOLDER%~
      reload_array = fl#reload
  END

handles the languages in question (English, Russian, German, French, Italian) correctly?


Offline Isaya

  • Planewalker
  • *****
  • Posts: 47
Re: Bug report - Xan's BG1 friendship path for BGEE
« Reply #3 on: June 05, 2017, 04:25:23 PM »
The WeiDU readme lists the language names that HANDLE_CHARSETS handles by defaut. Those names are in the list, so it should associate the right character encoding for them. Providing the table is only necessary if an unlisted language is concerned or if a mod uses an unusual language name for one language.

Provided the iconv binary for Windows is located in %MOD_FOLDER%/iconv directory (%tra_path%/iconv is the default location if you don't specify iconv_path, as written in the readme), the second code should work.
So, compared to v9, you need to move iconv.exe and the dll in an iconv subdirectory.
If you don't move iconv.exe from its location in v9, you need to add iconv_path = EVAL ~%MOD_FOLDER%~

Thank you for taking the time to fix this mistake I made years ago. I made a similar change locally but never posted it and probably never tested it either.

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Bug report - Xan's BG1 friendship path for BGEE
« Reply #4 on: June 09, 2017, 11:46:36 AM »
Thank you!

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Bug report - Xan's BG1 friendship path for BGEE
« Reply #5 on: June 13, 2017, 06:55:22 AM »
There is a v10 with repaired EE compatibility (for all language versions) here.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: