Unicode support in VCMP

Started by ysc3839, Feb 03, 2016, 05:57 AM

Previous topic - Next topic

EightyVice

Good work @ysc3839
You surprised me by your work :)

RW

Great! We will use them in the future!终于可以愉快地说中文了! Finally we can speak Chinese. LOL

ysc3839

#32
The first useable version! :D
Only supports 04rel003 version 571C093D. Not support XP!!!
https://bitbucket.org/ysc3839/vcmp-i18n/downloads
Reanme the vcmp-game.dll to vcmp-game1.dll and rename vcmp-i18n-dwrite-dbg.dll to vcmp-game.dll.
Or inject vcmp-i18n-dwrite-dbg.dll to VCMP.
Screenshot:

Luis_Labarca

@ysc3839 good work bro I congratulate you ;)
My server RP
IP: 51.222.28.159:8194

KAKAN

oh no

EightyVice

I like your way to support VCMP @ysc3839

Miracle


ℛḝξ☂

I may be a slow walker but I am always walking.

ysc3839

Quote from: Rest on Jul 18, 2016, 10:58 AMkeep it ;)
I'll keep development if I have time. Or if @Stormeus gives me VCMP's font code. :D

Stormeus

@ysc3839 The font code for VC:MP involves creating a bitmap of all Latin characters and storing it in a DirectX texture to blit later. Drawing via this method is fast but supporting Unicode with it is extremely memory exhaustive. Even if I were to give you the source, it'd be virtually useless for what you're trying to do.

EK.IceFlake

Cant you generate your own bitmap where whenever a new letter is used you put it in your new bitmap. If it was used previously then draw it from the bitmap otherwise read it from the font and add it to your bitmap

EK.IceFlake

Quote from: ysc3839 on Feb 11, 2016, 05:13 PMThe first source code! I named it "vcmp-i18n". This version is under development. It isn't for users, just for developers to review.

https://bitbucket.org/ysc3839/vcmp-i18n

Known issues: 1) No Unicode support.
2) When resize the window, the game will crash.

Also, I tried many ways to make it like VCMP's style, but I can't. @Stormeus could you give me some help?
LOL
"Unicode support in VCMP"
"Known issues: 1) No Unicode support."

Stormeus

Quote from: EK.CrystalBlue on Jul 18, 2016, 01:43 PMCant you generate your own bitmap where whenever a new letter is used you put it in your new bitmap. If it was used previously then draw it from the bitmap otherwise read it from the font and add it to your bitmap

That's an idea, except that introduces a denial of service attack where a player could just send a large string of Unicode characters to exhaust the memory of everyone in the server.

ysc3839

#43
Quote from: Stormeus on Jul 18, 2016, 01:24 PM@ysc3839 The font code for VC:MP involves creating a bitmap of all Latin characters and storing it in a DirectX texture to blit later. Drawing via this method is fast but supporting Unicode with it is extremely memory exhaustive. Even if I were to give you the source, it'd be virtually useless for what you're trying to do.
I want to imitate VCMP's font style but after disassembled VCMP I still don't know how it draws. There's a function between pTexture->Lock and Unlock I don't understand how it works. So I need the source code.

Quote from: Stormeus on Jul 18, 2016, 01:58 PM
Quote from: EK.CrystalBlue on Jul 18, 2016, 01:43 PMCant you generate your own bitmap where whenever a new letter is used you put it in your new bitmap. If it was used previously then draw it from the bitmap otherwise read it from the font and add it to your bitmap

That's an idea, except that introduces a denial of service attack where a player could just send a large string of Unicode characters to exhaust the memory of everyone in the server.
About the performance. IIRC, MTA:SA have a font cache map that caches character bitmap recently used. And my thes version uses DirectWrite and it looks like very fast since it have hardware acceleration.

PS:MTA:SA have two ways to draw texts. One is use ID3DXFont. The other is use FreeType to read glyph bitmap and save to a map. If the map full then some glyph will be removed.

PPS: Informations for this test version. I uses DirectWrite and Direct2D to draw texts to a dc and copy the dc to a Direct3D texture。Then draw this texture to sprite. It's easy to imitate VCMP's font style using DirectWrite's custom text renderer and Direct2D's geometry.

PPPS: @Stormeus I want to blame that VCMP uses the SetRect function to set a RECT struct.
I think it's better to use:(I'm using VS2015 it supports this. IIRC this is supported since C++11)RECT rc = { l, t, r, b };

MEGAMIND

Awesome work bro! salute u