
Recherche avancée
Autres articles (88)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (10950)
-
Evolution #3897 (Nouveau) : Traduction des configurations (yaml, xml, json) et certains formulaire...
6 février 2017, par marcimat ☺☮☯♫Je remets le texte d’un mail envoyé sur spip-devel (comme il n’y a plus de liens gmane pour les voir), sur le sujet parlant de la fonction
_T_ou_typo()
qui permet de pouvoir traiter des chaînes contenant- soit
"du texte"
- soit une
"<:chaine_de_langue:>"
- soit des
"<multi>...</multi>"
La fonction
_T_ou_typo()
a comme usage principal d’appliquer la fonctiontypo()
sur le texte qui lui est envoyé, ou récursivement sur chaque valeur si un tableau lui est donné.
Et, si un des textes est de la forme<:cle_de_langue:>
ou<:module:cle_de_langue:>
(une forme simple de l’écriture de chaîne de langue dans les squelettes donc), alors c’est la valeur de traduction de cette chaîne de langue qui est retourné.Autrement dit :
_T_ou_typo("Coucou") == "Coucou" _T_ou_typo("<:module:bonjour :>") == "Coucou" (avec le fichier de langue qui va bien quand même) _T_ou_typo("Coucou") == "Coucou" _T_ou_typo(["Coucou", "<:module:bonjour :>", "Coucou"]) == ["Coucou", "Coucou", "Coucou"]
Cette intégration pose plusieurs questions sur l’usage / le besoin d’origine et sur la réponse apportée.
L’usage et solution actuelle¶
Le besoin est de permettre dans des fichiers de configuration (yaml, xml, json) de certains plugins, ou dans des options de configuration de certains plugins directement dans l’interface privée de SPIP (Menus, Formidable, Champs Extras, ...), de pouvoir indiquer soit un texte quelconque, soit de se référer à une chaîne de langue quelque part.
Par exemple, dans une déclaration
.yaml
d’une saisie, on peut trouver :label: '<:saisies:option_groupe_description:>'
. On pourrait utiliser pour des saisies spécifiques à un sitelabel: 'Description'
si on sait que le site n’est pas multilingue par exemple.La difficulté d’utiliser directement le code de langue (ie :
label: 'saisies:option_groupe_description'"
qui paraît pourtant plus simple) est qu’il est impossible de discriminer les cas où on écrirait un code de langue, des cas où c’est réellement le texte voulu, par exemple avec"label: 'todo'"
, qui si on utilise le code de langue retournerait ’à venir’ (dans spip_fr.php), alors que ce n’était pas forcément ce qui serait souhaité.D’où donc l’apparition de cette écriture
<:truc:muche:>
pour les textes de configuration, écriture connue déjà dans les squelettes SPIP, avec les nuances qu’on parle bien ici d’une syntaxe simplifiée.
On ne peut pas écrirelabel: '<:module:nb_elephants{nb=5}:>'
par exemple.Proposition¶
Il me semble qu’on pourrait voir la chose autrement, en considérant que toute présence d’un
idiome
doit être transformé par la fonctiontypo()
.
La fonctiontypo()
traite déjà en fait le cas des polyglottes<multi>...</multi>
que l’on peut écrire à la fois dans les squelettes SPIP et à la fois dans le texte d’un article.
Il suffirait d’ajouter la gestion de l’idiome<:module:cle:>
également. Ainsitypo("<:module:bonjour:>")
retournerait "Coucou" en allant piocher la chaîne de langue correspondante.La conséquence est que ça permettrait plus de possibilités que le besoin d’origine (on pourrait mettre des chaines de langue dans les textes d’articles par exemple)
(je ne dis pas que ça serait recommandé non plus, mais dans certains cas ça serait pratique !), tout en répondant au problème avec les configurations de type .yaml ou d’autres déclarations multilingues : il leur suffirait d’appliquer typo() sans autre question, du moins en théorie. - soit
-
Approaches To Modifying Game Resource Files
16 août 2016, par Multimedia Mike — Game HackingI have been assisting The Translator in the translation of another mid-1990s adventure game. This one isn’t quite as multimedia-heavy as the last title, and the challenges are a bit different. I wanted to compose this post in order to describe my thought process and mental model in approaching this problem. Hopefully, this will help some others understand my approach since what I’m doing here often appears as magic to some of my correspondents.
High Level Model
At the highest level, it is valuable to understand the code and the data at play. The code is the game’s engine and the data refers to the collection of resources that comprise the game’s graphics, sound, text, and other assets.
Simplistic high-level game engine model
Ideally, we want to change the data in such a way that the original game engine adopts it as its own because it has the same format as the original data. It is very undesirable to have to modify the binary engine executable in any way.
Modifying The Game Data Directly
How to modify the data ? If we modify the text strings for the sake of language translation, one approach might be to search for strings within the game data files and change them directly. This model assumes that the text strings are stored in a plain, uncompressed format. Some games might store these strings in a text format which can be easily edited with any text editor. Other games will store them as binary data.
In the latter situation, a game hacker can scan through data files with utilities like Unix ‘strings’ to find the resources with the desired strings. Then, use a hex editor to edit the strings directly. For example, change “Original String”…
0098F800 00 00 00 00 00 00 00 4F 72 69 67 69 6E 61 6C 20 .......Original 0098F810 53 74 72 69 6E 67 00 00 00 00 00 00 00 00 00 00 String..........
…to “Short String” and pad the difference in string lengths using spaces (0x20) :
0098F800 00 00 00 00 00 00 00 53 68 6F 72 74 20 53 74 72 .......Short Str 0098F810 69 6E 67 20 20 20 00 00 00 00 00 00 00 00 00 00 ing ..........
This has some obvious problems. First, translated strings need to be of equal our smaller length compared to the original. What if we want to encode “Much Longer String” ?
0098F800 00 00 00 00 00 00 00 4D 75 63 68 20 4C 6F 6E 67 .......Much Long 0098F810 65 72 20 53 74 72 00 00 00 00 00 00 00 00 00 00 er Str..........
It won’t fit. The second problem pertains to character set limitations. If the font in use was only designed for ASCII, it’s going to be inadequate for expressing nearly any other language.
So a better approach is needed.
Understanding The Data Structures
An alternative to the approach outlined above is to understand the game’s resources so they can be modified at a deeper level. Here’s a model to motivate this investigation :
Model of the game resource archive format
This is a very common layout for such formats : there is a file header, a sequence of resource blocks, and a trailing index which describes the locations and types of the foregoing blocks.
What use is understanding the data structures ? In doing so, it becomes possible to write new utilities that disassemble the data into individual pieces, modify the necessary pieces, and then reassemble them into a form that the original game engine likes.
It’s important to take a careful, experimental approach to this since mistakes can be ruthlessly difficult to debug (unless you relish the thought of debugging the control flow through an opaque DOS executable). Thus, the very first goal in all of this is to create a program that can disassemble and reassemble the resource, thus creating an identical resource file. This diagram illustrates this complex initial process :
Rewriting the game resource file
So, yeah, this is one of the most complicated “copy file” operations that I can possibly code. But it forms an important basis, since the next step is to carefully replace one piece at a time.
Modifying a specific game resource
This diagram shows a simplistic model of a resource block that contains a series of message strings. The header contains pointers to each of the strings within the block. Instead of copying this particular resource block directly to the new file, a proposed modification utility will intercept it and rewrite the entire thing, writing new strings of arbitrary length and creating an adjusted header which will correctly point to the start of each new string. Thus, translated strings can be longer than the original strings.
Further Work
Exploiting this same approach, we can intercept and modify other game resources including fonts, images, and anything else that might need to be translated. I will explore specific examples in a later blog post.Followup
- Translating Return to Ringworld, in which I apply the ideas expressed in this post.
The post Approaches To Modifying Game Resource Files first appeared on Breaking Eggs And Making Omelettes.
-
How to add audio between the video of constant time using ffmpeg
30 octobre 2022, par LolHi i am trying to do something like this...


I have a mp4 video which also have audio of length 10 sec.


i have an audio which have random length ( less than 10 sec )


I want output mp4 like...


let silence = (input mp4 duration - audio random duration) divided by 2.


Then i need audio in my output mp4 like.


input file audio + (both audio file input file audio) + input file audio


I tried so many ways but unable to add audio in the center of the mp4.


I hope anyone can understand this waiting for the answer.