WikiPad

Check-in [6dc9d825f3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Small changes adjustments and file ordering in the project directory. Color icons.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6dc9d825f3ed0709f2403ab9542d2897c1684280
User & Date: lhmnai0 2011-03-16 10:43:29
Context
2011-03-16
14:58
It is almost useful. It misses search and replace, syntax highlight and other things, but allows inserting text really fast. check-in: 970026b1fd user: lhmnai0 tags: trunk
10:43
Small changes adjustments and file ordering in the project directory. Color icons. check-in: 6dc9d825f3 user: lhmnai0 tags: trunk
06:53
Removed WS_DISABLE from the listbox. check-in: a2aa4f44b4 user: JohnFound tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to MainForm.frm.

1
2
3
4
5
6
7
8
9
10
11
..
14
15
16
17
18
19
20


21
22
23
24
25
26
27
..
30
31
32
33
34
35
36



37
38
39
40
41
42
43
44
45
46
47
48


















49
50
51
52
53
54
55
..
62
63
64
65
66
67
68
69
70
71
72


73














74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
...
110
111
112
113
114
115
116






117
118
119
120
121
122
123
124



125
126
127
128
129
130
131
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $0, 0, 247, 95, 550, 409, Form1WinProc;
Window NONE, 0, 5, 'EDIT', '', $56301104, $200, 100, 120, 0, 422, 382, EditWinProc;
Window NONE, 2, 1, 'LISTBOX', 'Listbox', $508005C3, $200, 200, 0, 0, 120, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


................................................................................
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?
  hEditor dd ?


endg

iglobal
  property propIgnoreNext, 'IGNORENEXT'
endg


................................................................................

ondefault
        stc
        return

onmessage WM_COMMAND
        movzx   esi,word [.wparam]



        cmp     esi, FirstID
        jl      .ondefault

        sub     esi,FirstID
        cmp     esi,[MainActionList.Number]
        jge     .ondefault

        imul    esi,sizeof.TAction
        add     esi,MainActionList

        stdcall [esi+TAction.OnExecute], [.wparam], [.lparam]
        xor     eax, eax


















        clc
        return


onmessage AM_INITWINDOW
        stdcall ImageList_LoadGif, [hInstance], resMainToolbar, 16, FALSE
        mov     [hIml], eax
................................................................................
        invoke  SetMenu, [.hwnd], eax

        stdcall CreateCoolToolbar, MainActionList, MainToolbar, [.hwnd], 11, [hIml], [hImlGray]
        mov     [hMainToolbar],eax
        stdcall SetAlign, eax, waTop

        invoke  CreateAcceleratorTable, MainAccels, [MainAccels.Count]
        invoke  SetProp, [hApplication], [propAccelerators], eax

;        stdcall SetAutoSize, [hMainToolbar], TRUE
        invoke  SetProp, [hApplication], [propMainForm], [.hwnd]


















        clc
        return

onmessage WM_SETFOCUS


        invoke  SetFocus, [hEditor]
        clc
        return


onmessage WM_CLOSE
        stdcall OnExit, 0, 0
        clc
        return

................................................................................

winproc EditWinProc
begin

ondefault
        stc
        return







onmessage WM_CHAR

        invoke  GetProp, [.hwnd], [propIgnoreNext]
        test    eax, eax
        jz      .ondefault

        invoke  SetProp, [.hwnd], [propIgnoreNext], 0




        xor     eax, eax
        clc
        return

onmessage WM_KEYDOWN

................................................................................
        shl     ebx, 8
        mov     bl, byte [.wparam]

        stdcall SearchHotKey, ebx
        jc      .ondefault

        mov     esi, eax        ; pointer to TShortcutItem
; now insert the tag...

locals
  .beg dd ?
  .end dd ?
  .ins dd ?
endl
        lea     eax, [.beg]
        lea     ecx, [.end]
        invoke  SendMessage, [.hwnd], EM_GETSEL, eax, ecx

        mov     eax, [.beg]
        cmp     eax, [.end]

        invoke  SendMessage, [.hwnd], EM_SETSEL, [.end], [.end]

        stdcall StrLen, [esi+TShortcutItem.hCloseTag]
        mov     [.ins], eax
        stdcall StrLen, [esi+TShortcutItem.hOpenTag]
        add     [.ins], eax

        stdcall StrPtr, [esi+TShortcutItem.hCloseTag]
        invoke  SendMessage, [.hwnd], EM_REPLACESEL, TRUE, eax

        invoke  SendMessage, [.hwnd], EM_SETSEL, [.beg], [.beg]

        stdcall StrPtr, [esi+TShortcutItem.hOpenTag]
        invoke  SendMessage, [.hwnd], EM_REPLACESEL, TRUE, eax

        mov     eax, [.beg]
        cmp     eax, [.end]
        je      .posok

        mov     eax, [.end]
        add     eax, [.ins]
        invoke  SendMessage, [.hwnd], EM_SETSEL, eax, eax

.posok:
        invoke  SetProp, [.hwnd], [propIgnoreNext], 1

        xor     eax,eax
        clc
        return

onmessage AM_INITWINDOW
        invoke  SetProp, [.hwnd], [propOwnFont], 1

|
|
|







 







>
>







 







>
>
>












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|

|
|
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>




|
<
>
|
<
<







 







>
>
>
>
>
>








>
>
>







 







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
..
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

118
119


120
121
122
123
124
125
126
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
201
202
203
204
205
206
207
208






































209
210
211
212
213
214
215
;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $10000, 0, 433, 299, 550, 409, Form1WinProc;
Window NONE, 0, 5, 'EDIT', '', $56311104, $200, 100, 120, 0, 422, 382, EditWinProc;
Window NONE, 2, 1, 'LISTBOX', 'Listbox', $508105C3, $200, 200, 0, 0, 120, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


................................................................................
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?
  hEditor dd ?

  hAccelerators dd ?
endg

iglobal
  property propIgnoreNext, 'IGNORENEXT'
endg


................................................................................

ondefault
        stc
        return

onmessage WM_COMMAND
        movzx   esi,word [.wparam]
        cmp     esi, idShortcuts
        je      .listbox_notify

        cmp     esi, FirstID
        jl      .ondefault

        sub     esi,FirstID
        cmp     esi,[MainActionList.Number]
        jge     .ondefault

        imul    esi,sizeof.TAction
        add     esi,MainActionList

        stdcall [esi+TAction.OnExecute], [.wparam], [.lparam]
        xor     eax, eax
        clc
        return

.listbox_notify:
        cmp     word [.wparam+2], LBN_DBLCLK
        jne     .listbox_exit

        invoke  SendMessage, [.lparam], LB_GETCARETINDEX, 0, 0
        test    eax, eax
        js      .listbox_exit

        invoke  SendMessage, [.lparam], LB_GETITEMDATA, eax, 0
        test    eax, eax
        jz      .listbox_exit

        stdcall InsertShortcut, eax

.listbox_exit:
        clc
        return


onmessage AM_INITWINDOW
        stdcall ImageList_LoadGif, [hInstance], resMainToolbar, 16, FALSE
        mov     [hIml], eax
................................................................................
        invoke  SetMenu, [.hwnd], eax

        stdcall CreateCoolToolbar, MainActionList, MainToolbar, [.hwnd], 11, [hIml], [hImlGray]
        mov     [hMainToolbar],eax
        stdcall SetAlign, eax, waTop

        invoke  CreateAcceleratorTable, MainAccels, [MainAccels.Count]
        mov     [hAccelerators], eax

        invoke  LoadIcon, [hInstance], resAppIcon
        push    eax
        invoke  SendMessage, [.hwnd], WM_SETICON, ICON_SMALL, eax
        invoke  SendMessage, [.hwnd], WM_SETICON, ICON_BIG ; from the stack

        clc
        return


onmessage WM_ACTIVATE
        movzx   eax, word [.wparam]
        cmp     eax, WA_ACTIVE
        je      .focuseditor
        cmp     eax, WA_CLICKACTIVE
        jne     .ondefault

.focuseditor:
        stdcall AlignChildren, [.hwnd]
        invoke  SetFocus, [hEditor]

        clc
        return

onmessage WM_SIZE

        stdcall AlignChildren, [.hwnd]
        jmp     .ondefault




onmessage WM_CLOSE
        stdcall OnExit, 0, 0
        clc
        return

................................................................................

winproc EditWinProc
begin

ondefault
        stc
        return

onmessage WM_GETDLGCODE

        mov     eax, DLGC_WANTARROWS or DLGC_WANTTAB or DLGC_WANTALLKEYS
        clc
        return

onmessage WM_CHAR

        invoke  GetProp, [.hwnd], [propIgnoreNext]
        test    eax, eax
        jz      .ondefault

        invoke  SetProp, [.hwnd], [propIgnoreNext], 0

        cmp     [.wparam], $20
        jae     .ondefault

        xor     eax, eax
        clc
        return

onmessage WM_KEYDOWN

................................................................................
        shl     ebx, 8
        mov     bl, byte [.wparam]

        stdcall SearchHotKey, ebx
        jc      .ondefault

        mov     esi, eax        ; pointer to TShortcutItem
        stdcall InsertShortcut, eax







































        xor     eax,eax
        clc
        return

onmessage AM_INITWINDOW
        invoke  SetProp, [.hwnd], [propOwnFont], 1

Changes to ShortcutEngine.asm.

1
2
3
4
5
6
7













































8
9
10
11
12
13
14
struct TShortcutItem
  .hCaption    dd ?
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?
ends
















































proc SearchHotKey, .hotkey
begin

        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0
        mov     ebx, eax







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
struct TShortcutItem
  .hCaption    dd ?
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?
ends


proc InsertShortcut, .ptrShortcut
  .beg dd ?
  .end dd ?
  .ins dd ?
begin
        push    esi
        mov     esi, [.ptrShortcut]

        lea     eax, [.beg]
        lea     ecx, [.end]
        invoke  SendMessage, [hEditor], EM_GETSEL, eax, ecx

        mov     eax, [.beg]
        cmp     eax, [.end]

        invoke  SendMessage, [hEditor], EM_SETSEL, [.end], [.end]

        stdcall StrLen, [esi+TShortcutItem.hCloseTag]
        mov     [.ins], eax
        stdcall StrLen, [esi+TShortcutItem.hOpenTag]
        add     [.ins], eax

        stdcall StrPtr, [esi+TShortcutItem.hCloseTag]
        invoke  SendMessage, [hEditor], EM_REPLACESEL, TRUE, eax

        invoke  SendMessage, [hEditor], EM_SETSEL, [.beg], [.beg]

        stdcall StrPtr, [esi+TShortcutItem.hOpenTag]
        invoke  SendMessage, [hEditor], EM_REPLACESEL, TRUE, eax

        mov     eax, [.beg]
        cmp     eax, [.end]
        je      .posok

        mov     eax, [.end]
        add     eax, [.ins]
        invoke  SendMessage, [hEditor], EM_SETSEL, eax, eax

.posok:
        invoke  SetProp, [hEditor], [propIgnoreNext], 1
        pop     esi
        return
endp



proc SearchHotKey, .hotkey
begin

        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0
        mov     ebx, eax

Changes to WikiPad.asm.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
include "%finc%/win32/win32a.inc"

include '%finc%/libs/gui.inc'
include '%finc%/libs/parents.inc'
include '%finc%/libs/msgutils.inc'
include '%finc%/libs/templates.inc'
include '%finc%/libs/tform.inc'
include '%finc%/libs/application.inc'
include '%finc%/libs/splitter.inc'


section '.code' code readable executable

include '%finc%/libs/gui.asm'
include '%finc%/libs/parents.asm'
include '%finc%/libs/msgutils.asm'
include '%finc%/libs/templates.asm'
include '%finc%/libs/tform.asm'
include '%lib%/system/memory.asm'
include '%lib%/system/files.asm'

include '%lib%/GUI/Win32/giflib.asm'
include '%finc%/libs/application.asm'
include '%finc%/libs/splitter.asm'

include '%lib%/data/arrays.asm'
include '%lib%/data/strlib.asm'
include 'StrLibOS.asm'

include 'opendialog.asm'
................................................................................
        invoke  GetProcessHeap
        mov     [hHeap], eax

; Init common controls
        invoke  InitCommonControls      ;Ex, ComCtrlsFlags

        InitializeAll
        stdcall InitApplication, resAppIcon, cMainTitle

        stdcall CreateForm, Form1, [hApplication]
        mov     [hMainForm], ebx

        invoke  SetProp, [hApplication], [propOnIdle], OnIdle

;----------------------------------------------
; Main message loop
;----------------------------------------------
Run:
        call    ProcessMessages
        jc      .terminate

        invoke  SendMessage, [hApplication], AM_ONIDLE, 0, 0
        invoke  WaitMessage
        jmp     Run

.terminate:
        push    eax
        FinalizeAll
        invoke  ExitProcess







<













|
<







 







<

|


<
<







|







4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
..
56
57
58
59
60
61
62

63
64
65
66


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
include "%finc%/win32/win32a.inc"

include '%finc%/libs/gui.inc'
include '%finc%/libs/parents.inc'
include '%finc%/libs/msgutils.inc'
include '%finc%/libs/templates.inc'
include '%finc%/libs/tform.inc'

include '%finc%/libs/splitter.inc'


section '.code' code readable executable

include '%finc%/libs/gui.asm'
include '%finc%/libs/parents.asm'
include '%finc%/libs/msgutils.asm'
include '%finc%/libs/templates.asm'
include '%finc%/libs/tform.asm'
include '%lib%/system/memory.asm'
include '%lib%/system/files.asm'

include 'giflib.asm'

include '%finc%/libs/splitter.asm'

include '%lib%/data/arrays.asm'
include '%lib%/data/strlib.asm'
include 'StrLibOS.asm'

include 'opendialog.asm'
................................................................................
        invoke  GetProcessHeap
        mov     [hHeap], eax

; Init common controls
        invoke  InitCommonControls      ;Ex, ComCtrlsFlags

        InitializeAll


        stdcall CreateForm, Form1, 0
        mov     [hMainForm], ebx



;----------------------------------------------
; Main message loop
;----------------------------------------------
Run:
        call    ProcessMessages
        jc      .terminate

        stdcall OnIdle
        invoke  WaitMessage
        jmp     Run

.terminate:
        push    eax
        FinalizeAll
        invoke  ExitProcess

Changes to WikiPad.exe.

cannot compute difference between binary files

Changes to WikiPad.fpr.

cannot compute difference between binary files

Changes to actions.asm.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
64
65
66
67
68
69
70










71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  actExit,       -1, '&Exit',           <Alt,  'X'>,         'Exit program',               OnExit,              \
\
  actUndo,        3, '&Undo',           <Ctrl, 'Z'>,         'Undo last change',           OnUndo,              \
  actCut ,        4, 'Cu&t',            <Ctrl, 'X'>,         'Cut to clipboard',           OnCut,               \
  actCopy,        5, '&Copy',           <Ctrl, 'C'>,         'Copy to clipboard',          OnCopy,              \
  actPaste,       6, '&Paste',          <Ctrl, 'V'>,         'Paste from clipboard',       OnPaste,             \
\
  actLoadShortcuts, -1, 'Load shortcuts', <NONE>, 'Load shortcuts from a file.',   OnLoadShortcuts,    \
  actSaveShortcuts, -1, 'Save shortcuts', <NONE>, 'Save the shortcuts to a file.', OnSaveShortcuts,  \
  actEditShortcut, -1, 'Edit shortcut',   <NONE>, 'Edit shortcut.',                OnEditShortcut,                   \
  actNewShortcut, -1, 'New shortcut',     <NONE>, 'Add new shortcut.',             OnNewShortcut,                    \
  actDelShortcut, -1, 'Del shortcut',     <NONE>, 'Delete a shortcut.',            OnDelShortcut




CoolMenu MainMenu,                      \
  mfSubmenu, '&File',                   \
    mfNormal, actNew,                   \
................................................................................
  bfButton, actCut,                     \
  bfButton, actCopy,                    \
  bfButton, actPaste,                   \
  bfSeparator, NONE
endg













proc OnNew, .wparam, .lparam
begin
        invoke  SendMessage, [hEditor], WM_SETTEXT, 0, 0
        stdcall StrDel, [hLoadedFilename]
        mov     [hLoadedFilename], 0
        stdcall UpdateTitle
        return
endp



proc OnIdle
begin
        stdcall UpdateTitle
        return
endp




cEditorTitle text 'Wikipad: '
cModified    text ' [modified]'

proc UpdateTitle
................................................................................

.check:
        invoke  SendMessage, [hEditor], EM_GETMODIFY, 0, 0
        test    eax, eax
        jnz     .noexit

.exit:
        invoke  PostMessage, [hApplication], WM_CLOSE, 0, 0
        return

.noexit:
        invoke  MessageBox, [hMainForm], cErrorNotSaved, cTitleNotSaved, MB_YESNOCANCEL or MB_ICONQUESTION
        cmp     eax, MR_NO
        je      .exit








|
|
|
|
|







 







>
>
>
>
>
>
>
>
>
>











<
<
<
<
<
<
<







 







|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91







92
93
94
95
96
97
98
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
  actExit,       -1, '&Exit',           <Alt,  'X'>,         'Exit program',               OnExit,              \
\
  actUndo,        3, '&Undo',           <Ctrl, 'Z'>,         'Undo last change',           OnUndo,              \
  actCut ,        4, 'Cu&t',            <Ctrl, 'X'>,         'Cut to clipboard',           OnCut,               \
  actCopy,        5, '&Copy',           <Ctrl, 'C'>,         'Copy to clipboard',          OnCopy,              \
  actPaste,       6, '&Paste',          <Ctrl, 'V'>,         'Paste from clipboard',       OnPaste,             \
\
  actLoadShortcuts, -1, '&Load shortcuts', <NONE>, 'Load shortcuts from a file.',   OnLoadShortcuts,    \
  actSaveShortcuts, -1, '&Save shortcuts', <NONE>, 'Save the shortcuts to a file.', OnSaveShortcuts,  \
  actEditShortcut, -1, '&Edit shortcut',   <NONE>, 'Edit shortcut.',                OnEditShortcut,                   \
  actNewShortcut, -1, '&New shortcut',     <NONE>, 'Add new shortcut.',             OnNewShortcut,                    \
  actDelShortcut, -1, '&Del shortcut',     <NONE>, 'Delete a shortcut.',            OnDelShortcut




CoolMenu MainMenu,                      \
  mfSubmenu, '&File',                   \
    mfNormal, actNew,                   \
................................................................................
  bfButton, actCut,                     \
  bfButton, actCopy,                    \
  bfButton, actPaste,                   \
  bfSeparator, NONE
endg



proc OnIdle
begin
        stdcall UpdateTitle
        return
endp





proc OnNew, .wparam, .lparam
begin
        invoke  SendMessage, [hEditor], WM_SETTEXT, 0, 0
        stdcall StrDel, [hLoadedFilename]
        mov     [hLoadedFilename], 0
        stdcall UpdateTitle
        return
endp












cEditorTitle text 'Wikipad: '
cModified    text ' [modified]'

proc UpdateTitle
................................................................................

.check:
        invoke  SendMessage, [hEditor], EM_GETMODIFY, 0, 0
        test    eax, eax
        jnz     .noexit

.exit:
        invoke  PostQuitMessage, 0
        return

.noexit:
        invoke  MessageBox, [hMainForm], cErrorNotSaved, cTitleNotSaved, MB_YESNOCANCEL or MB_ICONQUESTION
        cmp     eax, MR_NO
        je      .exit

Added fossil.cfg.

cannot compute difference between binary files

Added giflib.asm.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
GifLib:

;===============================================================================
;       FreshGif v1.2 - (C) Copyright by Exagone
;===============================================================================
; The included Fresh artistic license (see license.txt) applies to this source
; code. By using this code, you agree to the terms of the license.
;
; Original source code by Exagone
; http://exagone.cjb.net | http://www.exagone.org
; _thomas_@mailroom.com
;===============================================================================
; (c)2004 John Found - Port for FASM/Fresh cleanup and improvements.
; http://flatassembler.net
; http://fresh.flatassembler.net
;===============================================================================


struct TGifInfo
;--- Header ---
  .GIFVersion       rb      3    ; 3 byte string (not 0-terminated) that identifies
                                 ; the GIF Version (like 97a or 98a)
; --- Logical screen descriptor ---
  .dwLSWidth        dd      ?    ; Logical screen width
  .dwLSHeight       dd      ?    ; Logical screen height
                                 ; NOTE: Use ImageWidth/Height to find the dimensions,
                                 ; This one can be different from the logical screen
                                 ; width and height.
; --- Color info ---
  .lpColorTable     dd      ?    ; Pointer to the color table
  .ColorCount       dd      ?    ; Number of colors in image (and color table)
  .fTransparent     dd      ?    ; if TRUE - the image have transparent color.
  .iTrasparentColor dd      ?    ; index of transparent color in the color table.

; --- Image info ---
  .dwImageWidth     dd      ?    ; Width of image
  .dwImageHeight    dd      ?    ; Height of image

; --- Image data ---
  .lpImageData      dd      ?    ; Pointer to the actual image data

; --- Input data ---
  .lpGIFData        dd      ?    ; Pointer to the GIF File data
  .dwGIFDataSize    dd      ?    ; Size of GIF Data

; --- Internal data ---
; Don't touch this data below, it is used internally by GIFLIB
  .lpLZWTable       dd      ?    ; Pointer to LZW Table
  .dwLZWTableSize   dd      ?    ; Current maximum size of table
                                 ; This size is dynamic and changes
                                 ; if the codesize exceeds 9 bits

  .dwLZWTableCount  dd      ?    ; Current nr of entries in the LZW table
  .fGlobalCTable    db      ?    ; If set, the GIF file has a global color table
  .dbGCTableSize    db      ?    ; Size of the global color table, if available
  .fLocalCTable     db      ?    ; If set, the first image has a local color table
  .dbLCTableSize    db      ?    ; Size of the local color table, if available
  .lpGIFImage       dd      ?    ; Pointer to the first real image data(Table based image data)
  .lpCurrentByte    dd      ?    ; Pointer to the current byte (used with decompression)
                                 ; note: if this value is -1, end of the file is reached and
                                 ; the code-supplier returns 0 as padding

  .dbBitsAvailable  db      ?    ; Nr of codebits currently available
  .dbCurBitSize     db      ?    ; Current LZW code size
  .dbInitBitSize    db      ?    ; Initial LZW code size
  .lpLastEOSB       dd      ?    ; Pointer to end of current subblock (used with decompression)
  .dwLZWClear       dd      ?    ; Value of LZW Clear code (CC)
  .CurrentBits      dd      ?    ; Holds the current bits loaded
  .IsFirstCode      db      ?    ; Indicates if the first code is being read now
  .PixelCounter     dd      ?    ; Counts nr of PIXELS outputted
ends

EXTENSIONBLOCK           =  021h
IMAGEDESCRIPTOR          =  02Ch
GRAPHICCONTROLEXTENSTION =  0F9h
COMMENTEXTENSION         =  0FEh
PLAINTEXTEXTENSION       =  001h
APPLICATIONEXTENSION     =  0FFh



proc LoadGif, .hInst, .ptrName
.gifinfo TGifInfo
begin
        lea     eax, [.gifinfo]
        stdcall DoLoadGif, [.hInst], [.ptrName], eax
        return
endp


;--------------------------------------------------------------
; You should use gui.asm if you want to call this function
;--------------------------------------------------------------
proc ImageList_LoadGif, .hInst, .ptrName, .width, .fDisabled
.gifinfo TGifInfo
.result     dd ?
.colorback  dd ?
begin
        push    esi edi ebx
        mov     [.result], 0

        invoke  GetSysColor, COLOR_BTNFACE
        mov     [.colorback], eax

        lea     edi, [.gifinfo]

        stdcall DoLoadGif, [.hInst], [.ptrName], edi
        test    eax, eax
        jz      .quit
        mov     ebx, eax

        mov     eax, [edi+TGifInfo.dwImageWidth]
        cmp     [.width], -1
        jne     @f
        mov     [.width], eax
@@:
        invoke  ImageList_Create, [.width], [edi+TGifInfo.dwImageHeight],  ILC_COLOR32 or ILC_MASK, 0, 1
        test    eax, eax
        jz      .quitclean

        mov     [.result], eax

        mov     ecx, $ff010101
        cmp     [edi+TGifInfo.fTransparent], 0
        je      @f
        mov     ecx, [edi+TGifInfo.iTrasparentColor]
        lea     ecx, [ecx+2*ecx]
        add     ecx, [edi+TGifInfo.lpColorTable]
        mov     ecx, [ecx]
        and ecx, $00ffffff
@@:
        push    ecx

        cmp     [.fDisabled], 0
        je      @f

        stdcall DisableBitmap, ebx, [.width], ecx, [.colorback], ecx
        xchg    eax, ebx
        invoke  DeleteObject, eax

@@:
        invoke  ImageList_AddMasked, [.result], ebx     ; , ecx from the stack

.quitclean:
        invoke  DeleteObject, ebx
.quit:
        mov     eax, [.result]
        pop     ebx edi esi
        return
endp



proc DoLoadGif, .hInst, .ptrName, .ptrGifInfo
.bitmapinfo BITMAPINFOHEADER
.result     dd ?
begin
        push    esi edi
        mov     [.result], 0

        mov     edi, [.ptrGifInfo]
        lea     esi, [.bitmapinfo]

        stdcall GIFLoadResource, edi, [.hInst], [.ptrName]
        jz      .quit

        stdcall GIFLoadHeader, edi
        jz      .quit

        stdcall GIFInitalizeDecoder, edi
        jz       .quit

        stdcall GIFFillBitmapInfoStruct, edi, esi

        lea     eax, [edi+TGifInfo.lpImageData]
        invoke  CreateDIBSection, NULL, esi, DIB_RGB_COLORS, eax, NULL, NULL
        test    eax, eax
        jz      .quit

        mov     [.result], eax

        stdcall GIFDecompress, edi
        jz      .quit

        stdcall GIFCleanup, edi

.quit:
        mov     eax, [.result]
        pop     edi esi
        return
endp



proc GIFCreateBitmap, .ptrGIFFile, .szGIFFile
.bitmapinfo BITMAPINFOHEADER
.result     dd ?
.GifInfo  TGifInfo
begin
        push    esi edi
        mov     [.result], 0

        lea     edi, [.GifInfo]
        lea     esi, [.bitmapinfo]


        mov     eax, [.ptrGIFFile]
        mov     ecx, [.szGIFFile]
        mov     [edi+TGifInfo.lpGIFData], eax
        mov     [edi+TGifInfo.dwGIFDataSize], ecx

        stdcall GIFLoadHeader, edi
        jz      .quit

        stdcall GIFInitalizeDecoder, edi
        jz       .quit

        stdcall GIFFillBitmapInfoStruct, edi, esi

        lea     eax, [edi+TGifInfo.lpImageData]
        invoke  CreateDIBSection, NULL, esi, DIB_RGB_COLORS, eax, NULL, NULL
        test    eax, eax
        jz      .quit

        mov     [.result], eax

        stdcall GIFDecompress, edi
        jz      .quit

        stdcall GIFCleanup, edi

.quit:
        mov     eax, [.result]
        pop     edi esi
        return
endp


;===============================================================================
;       GIFLoadResource
;===============================================================================
; Loads gif data from a resource (of type RT_RCDATA)
; lpName:pointer to a resource name OR resource ID
proc GIFLoadResource, .lpGifInfo, .hInst, .lpName
begin
        push    esi edi ebx
        mov     esi, [.lpGifInfo]

        invoke  FindResource, [.hInst], [.lpName], RT_RCDATA
        test    eax,eax
        jz      .exit

        mov     ebx, eax

        invoke  LoadResource, [.hInst], eax
        test    eax, eax
        jz      .exit

        mov     [esi+TGifInfo.lpGIFData], eax

        invoke  SizeofResource, [.hInst], ebx
        test    eax, eax
        jz      .exit

        mov     [esi+TGifInfo.dwGIFDataSize], eax
        xor     eax, eax
        inc     eax

.exit:
        pop     ebx edi esi
        return
endp

;===============================================================================
;       GIFLoadFile
;===============================================================================
; Loads gif data from a file
; SHOULD CLEANUP POINTER AFTERWARDS (globalalloc)
proc GIFLoadFile, .lpGifInfo, .lpFile
.hFile  dd  ?
.bRead  dd  ?
begin
        mov     esi, [.lpGifInfo]

        stdcall FileOpen, [.lpFile]
        jc      .false

        mov     [.hFile], eax
        stdcall FileSeek, eax, 0, fsFromEnd
        jc      .closefalse

        mov     [esi+TGifInfo.dwGIFDataSize], eax

        stdcall GetMem, [esi+TGifInfo.dwGIFDataSize]
        jc      .closefalse

        mov     [esi+TGifInfo.lpGIFData], eax

        stdcall FileSeek, [.hFile], 0, fsFromBegin
        stdcall FileRead, [.hFile], [esi+TGifInfo.lpGIFData], [esi+TGifInfo.dwGIFDataSize]

.closefalse:
        pushf
        stdcall FileClose, [.hFile]
        xor             eax, eax
        popf
        cmc
        adc     eax, 0
        return

.false:
        xor     eax, eax
        return
endp



;===============================================================================
;       GIFCleanup
;===============================================================================
; Cleanup
;
proc GIFCleanup, .lpGifInfo
begin
        push    esi
        mov     esi, [.lpGifInfo]
        stdcall FreeMem, [esi+TGifInfo.lpLZWTable]
        pop     esi
        return
endp



;===============================================================================
;       GIFFillBitmapInfoStruct
;===============================================================================
;  Fills a bitmap info structure width the given properties or automatically
proc GIFFillBitmapInfoStruct, .lpGifInfo, .lpBIH
begin
        push    esi edi
        mov     esi, [.lpGifInfo]
        mov     edi, [.lpBIH]

        mov     [edi+ BITMAPINFOHEADER.biSize], sizeof.BITMAPINFOHEADER
        mov     eax, [esi+TGifInfo.dwImageHeight]
        mov     ecx, [esi+TGifInfo.dwImageWidth]
        neg     eax                                     ;negative because it outputs a top-down bitmap
        mov     [edi+BITMAPINFOHEADER.biWidth], ecx
        mov     [edi+BITMAPINFOHEADER.biHeight], eax

        mov     [edi+BITMAPINFOHEADER.biPlanes], 1
        mov     [edi+BITMAPINFOHEADER.biBitCount], 32
        xor     eax, eax
        mov     [edi+BITMAPINFOHEADER.biCompression], BI_RGB
        mov     [edi+BITMAPINFOHEADER.biSizeImage], eax
        mov     [edi+BITMAPINFOHEADER.biXPelsPerMeter], eax
        mov     [edi+BITMAPINFOHEADER.biYPelsPerMeter], eax
        mov     [edi+BITMAPINFOHEADER.biClrUsed], eax
        mov     [edi+BITMAPINFOHEADER.biClrImportant], eax

        pop     edi esi
        return
endp




;===============================================================================
;       GIFDecompress
;===============================================================================
; Decompresses the gif and outputs
; returns:
; 0  - color format not allowed
; 1  - success
; -1 - failed
proc GIFDecompress, .lpGifInfo
begin
        push    esi edi ebx

        mov     esi, [.lpGifInfo]
        mov     edi, [esi+TGifInfo.lpImageData]

        ; --- Initially, load 4 bytes ---
        mov     [esi+TGifInfo.CurrentBits], 0
        mov     [esi+TGifInfo.dbBitsAvailable], 0

        mov     ebx, 4
.while:
        stdcall LoadNextByte, esi
        dec     ebx
        jne     .while

        stdcall DECInitialize, esi
        stdcall DECDecodeGIF, [.lpGifInfo]

        xor     eax, eax
        inc     eax
        pop     ebx edi esi
        return

.qfalse:
        xor     eax, eax
        pop     ebx edi esi
        return
endp

;===============================================================================
;       DECDecodeGIF
;===============================================================================
; The actual decoder
;
proc DECDecodeGIF, .lpGifInfo
 .OldCode            dd ?
 .FirstCharOfOldCode db ?
 .FirstCharOfCode    db ?
 .dummyalign         dw ?
 .NrCodesToOutput    dd ?
begin
        push    esi edi ebx

        mov     esi, [.lpGifInfo]

        ; --- set counters ---
        mov     [esi+TGifInfo.PixelCounter], 0   ;0 codes outputted
        mov     eax, [esi+TGifInfo.dwImageWidth]
        mul     [esi+TGifInfo.dwImageHeight]
        mov     [.NrCodesToOutput], eax    ;this is an OUTPUT CODE counter, not nr of compressed codes

; LZW Decompression
;     [1] Initialize string table;
;     [2] get first code: <code>;
;     [3] output the string for <code> to the charstream;
;     [4] <old> = <code>;
;     [5] <code> <- next code in codestream;
;     [6] does <code> exist in the string table?
;      (yes: output the string for <code> to the charstream;            (A)
;            [...] <- translation for <old>;                            (B)
;            K <- first character of translation for <code>;            (C)
;            add [...]K to the string table;                            (D)
;                        <old> <- <code>;  )                            (E)
;      (no: [...] <- translation for <old>;                             (F)
;           K <- first character of [...];                              (G)
;           output [...]K to charstream and add it to string table;     (H)
;           <old> <- <code>                                             (I)
;      )
;     [7] go to [5];

.mainloop:
        mov     eax, [.NrCodesToOutput]
        cmp     eax, [esi+TGifInfo.PixelCounter]
        je      .endloop

        stdcall GetNextCode, esi                        ; [1] and [5]
        mov     ebx, eax
        cmp     ebx, [esi+TGifInfo.dwLZWClear]          ; Check for clearcode
        jne     .noclear

        stdcall DECResetLZW, esi                ; Reset LZW
        jmp     .mainloop

.noclear:
       cmp      [esi+TGifInfo.IsFirstCode], 1   ; Checks if steps [1]-[4] have to be done
       jne      .notfirst

       dec      [esi+TGifInfo.IsFirstCode]      ;[2]
       stdcall  DECOutputString, esi, ebx       ;[3]
       mov      [.FirstCharOfOldCode], al       ; saved for (G)
       mov      [.OldCode], ebx                 ;[4]
       jmp      .mainloop

.notfirst:
       cmp     [esi+TGifInfo.dwLZWTableCount], ebx  ; [6]   ; DECIsCodeInTable replacement
       jbe     .notintable

       stdcall  DECOutputString, esi, ebx           ;(B)
       mov      [.FirstCharOfCode], al              ;(C)
       mov      [.FirstCharOfOldCode], al           ; saved for (G)
       stdcall  DECAddToTable, esi, [.OldCode], eax ;(D)
       mov      [.OldCode], ebx
       jmp      .mainloop

.notintable:                                        ;(F)-(I)
       mov      al, [.FirstCharOfOldCode]           ; (G)
       stdcall  DECAddToTable, esi, [.OldCode], eax ;(H)
       stdcall  DECOutputString, esi, ebx           ;(H)
       mov      [.FirstCharOfOldCode], al           ; saved for (G)
       mov      [.OldCode], ebx
       jmp      .mainloop

.endloop:
       xor     eax, eax
       inc     eax
       pop     ebx edi esi
       return
endp


;===============================================================================
; DECAddToTable
;===============================================================================
; Adds an entry to the LZW Table
; The enry consists of a prefix and a suffix (size is calculated automatically)
; returns the code for the new entry
proc DECAddToTable, .lpGifInfo, .dwPrefix, .dbSuffix
begin
        push    esi edi ebx

        mov     esi, [.lpGifInfo]

        ; --- Check if enough space in the table left
        mov     ecx, [esi+TGifInfo.dwLZWTableSize]
        mov     ebx, [esi+TGifInfo.dwLZWTableCount]

        push    ebx
        shl     ebx, 2

        ; --- If no space left, make the table bigger:
        cmp     ebx, ecx
        jne     .sizeok

        shl     ecx, 1          ;Table size doubles
        mov     [esi+TGifInfo.dwLZWTableSize], ecx

        ; --- Reallocate memory ---
        stdcall ResizeMem, [esi+TGifInfo.lpLZWTable], ecx
        mov     [esi+TGifInfo.lpLZWTable], eax

.sizeok:
        ; --- Create pointer to first free entry ---
        add     ebx, [esi+TGifInfo.lpLZWTable]

        ; --- Find out the size of the string ---
        mov     eax, [.dwPrefix]
        shl     eax, 2
        add     eax, [esi+TGifInfo.lpLZWTable]
        mov     eax, [eax]
        shr     eax, 8
        and     eax, 0FFFh      ;eax now holds the size of the prefix string
        inc     eax

        ; --- Create the entry DWORD ---
        ; (see DECResetLZW for the format)
        mov     ecx, [.dwPrefix]
        shl     ecx, 20
        shl     eax, 8
        or      ecx, eax
        mov     eax, [.dbSuffix]
        and     eax, 0ffh
        or      ecx, eax

        ; --- Store entry ---
        mov     [ebx], ecx

        inc     [esi+TGifInfo.dwLZWTableCount]

        pop     ebx     ;get saved code of new entry

        mov     cl, [esi+TGifInfo.dbCurBitSize]
        xor     eax, eax
        inc     eax
        shl     eax, cl
        dec     eax
        cmp     eax, ebx
        jne     @f

        ;bitsize should be increased
        inc     [esi+TGifInfo.dbCurBitSize]   ;increase bitsize

@@:
        mov     eax, ebx
        pop     ebx edi esi
        return
endp


;===============================================================================
; DECOutputString
;===============================================================================
; Writes the string of dwCode to the output stream
; returns the first character of the string in al
;
proc DECOutputString, .lpGifInfo, .dwCode
.LastChar     db ?
begin
        push    esi edi ebx

        mov     esi, [.lpGifInfo]
        mov     edi, [esi+TGifInfo.lpLZWTable]  ; --- Set basepointer ---

        mov     eax, [.dwCode]                   ; --- Get entry ---

        mov     ebx, [edi+4*eax]                ; --- Get size of string ---
        shr     ebx, 8                          ; See the description of LZW table below.
        and     ebx, $0fff

; --- Output all codes backwards ---
        mov     edx, [esi+TGifInfo.PixelCounter]
        shl     edx, 2
        add     edx, [esi+TGifInfo.lpImageData]         ; edx is base pointer in the image data.

        add     [esi+TGifInfo.PixelCounter], ebx        ; update the pixel counter.
        dec     ebx                                     ; ebx is the counter and index in image data.

        mov     esi, [esi+TGifInfo.lpColorTable]        ; We don't need TGifInfo anymore.

.outloop:
        mov     eax, [edi+4*eax]
        mov     [.LastChar], al

; Get the color from the color table - esi points to 3 byte  palette array.
        movzx   ecx, al
        lea     ecx, [ecx+2*ecx]  ; = 3*ecx
        mov     ecx, [esi+ecx]
        bswap   ecx
        shr     ecx, 8

; Draw the pixel.
        mov     [edx+4*ebx], ecx

        shr     eax, 20         ; Get the prefix index in the LZW table.
        and     eax, $0fff

        dec     ebx
        jns     .outloop

        mov     al, [.LastChar]
        pop     ebx edi esi
        return
endp



;===============================================================================
; GetNextCode
;===============================================================================
; retrieves the next code from the compressed data stream and loads new bits
; if needed.
proc GetNextCode, .lpGifInfo
begin
        push    esi edi ebx

        mov     esi, [.lpGifInfo]
        mov     ebx, [esi+TGifInfo.CurrentBits]

        ; --- Create bitmask for current nr of bits ---
        mov     cl, [esi+TGifInfo.dbCurBitSize]
        xor     eax, eax
        inc     eax
        shl     eax, cl
        dec     eax

        ; --- AND ebx with bitmask ---
        and     ebx, eax

        ; --- Shift used bits ---
        mov     cl, [esi+TGifInfo.dbCurBitSize]
        shr     [esi+TGifInfo.CurrentBits], cl

        ; --- Decrease # of bits available ---
        sub     [esi+TGifInfo.dbBitsAvailable], cl

        ; --- Load as many bits as possible ---
.while:
        cmp     [esi+TGifInfo.dbBitsAvailable], 24
        ja      .endwhile
        stdcall LoadNextByte, esi
        jmp     .while

.endwhile:
        ; --- Return bits ---
        mov     eax, ebx
        pop     ebx edi esi
        return
endp


;===============================================================================
; LoadNextByte
;===============================================================================
; Loads the currentbits entry with new bits
;
proc LoadNextByte, .lpGifInfo
begin
        push    esi edi ebx
        mov     esi, [.lpGifInfo]

        ; --- Get next byte from datastream ---
        mov     edi, [esi+TGifInfo.lpCurrentByte]
        cmp     edi, -1
        jne     .notend

;end of data already reached
        xor     al, al  ;return 0 as padding
        jmp     .gotbyte

;End of subblock reached?
.notend:
        cmp      edi, [esi+TGifInfo.lpLastEOSB]
        jne      .noteosb

        xor      eax, eax
        mov      al, [edi]       ; new subblock size
        test     al,al
        jnz      .sizeok

        ; if size=0, end of data
        mov      [esi+TGifInfo.lpCurrentByte], -1 ;EOF indicator
        jmp      .gotbyte

.sizeok:
        inc      edi             ; new subblock with size al
        add      eax, edi
        mov      [esi+TGifInfo.lpLastEOSB], eax  ;set new end of subblock
        add      [esi+TGifInfo.lpCurrentByte], 2
        mov      al, [edi]
        jmp      .gotbyte

.noteosb:
        mov      al, [edi]                       ;get next byte
        inc      [esi+TGifInfo.lpCurrentByte]    ;increase for next read

        ; --- Got the new byte from the datasteam ---
.gotbyte:
        mov      cl, [esi+TGifInfo.dbBitsAvailable] ;Get nr of bits available
        mov      edx, [esi+TGifInfo.CurrentBits]    ;Get current bits
        and      eax, 0ffh                          ;eax = al
        shl      eax, cl                            ;Shift bits to right position
        or       edx, eax                           ;OR new bits with current bits
        mov      [esi+TGifInfo.CurrentBits], edx    ;Save bits
        add      [esi+TGifInfo.dbBitsAvailable], 8  ;Set new bits avaialble

        pop     ebx edi esi
        return
endp


;===============================================================================
;       DECInitialize
;===============================================================================
; Initializes the decoder (table for LZW etc)
;
proc DECInitialize, .lpGifInfo
begin
        push    esi edi

        mov     esi, [.lpGifInfo]
        mov     edi, [esi+TGifInfo.lpGIFImage]

        ; --- Get initial LZW code size ---
        mov     cl, [edi]
        inc     cl
        mov     [esi+TGifInfo.dbInitBitSize], cl

        ; --- Set current bit size to initial bitsize ---
        mov     [esi+TGifInfo.dbCurBitSize], cl

        ; --- Set size of LZW table ---

        cmp     cl, 8
        jae     @f    ;if initial code size is less than 8-bits,
        mov     cl, 8 ;set to 8-bits, if higher, don't change it
@@:
        ; Calculate size of codetable:
        xor     eax, eax
        inc     eax
        add     cl, 2           ; bitsize + 2
        shl     eax, cl         ; eax = 2 ^ (bitsize + 2) = 4 * (2^bitsize)
        mov     [esi+TGifInfo.dwLZWTableSize], eax

        ; --- Allocate memory for LZW Table and store pointer ---
        stdcall GetMem, eax
        mov     [esi+TGifInfo.lpLZWTable], eax

        ; --- Reset LZW ---
        stdcall DECResetLZW, esi

        xor     eax, eax
        inc     eax
        pop     edi esi
        return
endp



;===============================================================================
; DECResetLZW
;===============================================================================
; Resets the LZW Table and variables (this is the proper action for a clear
; code (CC) in data
proc DECResetLZW, .lpGifInfo
begin
        push    esi edi ebx
        mov     esi, [.lpGifInfo]

; The LZW table has the following format:
; An array of DWORDS represents an array of string entries
; One entry consists of a prefix code (which is an index to
; another entry that should prefix the entry), a string length,
; and the suffix byte (this byte should be added to the prefix
; to get the full string).
; DWORD:
; | AAAA AAAA | AAAA BBBB | BBBB BBBB | CCCC CCCC |
; ^                                               ^
; MSB                                           LSB
; AAAAAAAAAAAA:  12-bit index in the LZW Table that indicates the prefix
; BBBBBBBBBBBB:  12-bit length of the string
; CCCCCCCC    :   8-bit suffix byte

        ; --- reset LZW Table ---
        ; Reset bit size:

        mov     cl, [esi+TGifInfo.dbInitBitSize]
        mov     [esi+TGifInfo.dbCurBitSize], cl

        ; Get initial nr of entries
        ;mov            eax, [esi].ColorCount
        ;NOTE: THE LINE ABOVE WAS PREVIOUSLY USED TO GET THE NR OF ROOT ENTRIES
        ; THIS DIDN'T WORK BECAUSE 1-BIT GIF'S ARE FOR AN UNKNOWN REASON CODED
        ; AS 2-BIT GIFS, SO THE NR OF ROOT ENTRIES HAS TO BE DETERMINED FROM THE
        ; INITIAL BITSIZE
        dec     cl
        xor     eax, eax
        inc     eax
        shl     eax, cl         ; 2**codesize
        add     eax, 2
        mov     [esi+TGifInfo.dwLZWTableCount], eax
        mov     edx, [esi+TGifInfo.lpLZWTable]
        ; Fill first {2**codcesize+2} entries
        shl     eax, 2
        add     eax, edx
        xor     ecx, ecx
        inc     ch                      ;size of sting is set to 1

.fill:
        mov     [edx], ecx
        inc     cl
        add     edx, 4
        cmp     edx, eax
        jb      .fill

        ; --- set clear code ---
        mov     eax, [esi+TGifInfo.dwLZWTableCount]
        sub     eax, 2
        mov     [esi+TGifInfo.dwLZWClear], eax
        mov     [esi+TGifInfo.IsFirstCode], 1

        ;lpLZWTable             dd      ?   ; Pointer to LZW Table
        ;dwLZWTableSize         dd      ?   ; Current maximum size of table
        ;dwLZWTableCount        dd      ?   ; Current nr of entries in the LZW table
        ;dbCurBitSize           db      ?   ; Current LZW code size
        ;dbInitBitSize          db      ?   ; Initial LZW code size
        ;dwLZWClear             dd      ?   ; Value of LZW Clear code (CC)

        xor     eax, eax
        inc     eax
        pop     ebx edi esi
        return
endp



;===============================================================================
;       GIFLoadHeader
;===============================================================================
; Loads header and logical screen descriptor
;
proc GIFLoadHeader, .lpGifInfo
begin
        push    esi edi ebx
        mov     esi, [.lpGifInfo]

        ; --- EDI points to GIF Data, EBX is size of data ---
        mov     edi, [esi+TGifInfo.lpGIFData]
        mov     ebx, [esi+TGifInfo.dwGIFDataSize]

        cmp     ebx, 11
        jb      .failed ; ebx smaller than header & Logical screen descr. -> invalid GIF

        ; --- Check first 3 bytes ("GIF" signature) ---
        mov     eax, [edi]
        and     eax, $00ffffff
        cmp     eax, 'GIF'
        jne     .failed

        ; --- Copy version number ---
        lea     ecx, [esi+TGifInfo.GIFVersion]
        mov     ax, [edi+3]
        mov     [ecx], ax
        mov     al, [edi+5]
        mov     [ecx+2], al

        ; --- Copy logical screen sizes ---
        xor     eax, eax
        mov     ax, [edi+6]                     ;Get Logical screen width
        mov     [esi+TGifInfo.dwLSWidth], eax
        mov     ax, [edi+8]                     ;Get Logical screen width
        mov     [esi+TGifInfo.dwLSHeight], eax

        ; --- Set global color table flag and size ---
        mov     cl, [edi+10]
        mov     al, cl
        rol     al, 1
        and     al, 1
        mov     [esi+TGifInfo.fGlobalCTable], al
        and     cl, 111b
        mov     [esi+TGifInfo.dbGCTableSize], cl

        xor     eax, eax
        inc     eax
        pop     ebx edi esi
        return

.failed:
        xor     eax, eax
        pop     ebx edi esi
        return
endp



;===============================================================================
;       GIFInitalizeDecoder
;===============================================================================
; Initializes decoder
;
proc GIFInitalizeDecoder, .lpGifInfo
begin
        push    esi edi ebx
        mov     esi, [.lpGifInfo]

        ; --- EDI points to GIF Data, EBX to end of data ---
        mov     edi, [esi+TGifInfo.lpGIFData]
        mov     ebx, [esi+TGifInfo.dwGIFDataSize]
        add     ebx, edi

        add     edi, 13         ; skip header and local screen descriptor

        ; --- Get global color tablesize in bytes ---
        mov     cl, [esi+TGifInfo.dbGCTableSize]
        inc     cl
        xor     eax, eax
        inc     eax
        shl     eax, cl
        mov     ecx, eax
        shl     ecx, 1          ;--+--> ecx * 3
        add     ecx, eax        ;--+

        ; --- Skip global color table if available ---
        cmp     [esi+TGifInfo.fGlobalCTable], 0
        je      @f
        add     edi, ecx
@@:
        cmp     edi, ebx
        jae     .failed

        ; --- Search through the GIF blocks for the first graphic block ---
.scanloop:
        cmp     edi, ebx
        jae     .failed

        mov     al, [edi]
        cmp     al, EXTENSIONBLOCK
        jne     .maybe

        stdcall SkipExtension, edi, ebx
        mov     edi, eax
        jmp     .scanloop

.maybe:
        cmp     al, IMAGEDESCRIPTOR
        jne     .scanloop               ; BUG: loop forever on some circumstances...

        stdcall ProcessImageDescriptor, [.lpGifInfo], edi, ebx
        add     edi, 11
        stdcall SkipSubBlocks, edi

        xor     eax, eax
        inc     eax
.quit:
        pop     ebx edi esi
        return

.failed:
        xor     eax, eax
        jmp     .quit
endp



;===============================================================================
; ProcessImageDescriptor
;===============================================================================
; Processes an image desriptor block
proc ProcessImageDescriptor, .lpGifInfo, .lpStart, .lpEOF
begin
        push    esi edi
        mov     esi, [.lpGifInfo]

        mov     edx, [.lpStart]
        xor     eax, eax

        ; --- copy image width & height ---
        mov     ax, [edx+5]
        mov     [esi+TGifInfo.dwImageWidth], eax
        mov     ax, [edx+7]
        mov     [esi+TGifInfo.dwImageHeight], eax

        ; --- look for local color table ---
        mov     cl, [edx+9]
        mov     al, cl
        rol     cl, 1
        and     cl, 1
        mov     [esi+TGifInfo.fLocalCTable], cl
        and     al, 111b
        mov     [esi+TGifInfo.dbLCTableSize], al

        ; --- Find out which color table to use ---
        cmp     cl, 1
        jne     .setglobal

        ;local color table available
        ; --- Set color count ---
        mov     cl, [esi+TGifInfo.dbLCTableSize]
        inc     cl
        xor     eax, eax
        inc     eax
        shl     eax, cl
        mov     [esi+TGifInfo.ColorCount], eax
        ; --- Set color table pointer ---
        mov     eax, edx
        add     eax, 10 ;move to the local color table
        mov     [esi+TGifInfo.lpColorTable], eax
        jmp     .ctableok

.setglobal:
        ;no local color table, use global color table
        ; --- Set color count ---
        mov     cl, [esi+TGifInfo.dbGCTableSize]
        inc     cl
        xor     eax, eax
        inc     eax
        shl     eax, cl
        mov     [esi+TGifInfo.ColorCount], eax
        ; --- Set color table pointer ---
        mov     eax, [esi+TGifInfo.lpGIFData]
        add     eax, 13 ;move to the global color table (at offset 13 in file)
        mov     [esi+TGifInfo.lpColorTable], eax

.ctableok:
        ; --- Set pointer to real image data (table based image data)
        mov     eax, edx
        add     eax, 10                                 ;Skip image descriptor

        cmp     [esi+TGifInfo.fLocalCTable], 0
        je      .setptr

        mov     ecx, [esi+TGifInfo.ColorCount]   ;-+
        add     eax, ecx                         ; + add size of colortable
        shl     ecx, 1                           ; + (colorcount * 3)
        add     eax, ecx                         ;-+

.setptr:
        mov     [esi+TGifInfo.lpGIFImage], eax

        ; --- Set some pointers to initialize the decompressor
        inc     eax
        mov     [esi+TGifInfo.lpLastEOSB], eax
        mov     [esi+TGifInfo.lpCurrentByte], eax

        xor     eax, eax
        inc     eax
        pop     edi esi
        return
endp



;=====================================================================
; Skips an extension block that starts at lpStart. EOF is at lpEnd.
; returns pointer to the end of block + 1
; or 0 if failed
; esi points at TGifInfo structure.
proc SkipExtension, .lpStart, .lpEnd
begin
        ; --- Get type of extension ---
        mov     edx, [.lpStart]
        mov     al, [edx+1]

        ; --- Skip each type seperately ---
        cmp     al, GRAPHICCONTROLEXTENSTION
        jne     @f

        ; Get transparent color and flag.
        movzx   eax, byte [edx+3]
        and     eax, 1
        mov     [esi+TGifInfo.fTransparent], eax
        mov     al, [edx+6]
        mov     [esi+TGifInfo.iTrasparentColor], eax

        ; Graphic control extension, has a fixed size of 8 bytes
        add     edx, 8
        mov     eax, edx
        jmp     .endext

@@:
        cmp     al, COMMENTEXTENSION
        jne     @f

        ; Comment extension, consists of subblocks of text
        add     edx, 2  ;move to first subblock
        stdcall SkipSubBlocks, edx
        jmp     .endext

@@:
        cmp     al, PLAINTEXTEXTENSION
        jne     @f

        ; Plain text extension, 15 header bytes and subblocks follow
        add     edx, 15
        stdcall SkipSubBlocks, edx
        jmp     .endext

@@:
        cmp     al, APPLICATIONEXTENSION
        jne     .endext

        ; Application extension, 14 header bytes and subblocks follow
        add     edx, 14
        stdcall SkipSubBlocks, edx
.endext:
        return
endp


;===============================================================================
;       SkipSubBlocks
;===============================================================================
; Skips a sequence of subblocks until a block-terminator is found.
; returns a pointer to the end of the block + 1.
; lpStart points to the start of the subblocks
;
proc SkipSubBlocks, .lpStart
begin
        mov     eax, [.lpStart]
        xor     ecx, ecx
.skiploop:
        mov     cl, [eax]       ; get size of subblock
        test    cl, cl
        jz      .endloop   ; size=0 means terminator
        inc     eax
        add     eax, ecx        ; add size to pointer
        jmp     .skiploop

.endloop:
        inc     eax
        return
endp


DispSize 'GifLib', $ - GifLib

Changes to opendialog.asm.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
        jnz     .copyname

        pop     edi

.setstructure:
        xor     edx, edx
        mov     [.opn.lStructSize], sizeof.OPENFILENAME
        mov     eax, [hApplication]
        mov     [.opn.hwndOwner], eax
        mov     [.opn.hInstance], edx
        mov     eax, [.ptrFilter]
        mov     [.opn.lpstrFilter], eax
        mov     [.opn.lpstrCustomFilter], edx
        mov     [.opn.nFilterIndex], 1
        mov     [.opn.lpstrFile], edi
................................................................................
        jne     .errbox

        mov     [.opn.lpstrInitialDir], 0
        inc     [.errcnt]
        jmp     .retry

.errbox:
        invoke  MessageBox, [hApplication], cOpenDialogError, NULL, MB_ICONERROR or MB_OK
        jmp     .finish

@@:
; Get file(s) path.

        movzx   esi, [.opn.nFileOffset]
        add     esi, edi
................................................................................
        mov       edi, eax
        cmp       [.hFileName], 0
        je        @f
        stdcall   StrCopy, ebx, [.hFileName]
@@:
        xor     edx, edx
        mov     [.opn.lStructSize], sizeof.OPENFILENAME
        mov     eax, [hApplication]
        mov     [.opn.hwndOwner], eax
        mov     [.opn.hInstance], edx
        mov     eax, [.ptrFilter]
        mov     [.opn.lpstrFilter], eax
        mov     [.opn.lpstrCustomFilter], edx
        mov     [.opn.nFilterIndex], 1
        mov     [.opn.lpstrFile], edi







|







 







|







 







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
        jnz     .copyname

        pop     edi

.setstructure:
        xor     edx, edx
        mov     [.opn.lStructSize], sizeof.OPENFILENAME
        mov     eax, [hMainForm]
        mov     [.opn.hwndOwner], eax
        mov     [.opn.hInstance], edx
        mov     eax, [.ptrFilter]
        mov     [.opn.lpstrFilter], eax
        mov     [.opn.lpstrCustomFilter], edx
        mov     [.opn.nFilterIndex], 1
        mov     [.opn.lpstrFile], edi
................................................................................
        jne     .errbox

        mov     [.opn.lpstrInitialDir], 0
        inc     [.errcnt]
        jmp     .retry

.errbox:
        invoke  MessageBox, [hMainForm], cOpenDialogError, NULL, MB_ICONERROR or MB_OK
        jmp     .finish

@@:
; Get file(s) path.

        movzx   esi, [.opn.nFileOffset]
        add     esi, edi
................................................................................
        mov       edi, eax
        cmp       [.hFileName], 0
        je        @f
        stdcall   StrCopy, ebx, [.hFileName]
@@:
        xor     edx, edx
        mov     [.opn.lStructSize], sizeof.OPENFILENAME
        mov     eax, [hMainForm]
        mov     [.opn.hwndOwner], eax
        mov     [.opn.hInstance], edx
        mov     eax, [.ptrFilter]
        mov     [.opn.lpstrFilter], eax
        mov     [.opn.lpstrCustomFilter], edx
        mov     [.opn.nFilterIndex], 1
        mov     [.opn.lpstrFile], edi

Changes to resources/minimalistic.gif.

cannot compute difference between binary files

Changes to resources/resources.res.

cannot compute difference between binary files

Changes to resources/turtlemini.ico.

cannot compute difference between binary files