Hg:
enable newline normalization get revision number via `hg svn info` for svnrev.h ignore incremental/generated binary files (windows/VS at least) leave a comment if some files need native eol set in svnprops git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5637 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dacd557f57
commit
4a0c8fc0c9
|
@ -0,0 +1,22 @@
|
||||||
|
syntax:glob
|
||||||
|
Binary
|
||||||
|
*.obj
|
||||||
|
*.pdb
|
||||||
|
*.idb
|
||||||
|
*.ilk
|
||||||
|
*.pch
|
||||||
|
*.ncb
|
||||||
|
*.suo
|
||||||
|
*.vcproj.*.user
|
||||||
|
*/Win32/Release
|
||||||
|
*/Win32/Debug
|
||||||
|
*/x64/Release
|
||||||
|
*/x64/Debug
|
||||||
|
Source/Release
|
||||||
|
Source/Debug
|
||||||
|
BuildLog.htm
|
||||||
|
Source/Core/Common/Src/svnrev.h
|
||||||
|
Externals/wxWidgets/lib/vc_lib/msw
|
||||||
|
Externals/wxWidgets/lib/vc_lib/mswd
|
||||||
|
Externals/wxWidgets/lib/vc_lib/Win32
|
||||||
|
Externals/wxWidgets/lib/vc_lib/x64
|
|
@ -1,182 +1,182 @@
|
||||||
[Default]
|
[Default]
|
||||||
IRLeft = 266
|
IRLeft = 266
|
||||||
IRTop = 215
|
IRTop = 215
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 490
|
IRHeight = 490
|
||||||
[RSPE] # Wii Sports (NTSC)
|
[RSPE] # Wii Sports (NTSC)
|
||||||
IRLeft = 266
|
IRLeft = 266
|
||||||
IRTop = 215
|
IRTop = 215
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 490
|
IRHeight = 490
|
||||||
[RSPP] # Wii Sports (PAL)
|
[RSPP] # Wii Sports (PAL)
|
||||||
IRLeft = 266
|
IRLeft = 266
|
||||||
IRTop = 215
|
IRTop = 215
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 490
|
IRHeight = 490
|
||||||
[RMGE] # Mario Galaxy (NTSC)
|
[RMGE] # Mario Galaxy (NTSC)
|
||||||
IRLeft = 255
|
IRLeft = 255
|
||||||
IRTop = 278
|
IRTop = 278
|
||||||
IRWidth = 452
|
IRWidth = 452
|
||||||
IRHeight = 456
|
IRHeight = 456
|
||||||
[RMGP] # Mario Galaxy (PAL)
|
[RMGP] # Mario Galaxy (PAL)
|
||||||
IRLeft = 255
|
IRLeft = 255
|
||||||
IRTop = 278
|
IRTop = 278
|
||||||
IRWidth = 452
|
IRWidth = 452
|
||||||
IRHeight = 456
|
IRHeight = 456
|
||||||
[RMCE] # Mario Kart Wii (NTSC)
|
[RMCE] # Mario Kart Wii (NTSC)
|
||||||
IRLeft = 253
|
IRLeft = 253
|
||||||
IRTop = 272
|
IRTop = 272
|
||||||
IRWidth = 454
|
IRWidth = 454
|
||||||
IRHeight = 455
|
IRHeight = 455
|
||||||
[RMCP] # Mario Kart Wii (PAL)
|
[RMCP] # Mario Kart Wii (PAL)
|
||||||
IRLeft = 254
|
IRLeft = 254
|
||||||
IRTop = 278
|
IRTop = 278
|
||||||
IRWidth = 451
|
IRWidth = 451
|
||||||
IRHeight = 448
|
IRHeight = 448
|
||||||
[R7PE] # Punch Out (NTSC)
|
[R7PE] # Punch Out (NTSC)
|
||||||
IRLeft = 265
|
IRLeft = 265
|
||||||
IRTop = 289
|
IRTop = 289
|
||||||
IRWidth = 408
|
IRWidth = 408
|
||||||
IRHeight = 416
|
IRHeight = 416
|
||||||
[R7PP] # Punch Out (PAL)
|
[R7PP] # Punch Out (PAL)
|
||||||
IRLeft = 265
|
IRLeft = 265
|
||||||
IRTop = 289
|
IRTop = 289
|
||||||
IRWidth = 408
|
IRWidth = 408
|
||||||
IRHeight = 416
|
IRHeight = 416
|
||||||
[RZDE] # Zelda - Twilight Princess (NTSC)
|
[RZDE] # Zelda - Twilight Princess (NTSC)
|
||||||
IRLeft = 233
|
IRLeft = 233
|
||||||
IRTop = 181
|
IRTop = 181
|
||||||
IRWidth = 559
|
IRWidth = 559
|
||||||
IRHeight = 409
|
IRHeight = 409
|
||||||
[RZDP] # Zelda - Twilight Princess (PAL)
|
[RZDP] # Zelda - Twilight Princess (PAL)
|
||||||
IRLeft = 233
|
IRLeft = 233
|
||||||
IRTop = 181
|
IRTop = 181
|
||||||
IRWidth = 559
|
IRWidth = 559
|
||||||
IRHeight = 409
|
IRHeight = 409
|
||||||
[RM8E] # Mario Part 8 (NTSC)
|
[RM8E] # Mario Part 8 (NTSC)
|
||||||
IRLeft = 277
|
IRLeft = 277
|
||||||
IRTop = 273
|
IRTop = 273
|
||||||
IRWidth = 460
|
IRWidth = 460
|
||||||
IRHeight = 394
|
IRHeight = 394
|
||||||
[RM8P] # Mario Part 8 (PAL)
|
[RM8P] # Mario Part 8 (PAL)
|
||||||
IRLeft = 277
|
IRLeft = 277
|
||||||
IRTop = 273
|
IRTop = 273
|
||||||
IRWidth = 460
|
IRWidth = 460
|
||||||
IRHeight = 394
|
IRHeight = 394
|
||||||
[R8PE] # Super Paper Mario (NTSC)
|
[R8PE] # Super Paper Mario (NTSC)
|
||||||
IRLeft = 399
|
IRLeft = 399
|
||||||
IRTop = 373
|
IRTop = 373
|
||||||
IRWidth = 227
|
IRWidth = 227
|
||||||
IRHeight = 228
|
IRHeight = 228
|
||||||
[R8PP] # Super Paper Mario (PAL)
|
[R8PP] # Super Paper Mario (PAL)
|
||||||
IRLeft = 399
|
IRLeft = 399
|
||||||
IRTop = 373
|
IRTop = 373
|
||||||
IRWidth = 227
|
IRWidth = 227
|
||||||
IRHeight = 228
|
IRHeight = 228
|
||||||
[R4QP] # Mario Strikers (NTSC)
|
[R4QP] # Mario Strikers (NTSC)
|
||||||
IRLeft = 200
|
IRLeft = 200
|
||||||
IRTop = 54
|
IRTop = 54
|
||||||
IRWidth = 615
|
IRWidth = 615
|
||||||
IRHeight = 657
|
IRHeight = 657
|
||||||
[R4QP] # Mario Strikers (PAL)
|
[R4QP] # Mario Strikers (PAL)
|
||||||
IRLeft = 200
|
IRLeft = 200
|
||||||
IRTop = 54
|
IRTop = 54
|
||||||
IRWidth = 615
|
IRWidth = 615
|
||||||
IRHeight = 657
|
IRHeight = 657
|
||||||
[RBUE] # Resident Evil - The Umbrella Chronicles (NTSC)
|
[RBUE] # Resident Evil - The Umbrella Chronicles (NTSC)
|
||||||
IRLeft = 335
|
IRLeft = 335
|
||||||
IRTop = 351
|
IRTop = 351
|
||||||
IRWidth = 357
|
IRWidth = 357
|
||||||
IRHeight = 273
|
IRHeight = 273
|
||||||
[RBUP] # Resident Evil - The Umbrella Chronicles (PAL)
|
[RBUP] # Resident Evil - The Umbrella Chronicles (PAL)
|
||||||
IRLeft = 335
|
IRLeft = 335
|
||||||
IRTop = 351
|
IRTop = 351
|
||||||
IRWidth = 357
|
IRWidth = 357
|
||||||
IRHeight = 273
|
IRHeight = 273
|
||||||
[RB4E] # Resident Evil 4 (NTSC)
|
[RB4E] # Resident Evil 4 (NTSC)
|
||||||
IRLeft = 286
|
IRLeft = 286
|
||||||
IRTop = 256
|
IRTop = 256
|
||||||
IRWidth = 450
|
IRWidth = 450
|
||||||
IRHeight = 455
|
IRHeight = 455
|
||||||
[RB4P] # Resident Evil 4 (PAL)
|
[RB4P] # Resident Evil 4 (PAL)
|
||||||
IRLeft = 286
|
IRLeft = 286
|
||||||
IRTop = 256
|
IRTop = 256
|
||||||
IRWidth = 450
|
IRWidth = 450
|
||||||
IRHeight = 455
|
IRHeight = 455
|
||||||
[R3IJ] # Metroid Prime - Wii De Asobu (JAP)
|
[R3IJ] # Metroid Prime - Wii De Asobu (JAP)
|
||||||
IRLeft = 228
|
IRLeft = 228
|
||||||
IRTop = 112
|
IRTop = 112
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 577
|
IRHeight = 577
|
||||||
[RM3E] # Metroid Prime 3 (NTSC)
|
[RM3E] # Metroid Prime 3 (NTSC)
|
||||||
IRLeft = 258
|
IRLeft = 258
|
||||||
IRTop = 84
|
IRTop = 84
|
||||||
IRWidth = 489
|
IRWidth = 489
|
||||||
IRHeight = 613
|
IRHeight = 613
|
||||||
[RM3P] # Metroid Prime 3 (PAL)
|
[RM3P] # Metroid Prime 3 (PAL)
|
||||||
IRLeft = 258
|
IRLeft = 258
|
||||||
IRTop = 84
|
IRTop = 84
|
||||||
IRWidth = 489
|
IRWidth = 489
|
||||||
IRHeight = 613
|
IRHeight = 613
|
||||||
[RSUP] # Sports Party (NTSC)
|
[RSUP] # Sports Party (NTSC)
|
||||||
IRLeft = 391
|
IRLeft = 391
|
||||||
IRTop = 377
|
IRTop = 377
|
||||||
IRWidth = 241
|
IRWidth = 241
|
||||||
IRHeight = 225
|
IRHeight = 225
|
||||||
[RSUP] # Sports Party (PAL)
|
[RSUP] # Sports Party (PAL)
|
||||||
IRLeft = 391
|
IRLeft = 391
|
||||||
IRTop = 377
|
IRTop = 377
|
||||||
IRWidth = 241
|
IRWidth = 241
|
||||||
IRHeight = 225
|
IRHeight = 225
|
||||||
[RDZE] # Disaster - Day of Crisis (NTSC)
|
[RDZE] # Disaster - Day of Crisis (NTSC)
|
||||||
IRLeft = 253
|
IRLeft = 253
|
||||||
IRTop = 276
|
IRTop = 276
|
||||||
IRWidth = 453
|
IRWidth = 453
|
||||||
IRHeight = 421
|
IRHeight = 421
|
||||||
[RDZP] # Disaster - Day of Crisis (PAL)
|
[RDZP] # Disaster - Day of Crisis (PAL)
|
||||||
IRLeft = 253
|
IRLeft = 253
|
||||||
IRTop = 276
|
IRTop = 276
|
||||||
IRWidth = 453
|
IRWidth = 453
|
||||||
IRHeight = 421
|
IRHeight = 421
|
||||||
[R4QE] # Mario Strikers (NTSC)
|
[R4QE] # Mario Strikers (NTSC)
|
||||||
IRLeft = 266
|
IRLeft = 266
|
||||||
IRTop = 215
|
IRTop = 215
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 490
|
IRHeight = 490
|
||||||
[R4QP] # Mario Strikers (PAL)
|
[R4QP] # Mario Strikers (PAL)
|
||||||
IRLeft = 266
|
IRLeft = 266
|
||||||
IRTop = 215
|
IRTop = 215
|
||||||
IRWidth = 486
|
IRWidth = 486
|
||||||
IRHeight = 490
|
IRHeight = 490
|
||||||
[RPBE] # Pokemon Battle Revolution (NTSC)
|
[RPBE] # Pokemon Battle Revolution (NTSC)
|
||||||
IRLeft = 287
|
IRLeft = 287
|
||||||
IRTop = 261
|
IRTop = 261
|
||||||
IRWidth = 451
|
IRWidth = 451
|
||||||
IRHeight = 449
|
IRHeight = 449
|
||||||
[RPBP] # Pokemon Battle Revolution (PAL)
|
[RPBP] # Pokemon Battle Revolution (PAL)
|
||||||
IRLeft = 287
|
IRLeft = 287
|
||||||
IRTop = 261
|
IRTop = 261
|
||||||
IRWidth = 451
|
IRWidth = 451
|
||||||
IRHeight = 449
|
IRHeight = 449
|
||||||
[R2GJ] # Fragile: Sayonara Tsuki no Haikyo (JAP)
|
[R2GJ] # Fragile: Sayonara Tsuki no Haikyo (JAP)
|
||||||
IRLeft = 254
|
IRLeft = 254
|
||||||
IRTop = 280
|
IRTop = 280
|
||||||
IRWidth = 451
|
IRWidth = 451
|
||||||
IRHeight = 453
|
IRHeight = 453
|
||||||
[RFNE] # Wii Fit (NTSC)
|
[RFNE] # Wii Fit (NTSC)
|
||||||
[RFNP] # Wii Fit (PAL)
|
[RFNP] # Wii Fit (PAL)
|
||||||
[RSBE] # Super Smash Bros. Brawl (NTSC)
|
[RSBE] # Super Smash Bros. Brawl (NTSC)
|
||||||
[RSBP] # Super Smash Bros. Brawl (PAL)
|
[RSBP] # Super Smash Bros. Brawl (PAL)
|
||||||
[R3TE] # Top Spin 3 (NTSC)
|
[R3TE] # Top Spin 3 (NTSC)
|
||||||
[RSBP] # Top Spin 3 (PAL)
|
[RSBP] # Top Spin 3 (PAL)
|
||||||
[RLBE] # Lego Batman (NTSC)
|
[RLBE] # Lego Batman (NTSC)
|
||||||
[RLBP] # Lego Batman (PAL)
|
[RLBP] # Lego Batman (PAL)
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# These games don't use the IR Pointer at any time
|
# These games don't use the IR Pointer at any time
|
||||||
##########################################################################
|
##########################################################################
|
||||||
[RSRE] # Sonic and the Secret Rings (NTSC)
|
[RSRE] # Sonic and the Secret Rings (NTSC)
|
||||||
[RSRP] # Sonic and the Secret Rings (PAL)
|
[RSRP] # Sonic and the Secret Rings (PAL)
|
||||||
[RWLE] # Wario Land - Shake It (NTSC)
|
[RWLE] # Wario Land - Shake It (NTSC)
|
||||||
[RWLP] # Wario Land - Shake It (PAL)
|
[RWLP] # Wario Land - Shake It (PAL)
|
||||||
[RTNE] # Tenchu: Shadow Assassins (NTSC)
|
[RTNE] # Tenchu: Shadow Assassins (NTSC)
|
||||||
[RTNE] # Tenchu: Shadow Assassins (PAL)
|
[RTNE] # Tenchu: Shadow Assassins (PAL)
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
.text
|
.text
|
||||||
80003488 000000b8 80003488 0 __fill_mem
|
80003488 000000b8 80003488 0 __fill_mem
|
||||||
80003540 00000050 80003540 0 memcpy
|
80003540 00000050 80003540 0 memcpy
|
||||||
8006cff8 0000004c 8006cff8 0 .LoadQuantizers
|
8006cff8 0000004c 8006cff8 0 .LoadQuantizers
|
||||||
8006d044 0000002c 8006d044 0 .kill_infinites_helper
|
8006d044 0000002c 8006d044 0 .kill_infinites_helper
|
||||||
8006d070 00000018 8006d070 0 .kill_infinites
|
8006d070 00000018 8006d070 0 .kill_infinites
|
||||||
8006d088 0000002c 8006d088 0 .rsqrt
|
8006d088 0000002c 8006d088 0 .rsqrt
|
||||||
8006d0b4 00000034 8006d0b4 0 .sqrt_internal_fz
|
8006d0b4 00000034 8006d0b4 0 .sqrt_internal_fz
|
||||||
8006d0e8 00000030 8006d0e8 0 .rsqrt_internal_fz
|
8006d0e8 00000030 8006d0e8 0 .rsqrt_internal_fz
|
||||||
8006d118 00000070 8006d118 0 .sqrt_fz
|
8006d118 00000070 8006d118 0 .sqrt_fz
|
||||||
8006d188 00000030 8006d188 0 .wrapping_once_fp_lookup
|
8006d188 00000030 8006d188 0 .wrapping_once_fp_lookup
|
||||||
8006d1b8 00000064 8006d1b8 0 .weird2
|
8006d1b8 00000064 8006d1b8 0 .weird2
|
||||||
8006d1c4 00000058 8006d1c4 0 .into_weird2
|
8006d1c4 00000058 8006d1c4 0 .into_weird2
|
||||||
8006d21c 00000030 8006d21c 0 .lookup_some_float_in_table_with_neg_wrap
|
8006d21c 00000030 8006d21c 0 .lookup_some_float_in_table_with_neg_wrap
|
||||||
8006d24c 00000184 8006d24c 0 .atan2
|
8006d24c 00000184 8006d24c 0 .atan2
|
||||||
8006d3d0 0000009c 8006d3d0 0 .asin_fz
|
8006d3d0 0000009c 8006d3d0 0 .asin_fz
|
||||||
8006d46c 000000c8 8006d46c 0 .acos_fz
|
8006d46c 000000c8 8006d46c 0 .acos_fz
|
||||||
8006d534 00000070 8006d534 0 .evil_vec_cosine
|
8006d534 00000070 8006d534 0 .evil_vec_cosine
|
||||||
8006d5f0 00000078 8006d5f0 0 .evil_vec_setlength
|
8006d5f0 00000078 8006d5f0 0 .evil_vec_setlength
|
||||||
8006d668 00000094 8006d668 0 .evil_vec_something
|
8006d668 00000094 8006d668 0 .evil_vec_something
|
||||||
8006d6fc 0000005c 8006d6fc 0 .func
|
8006d6fc 0000005c 8006d6fc 0 .func
|
||||||
8006d784 0000002c 8006d784 0 .load_strange_matrix1
|
8006d784 0000002c 8006d784 0 .load_strange_matrix1
|
||||||
8006d7b0 0000002c 8006d7b0 0 .load_strange_matrix2
|
8006d7b0 0000002c 8006d7b0 0 .load_strange_matrix2
|
||||||
8006d7f4 0000003c 8006d7f4 0 .some_strange_destination
|
8006d7f4 0000003c 8006d7f4 0 .some_strange_destination
|
||||||
8006db30 00000044 8006db30 0 .push_matrix_3x3?
|
8006db30 00000044 8006db30 0 .push_matrix_3x3?
|
||||||
8006db74 00000038 8006db74 0 .write_top_3x3_matrix
|
8006db74 00000038 8006db74 0 .write_top_3x3_matrix
|
||||||
8006dbe4 0000003c 8006dbe4 0 .read_current_3x3_matrix
|
8006dbe4 0000003c 8006dbe4 0 .read_current_3x3_matrix
|
||||||
8006dc20 00000014 8006dc20 0 .pop_matrix_stack
|
8006dc20 00000014 8006dc20 0 .pop_matrix_stack
|
||||||
8006e424 00000074 8006e424 0 .weird_param_in_p1_p2
|
8006e424 00000074 8006e424 0 .weird_param_in_p1_p2
|
||||||
8006e978 000001d4 8006e978 0 zz_006e978_
|
8006e978 000001d4 8006e978 0 zz_006e978_
|
||||||
8006eb4c 000001c0 8006eb4c 0 zz_006eb4c_
|
8006eb4c 000001c0 8006eb4c 0 zz_006eb4c_
|
||||||
8006f6a8 000000cc 8006f6a8 0 .z_last_skum_function
|
8006f6a8 000000cc 8006f6a8 0 .z_last_skum_function
|
||||||
800798f0 000000ec 800798f0 0 __div2u
|
800798f0 000000ec 800798f0 0 __div2u
|
||||||
800799dc 00000138 800799dc 0 __div2i
|
800799dc 00000138 800799dc 0 __div2i
|
||||||
80079b14 000000e0 80079b14 0 __mod2u
|
80079b14 000000e0 80079b14 0 __mod2u
|
||||||
80079bf8 0000010c 80079bf8 0 __mod2i
|
80079bf8 0000010c 80079bf8 0 __mod2i
|
||||||
80079d04 00000024 80079d04 0 __shl2i
|
80079d04 00000024 80079d04 0 __shl2i
|
||||||
80079d28 00000024 80079d28 0 __shr2u
|
80079d28 00000024 80079d28 0 __shr2u
|
||||||
80079d4c 00000028 80079d4c 0 __shr2i
|
80079d4c 00000028 80079d4c 0 __shr2i
|
||||||
8008596c 00000310 8008596c 0 big_matrix_trickery
|
8008596c 00000310 8008596c 0 big_matrix_trickery
|
||||||
80088538 00000020 80088538 0 zz_0088538_
|
80088538 00000020 80088538 0 zz_0088538_
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
.text
|
.text
|
||||||
800031f0 0000001c 800031f0 0 load_sp_rtoc
|
800031f0 0000001c 800031f0 0 load_sp_rtoc
|
||||||
80007034 0000004c 80007034 0 .LoadQuantizers
|
80007034 0000004c 80007034 0 .LoadQuantizers
|
||||||
80007080 00000030 80007080 0 .LoadInfinitiesEtc
|
80007080 00000030 80007080 0 .LoadInfinitiesEtc
|
||||||
800070b0 00000038 800070b0 0 .rsqrt
|
800070b0 00000038 800070b0 0 .rsqrt
|
||||||
800070ec 00000040 800070ec 0 .sqrt_internal_needs_cr1
|
800070ec 00000040 800070ec 0 .sqrt_internal_needs_cr1
|
||||||
8000712c 00000040 8000712c 0 .rsqrt_internal_needs_cr1
|
8000712c 00000040 8000712c 0 .rsqrt_internal_needs_cr1
|
||||||
800071e0 00000030 800071e0 0 .wrapping_once_fp_lookup
|
800071e0 00000030 800071e0 0 .wrapping_once_fp_lookup
|
||||||
80007210 00000064 80007210 0 .weird2
|
80007210 00000064 80007210 0 .weird2
|
||||||
80007274 00000030 80007274 0 .lookup_some_float_in_table_with_neg_wrap
|
80007274 00000030 80007274 0 .lookup_some_float_in_table_with_neg_wrap
|
||||||
800072a4 00000180 800072a4 0 .atan2
|
800072a4 00000180 800072a4 0 .atan2
|
||||||
80007424 000000b8 80007424 0 .calls_sqrt
|
80007424 000000b8 80007424 0 .calls_sqrt
|
||||||
800074dc 0000005c 800074dc 0 .func
|
800074dc 0000005c 800074dc 0 .func
|
||||||
80007538 0000002c 80007538 0 .load_strange_matrix1
|
80007538 0000002c 80007538 0 .load_strange_matrix1
|
||||||
80007564 0000002c 80007564 0 .load_strange_matrix3
|
80007564 0000002c 80007564 0 .load_strange_matrix3
|
||||||
80007590 0000002c 80007590 0 .load_strange_matrix2
|
80007590 0000002c 80007590 0 .load_strange_matrix2
|
||||||
80007834 00000044 80007834 0 .push_matrix_3x3?
|
80007834 00000044 80007834 0 .push_matrix_3x3?
|
||||||
80007878 00000038 80007878 0 .read_top_3x3matrix
|
80007878 00000038 80007878 0 .read_top_3x3matrix
|
||||||
800078b0 00000038 800078b0 0 .write_top_3x3_matrix
|
800078b0 00000038 800078b0 0 .write_top_3x3_matrix
|
||||||
800078e8 0000003c 800078e8 0 .read_current_3x3_matrix
|
800078e8 0000003c 800078e8 0 .read_current_3x3_matrix
|
||||||
80007924 00000014 80007924 0 .pop_matrix_stack
|
80007924 00000014 80007924 0 .pop_matrix_stack
|
||||||
80007a50 00000170 80007a50 0 .mult_matrix?
|
80007a50 00000170 80007a50 0 .mult_matrix?
|
||||||
80007ecc 000000bc 80007ecc 0 .weird_vector_op_status_in_cr2
|
80007ecc 000000bc 80007ecc 0 .weird_vector_op_status_in_cr2
|
||||||
80007f88 00000074 80007f88 0 .weird_param_in_p1_p2
|
80007f88 00000074 80007f88 0 .weird_param_in_p1_p2
|
||||||
800080fc 00000078 800080fc 0 .evil_normalize
|
800080fc 00000078 800080fc 0 .evil_normalize
|
||||||
80008174 00000078 80008174 0 .evil_vec_setlength
|
80008174 00000078 80008174 0 .evil_vec_setlength
|
||||||
800081ec 00000070 800081ec 0 .evil_vec_cosine
|
800081ec 00000070 800081ec 0 .evil_vec_cosine
|
||||||
80008538 000000f0 80008538 0 .calls_evil1
|
80008538 000000f0 80008538 0 .calls_evil1
|
||||||
8000875c 00000088 8000875c 0 .another_caller
|
8000875c 00000088 8000875c 0 .another_caller
|
||||||
800087e4 0000008c 800087e4 0 .another_caller2
|
800087e4 0000008c 800087e4 0 .another_caller2
|
||||||
80008d30 000001b4 80008d30 0 .another_caller3
|
80008d30 000001b4 80008d30 0 .another_caller3
|
||||||
80036544 000001b4 80036544 0 .fctiwi_weird2
|
80036544 000001b4 80036544 0 .fctiwi_weird2
|
||||||
8003dd1c 00000110 8003dd1c 0 .fctwi_weird
|
8003dd1c 00000110 8003dd1c 0 .fctwi_weird
|
||||||
80043b48 000005bc 80043b48 0 .fctwi_weird3
|
80043b48 000005bc 80043b48 0 .fctwi_weird3
|
||||||
|
|
|
@ -1,224 +1,224 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
kernel void DecodeI4(global uchar *dst,
|
kernel void DecodeI4(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||||
int srcOffset = x + y * width / 8;
|
int srcOffset = x + y * width / 8;
|
||||||
for (int iy = 0; iy < 8; iy++)
|
for (int iy = 0; iy < 8; iy++)
|
||||||
{
|
{
|
||||||
uchar4 val = vload4(srcOffset, src);
|
uchar4 val = vload4(srcOffset, src);
|
||||||
uchar8 res;
|
uchar8 res;
|
||||||
res.even = (val >> (uchar4)4) & (uchar4)0x0F;
|
res.even = (val >> (uchar4)4) & (uchar4)0x0F;
|
||||||
res.odd = val & (uchar4)0x0F;
|
res.odd = val & (uchar4)0x0F;
|
||||||
res |= res << (uchar8)4;
|
res |= res << (uchar8)4;
|
||||||
vstore8(res, 0, dst + ((y + iy)*width + x));
|
vstore8(res, 0, dst + ((y + iy)*width + x));
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeI8(global uchar *dst,
|
kernel void DecodeI8(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
vstore8(vload8(srcOffset, src),
|
vstore8(vload8(srcOffset, src),
|
||||||
0, dst + ((y + iy)*width + x));
|
0, dst + ((y + iy)*width + x));
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeIA8(global uchar *dst,
|
kernel void DecodeIA8(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||||
int srcOffset = ((x * 4) + (y * width)) / 4;
|
int srcOffset = ((x * 4) + (y * width)) / 4;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
uchar8 val = vload8(srcOffset, src);
|
uchar8 val = vload8(srcOffset, src);
|
||||||
uchar8 res;
|
uchar8 res;
|
||||||
res.odd = val.even;
|
res.odd = val.even;
|
||||||
res.even = val.odd;
|
res.even = val.odd;
|
||||||
vstore8(res, 0, dst + ((y + iy)*width + x) * 2);
|
vstore8(res, 0, dst + ((y + iy)*width + x) * 2);
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeIA4(global uchar *dst,
|
kernel void DecodeIA4(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
uchar8 val = vload8(srcOffset, src);
|
uchar8 val = vload8(srcOffset, src);
|
||||||
uchar16 res;
|
uchar16 res;
|
||||||
res.odd = (val >> (uchar8)4) & (uchar8)0x0F;
|
res.odd = (val >> (uchar8)4) & (uchar8)0x0F;
|
||||||
res.even = val & (uchar8)0x0F;
|
res.even = val & (uchar8)0x0F;
|
||||||
res |= res << (uchar16)4;
|
res |= res << (uchar16)4;
|
||||||
vstore16(res, 0, dst + ((y + iy)*width + x) * 2);
|
vstore16(res, 0, dst + ((y + iy)*width + x) * 2);
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeRGBA8(global uchar *dst,
|
kernel void DecodeRGBA8(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||||
int srcOffset = (x * 2) + (y * width) / 2;
|
int srcOffset = (x * 2) + (y * width) / 2;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
uchar8 ar = vload8(srcOffset, src);
|
uchar8 ar = vload8(srcOffset, src);
|
||||||
uchar8 gb = vload8(srcOffset + 4, src);
|
uchar8 gb = vload8(srcOffset + 4, src);
|
||||||
uchar16 res;
|
uchar16 res;
|
||||||
res.even.even = gb.odd;
|
res.even.even = gb.odd;
|
||||||
res.even.odd = ar.odd;
|
res.even.odd = ar.odd;
|
||||||
res.odd.even = gb.even;
|
res.odd.even = gb.even;
|
||||||
res.odd.odd = ar.even;
|
res.odd.odd = ar.even;
|
||||||
vstore16(res, 0, dst + ((y + iy)*width + x) * 4);
|
vstore16(res, 0, dst + ((y + iy)*width + x) * 4);
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeRGB565(global ushort *dst,
|
kernel void DecodeRGB565(global ushort *dst,
|
||||||
const global ushort *src, int width)
|
const global ushort *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||||
int srcOffset = x + (y * width) / 4;
|
int srcOffset = x + (y * width) / 4;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
ushort4 val = vload4(srcOffset, src);
|
ushort4 val = vload4(srcOffset, src);
|
||||||
val = (val >> (ushort4)8) | (val << (ushort4)8);
|
val = (val >> (ushort4)8) | (val << (ushort4)8);
|
||||||
vstore4(val, 0, dst + ((y + iy)*width + x));
|
vstore4(val, 0, dst + ((y + iy)*width + x));
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeRGB5A3(global uchar *dst,
|
kernel void DecodeRGB5A3(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||||
int srcOffset = x + (y * width) / 4;
|
int srcOffset = x + (y * width) / 4;
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
ushort8 val = convert_ushort8(vload8(srcOffset, src));
|
ushort8 val = convert_ushort8(vload8(srcOffset, src));
|
||||||
ushort4 vs = val.odd | (ushort4)(val.even << (ushort4)8);
|
ushort4 vs = val.odd | (ushort4)(val.even << (ushort4)8);
|
||||||
|
|
||||||
uchar16 resNoAlpha;
|
uchar16 resNoAlpha;
|
||||||
resNoAlpha.s26AE = convert_uchar4(vs >> (ushort4)7); // R
|
resNoAlpha.s26AE = convert_uchar4(vs >> (ushort4)7); // R
|
||||||
resNoAlpha.s159D = convert_uchar4(vs >> (ushort4)2); // G
|
resNoAlpha.s159D = convert_uchar4(vs >> (ushort4)2); // G
|
||||||
resNoAlpha.s048C = convert_uchar4(vs << (ushort4)3); // B
|
resNoAlpha.s048C = convert_uchar4(vs << (ushort4)3); // B
|
||||||
resNoAlpha &= (uchar16)0xF8;
|
resNoAlpha &= (uchar16)0xF8;
|
||||||
resNoAlpha |= (uchar16)(resNoAlpha >> (uchar16)5) & (uchar16)3; // 5 -> 8
|
resNoAlpha |= (uchar16)(resNoAlpha >> (uchar16)5) & (uchar16)3; // 5 -> 8
|
||||||
resNoAlpha.s37BF = (uchar4)(0xFF);
|
resNoAlpha.s37BF = (uchar4)(0xFF);
|
||||||
|
|
||||||
uchar16 resAlpha;
|
uchar16 resAlpha;
|
||||||
resAlpha.s26AE = convert_uchar4(vs >> (ushort4)8); // R
|
resAlpha.s26AE = convert_uchar4(vs >> (ushort4)8); // R
|
||||||
resAlpha.s159D = convert_uchar4(vs >> (ushort4)4); // G
|
resAlpha.s159D = convert_uchar4(vs >> (ushort4)4); // G
|
||||||
resAlpha.s048C = convert_uchar4(vs); // B
|
resAlpha.s048C = convert_uchar4(vs); // B
|
||||||
resAlpha &= (uchar16)0x0F;
|
resAlpha &= (uchar16)0x0F;
|
||||||
resAlpha |= (resAlpha << (uchar16)4);
|
resAlpha |= (resAlpha << (uchar16)4);
|
||||||
resAlpha.s37BF = convert_uchar4(vs >> (ushort4)7) & (uchar4)0xE0;
|
resAlpha.s37BF = convert_uchar4(vs >> (ushort4)7) & (uchar4)0xE0;
|
||||||
resAlpha.s37BF |= ((resAlpha.s37BF >> (uchar4)3) & (uchar4)0x1C)
|
resAlpha.s37BF |= ((resAlpha.s37BF >> (uchar4)3) & (uchar4)0x1C)
|
||||||
| ((resAlpha.s37BF >> (uchar4)6) & (uchar4)0x3);
|
| ((resAlpha.s37BF >> (uchar4)6) & (uchar4)0x3);
|
||||||
uchar16 choice = (uchar16)((uchar4)(vs.s0 >> 8),
|
uchar16 choice = (uchar16)((uchar4)(vs.s0 >> 8),
|
||||||
(uchar4)(vs.s1 >> 8),
|
(uchar4)(vs.s1 >> 8),
|
||||||
(uchar4)(vs.s2 >> 8),
|
(uchar4)(vs.s2 >> 8),
|
||||||
(uchar4)(vs.s3 >> 8));
|
(uchar4)(vs.s3 >> 8));
|
||||||
uchar16 res;
|
uchar16 res;
|
||||||
res = select(resAlpha, resNoAlpha, choice);
|
res = select(resAlpha, resNoAlpha, choice);
|
||||||
vstore16(res, 0, dst + ((y + iy) * width + x) * 4);
|
vstore16(res, 0, dst + ((y + iy) * width + x) * 4);
|
||||||
srcOffset++;
|
srcOffset++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint4 unpack2bits(uchar b)
|
uint4 unpack2bits(uchar b)
|
||||||
{
|
{
|
||||||
return (uint4)(b >> 6,
|
return (uint4)(b >> 6,
|
||||||
(b >> 4) & 3,
|
(b >> 4) & 3,
|
||||||
(b >> 2) & 3,
|
(b >> 2) & 3,
|
||||||
b & 3);
|
b & 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void decodeCMPRBlock(global uchar *dst,
|
kernel void decodeCMPRBlock(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||||
uchar8 val = vload8(0, src);
|
uchar8 val = vload8(0, src);
|
||||||
ushort2 color565 = (ushort2)((val.s1 & 0xFF) | (val.s0 << 8), (val.s3 & 0xFF) | (val.s2 << 8));
|
ushort2 color565 = (ushort2)((val.s1 & 0xFF) | (val.s0 << 8), (val.s3 & 0xFF) | (val.s2 << 8));
|
||||||
uchar8 color32 = convert_uchar8((ushort8)
|
uchar8 color32 = convert_uchar8((ushort8)
|
||||||
(((color565 << (ushort2)3) & (ushort2)0xF8) | ((color565 >> (ushort2)2) & (ushort2)0x7),
|
(((color565 << (ushort2)3) & (ushort2)0xF8) | ((color565 >> (ushort2)2) & (ushort2)0x7),
|
||||||
((color565 >> (ushort2)3) & (ushort2)0xFC) | ((color565 >> (ushort2)9) & (ushort2)0x3),
|
((color565 >> (ushort2)3) & (ushort2)0xFC) | ((color565 >> (ushort2)9) & (ushort2)0x3),
|
||||||
((color565 >> (ushort2)8) & (ushort2)0xF8) | ((color565 >> (ushort2)13) & (ushort2)0x7),
|
((color565 >> (ushort2)8) & (ushort2)0xF8) | ((color565 >> (ushort2)13) & (ushort2)0x7),
|
||||||
0xFF, 0xFF));
|
0xFF, 0xFF));
|
||||||
uint4 colors;
|
uint4 colors;
|
||||||
uint4 colorNoAlpha;
|
uint4 colorNoAlpha;
|
||||||
uchar4 frac = convert_uchar4((((convert_ushort4(color32.even) & (ushort4)0xFF) - (convert_ushort4(color32.odd) & (ushort4)0xFF)) * (ushort4)3) / (ushort4)8);
|
uchar4 frac = convert_uchar4((((convert_ushort4(color32.even) & (ushort4)0xFF) - (convert_ushort4(color32.odd) & (ushort4)0xFF)) * (ushort4)3) / (ushort4)8);
|
||||||
colorNoAlpha = convert_uint4(color32.odd + frac);
|
colorNoAlpha = convert_uint4(color32.odd + frac);
|
||||||
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.even - frac);
|
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.even - frac);
|
||||||
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.odd);
|
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.odd);
|
||||||
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.even);
|
colorNoAlpha = (colorNoAlpha << (uint4)8) | convert_uint4(color32.even);
|
||||||
|
|
||||||
uint4 colorAlpha;
|
uint4 colorAlpha;
|
||||||
uchar4 midpoint = convert_uchar4((convert_ushort4(color32.odd) + convert_ushort4(color32.even) + (ushort4)1) / (ushort4)2);
|
uchar4 midpoint = convert_uchar4((convert_ushort4(color32.odd) + convert_ushort4(color32.even) + (ushort4)1) / (ushort4)2);
|
||||||
midpoint.s3 = 0xFF;
|
midpoint.s3 = 0xFF;
|
||||||
colorAlpha = convert_uint4((uchar4)(0, 0, 0, 0));
|
colorAlpha = convert_uint4((uchar4)(0, 0, 0, 0));
|
||||||
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(midpoint);
|
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(midpoint);
|
||||||
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(color32.odd);
|
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(color32.odd);
|
||||||
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(color32.even);
|
colorAlpha = (colorAlpha << (uint4)8) | convert_uint4(color32.even);
|
||||||
|
|
||||||
colors = color565.s0 > color565.s1 ? colorNoAlpha : colorAlpha;
|
colors = color565.s0 > color565.s1 ? colorNoAlpha : colorAlpha;
|
||||||
|
|
||||||
uint16 colorsFull = (uint16)(colors, colors, colors, colors);
|
uint16 colorsFull = (uint16)(colors, colors, colors, colors);
|
||||||
|
|
||||||
uint4 shift0 = unpack2bits(val.s4);
|
uint4 shift0 = unpack2bits(val.s4);
|
||||||
uint4 shift1 = unpack2bits(val.s5);
|
uint4 shift1 = unpack2bits(val.s5);
|
||||||
uint4 shift2 = unpack2bits(val.s6);
|
uint4 shift2 = unpack2bits(val.s6);
|
||||||
uint4 shift3 = unpack2bits(val.s7);
|
uint4 shift3 = unpack2bits(val.s7);
|
||||||
uint16 shifts = (uint16)((uint4)(shift3.s0), (uint4)(shift3.s1), (uint4)(shift3.s2), (uint4)(shift3.s3));
|
uint16 shifts = (uint16)((uint4)(shift3.s0), (uint4)(shift3.s1), (uint4)(shift3.s2), (uint4)(shift3.s3));
|
||||||
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift2.s0), (uint4)(shift2.s1), (uint4)(shift2.s2), (uint4)(shift2.s3));
|
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift2.s0), (uint4)(shift2.s1), (uint4)(shift2.s2), (uint4)(shift2.s3));
|
||||||
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift1.s0), (uint4)(shift1.s1), (uint4)(shift1.s2), (uint4)(shift1.s3));
|
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift1.s0), (uint4)(shift1.s1), (uint4)(shift1.s2), (uint4)(shift1.s3));
|
||||||
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift0.s0), (uint4)(shift0.s1), (uint4)(shift0.s2), (uint4)(shift0.s3)) << (uint16)3;
|
shifts = (shifts << (uint16)8) | (uint16)((uint4)(shift0.s0), (uint4)(shift0.s1), (uint4)(shift0.s2), (uint4)(shift0.s3)) << (uint16)3;
|
||||||
|
|
||||||
for (int iy = 0; iy < 4; iy++)
|
for (int iy = 0; iy < 4; iy++)
|
||||||
{
|
{
|
||||||
uchar16 res;
|
uchar16 res;
|
||||||
res = convert_uchar16(colorsFull >> (shifts & (uint16)0xFF)) >> (uchar16)8;
|
res = convert_uchar16(colorsFull >> (shifts & (uint16)0xFF)) >> (uchar16)8;
|
||||||
vstore16(res, 0, dst);
|
vstore16(res, 0, dst);
|
||||||
dst += width * 4;
|
dst += width * 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel void DecodeCMPR(global uchar *dst,
|
kernel void DecodeCMPR(global uchar *dst,
|
||||||
const global uchar *src, int width)
|
const global uchar *src, int width)
|
||||||
{
|
{
|
||||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||||
|
|
||||||
src += x * 4 + (y * width) / 2;
|
src += x * 4 + (y * width) / 2;
|
||||||
|
|
||||||
decodeCMPRBlock(dst + (y * width + x) * 4, src, width);
|
decodeCMPRBlock(dst + (y * width + x) * 4, src, width);
|
||||||
src += 8;
|
src += 8;
|
||||||
decodeCMPRBlock(dst + (y * width + x + 4) * 4, src, width);
|
decodeCMPRBlock(dst + (y * width + x + 4) * 4, src, width);
|
||||||
src += 8;
|
src += 8;
|
||||||
decodeCMPRBlock(dst + ((y + 4) * width + x) * 4, src, width);
|
decodeCMPRBlock(dst + ((y + 4) * width + x) * 4, src, width);
|
||||||
src += 8;
|
src += 8;
|
||||||
decodeCMPRBlock(dst + ((y + 4) * width + x + 4) * 4, src, width);
|
decodeCMPRBlock(dst + ((y + 4) * width + x + 4) * 4, src, width);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,317 +1,317 @@
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2010, NVIDIA Corporation.
|
* Copyright (c) 2002-2010, NVIDIA Corporation.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
|
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
|
||||||
* of your agreement to the following terms, and your use, installation,
|
* of your agreement to the following terms, and your use, installation,
|
||||||
* modification or redistribution of this NVIDIA software constitutes
|
* modification or redistribution of this NVIDIA software constitutes
|
||||||
* acceptance of these terms. If you do not agree with these terms, please do
|
* acceptance of these terms. If you do not agree with these terms, please do
|
||||||
* not use, install, modify or redistribute this NVIDIA software.
|
* not use, install, modify or redistribute this NVIDIA software.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* In consideration of your agreement to abide by the following terms, and
|
* In consideration of your agreement to abide by the following terms, and
|
||||||
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
|
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
|
||||||
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
|
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
|
||||||
* Software"), to use, reproduce, modify and redistribute the NVIDIA
|
* Software"), to use, reproduce, modify and redistribute the NVIDIA
|
||||||
* Software, with or without modifications, in source and/or binary forms;
|
* Software, with or without modifications, in source and/or binary forms;
|
||||||
* provided that if you redistribute the NVIDIA Software, you must retain the
|
* provided that if you redistribute the NVIDIA Software, you must retain the
|
||||||
* copyright notice of NVIDIA, this notice and the following text and
|
* copyright notice of NVIDIA, this notice and the following text and
|
||||||
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
|
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
|
||||||
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
|
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
|
||||||
* to endorse or promote products derived from the NVIDIA Software without
|
* to endorse or promote products derived from the NVIDIA Software without
|
||||||
* specific prior written permission from NVIDIA. Except as expressly stated
|
* specific prior written permission from NVIDIA. Except as expressly stated
|
||||||
* in this notice, no other rights or licenses express or implied, are granted
|
* in this notice, no other rights or licenses express or implied, are granted
|
||||||
* by NVIDIA herein, including but not limited to any patent rights that may be
|
* by NVIDIA herein, including but not limited to any patent rights that may be
|
||||||
* infringed by your derivative works or by other works in which the NVIDIA
|
* infringed by your derivative works or by other works in which the NVIDIA
|
||||||
* Software may be incorporated. No hardware is licensed hereunder.
|
* Software may be incorporated. No hardware is licensed hereunder.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
||||||
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
|
||||||
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
|
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
|
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
|
||||||
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
|
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
|
||||||
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
|
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
|
||||||
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
|
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
|
||||||
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
|
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
|
||||||
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
|
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
|
||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef CGD3D9_INCLUDED
|
#ifndef CGD3D9_INCLUDED
|
||||||
#define CGD3D9_INCLUDED
|
#define CGD3D9_INCLUDED
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cg.h"
|
#include "cg.h"
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
#include <d3dx9.h>
|
#include <d3dx9.h>
|
||||||
|
|
||||||
// Set up for either Win32 import/export/lib.
|
// Set up for either Win32 import/export/lib.
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifdef CGD3D9DLL_EXPORTS
|
#ifdef CGD3D9DLL_EXPORTS
|
||||||
#define CGD3D9DLL_API __declspec(dllexport)
|
#define CGD3D9DLL_API __declspec(dllexport)
|
||||||
#elif defined (CG_LIB)
|
#elif defined (CG_LIB)
|
||||||
#define CGD3D9DLL_API
|
#define CGD3D9DLL_API
|
||||||
#else
|
#else
|
||||||
#define CGD3D9DLL_API __declspec(dllimport)
|
#define CGD3D9DLL_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CGD3D9ENTRY
|
#ifndef CGD3D9ENTRY
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
# define CGD3D9ENTRY __cdecl
|
# define CGD3D9ENTRY __cdecl
|
||||||
# else
|
# else
|
||||||
# define CGD3D9ENTRY
|
# define CGD3D9ENTRY
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
// CGerrors that will be fed to cgSetError
|
// CGerrors that will be fed to cgSetError
|
||||||
// Use cgD3D9TranslateCGerror() to translate these errors into strings.
|
// Use cgD3D9TranslateCGerror() to translate these errors into strings.
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
enum cgD3D9Errors
|
enum cgD3D9Errors
|
||||||
{
|
{
|
||||||
cgD3D9Failed = 1000,
|
cgD3D9Failed = 1000,
|
||||||
cgD3D9DebugTrace = 1001,
|
cgD3D9DebugTrace = 1001,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
// HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed
|
// HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed
|
||||||
// cgD3D9GetLastError will return an HRESULT that could be one these.
|
// cgD3D9GetLastError will return an HRESULT that could be one these.
|
||||||
// Use cgD3D9TranslateHRESULT() to translate these errors into strings.
|
// Use cgD3D9TranslateHRESULT() to translate these errors into strings.
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1);
|
static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1);
|
||||||
static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2);
|
static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2);
|
||||||
static const HRESULT CGD3D9ERR_NOTSAMPLER = MAKE_HRESULT(1, 0x877, 3);
|
static const HRESULT CGD3D9ERR_NOTSAMPLER = MAKE_HRESULT(1, 0x877, 3);
|
||||||
static const HRESULT CGD3D9ERR_INVALIDPROFILE = MAKE_HRESULT(1, 0x877, 4);
|
static const HRESULT CGD3D9ERR_INVALIDPROFILE = MAKE_HRESULT(1, 0x877, 4);
|
||||||
static const HRESULT CGD3D9ERR_NULLVALUE = MAKE_HRESULT(1, 0x877, 5);
|
static const HRESULT CGD3D9ERR_NULLVALUE = MAKE_HRESULT(1, 0x877, 5);
|
||||||
static const HRESULT CGD3D9ERR_OUTOFRANGE = MAKE_HRESULT(1, 0x877, 6);
|
static const HRESULT CGD3D9ERR_OUTOFRANGE = MAKE_HRESULT(1, 0x877, 6);
|
||||||
static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7);
|
static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7);
|
||||||
static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8);
|
static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8);
|
||||||
static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9);
|
static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
// Other error return values
|
// Other error return values
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
static const DWORD CGD3D9_INVALID_USAGE = 0xFF;
|
static const DWORD CGD3D9_INVALID_USAGE = 0xFF;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CGD3D9_EXPLICIT
|
#ifndef CGD3D9_EXPLICIT
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
// Minimal Interface
|
// Minimal Interface
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
CGD3D9DLL_API DWORD CGD3D9ENTRY
|
CGD3D9DLL_API DWORD CGD3D9ENTRY
|
||||||
cgD3D9TypeToSize(
|
cgD3D9TypeToSize(
|
||||||
CGtype type
|
CGtype type
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API BYTE CGD3D9ENTRY
|
CGD3D9DLL_API BYTE CGD3D9ENTRY
|
||||||
cgD3D9ResourceToDeclUsage(
|
cgD3D9ResourceToDeclUsage(
|
||||||
CGresource resource
|
CGresource resource
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9GetVertexDeclaration(
|
cgD3D9GetVertexDeclaration(
|
||||||
CGprogram prog,
|
CGprogram prog,
|
||||||
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH]
|
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH]
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9ValidateVertexDeclaration(
|
cgD3D9ValidateVertexDeclaration(
|
||||||
CGprogram prog,
|
CGprogram prog,
|
||||||
const D3DVERTEXELEMENT9* decl
|
const D3DVERTEXELEMENT9* decl
|
||||||
);
|
);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
// Expanded Interface
|
// Expanded Interface
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* ----- D3D Device Control ----------- */
|
/* ----- D3D Device Control ----------- */
|
||||||
CGD3D9DLL_API IDirect3DDevice9 * CGD3D9ENTRY
|
CGD3D9DLL_API IDirect3DDevice9 * CGD3D9ENTRY
|
||||||
cgD3D9GetDevice();
|
cgD3D9GetDevice();
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetDevice(
|
cgD3D9SetDevice(
|
||||||
IDirect3DDevice9* pDevice
|
IDirect3DDevice9* pDevice
|
||||||
);
|
);
|
||||||
|
|
||||||
/* ----- Shader Management ----------- */
|
/* ----- Shader Management ----------- */
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9LoadProgram(
|
cgD3D9LoadProgram(
|
||||||
CGprogram prog,
|
CGprogram prog,
|
||||||
CGbool paramShadowing,
|
CGbool paramShadowing,
|
||||||
DWORD assemFlags
|
DWORD assemFlags
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9UnloadProgram(
|
cgD3D9UnloadProgram(
|
||||||
CGprogram prog
|
CGprogram prog
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9IsProgramLoaded(
|
cgD3D9IsProgramLoaded(
|
||||||
CGprogram prog
|
CGprogram prog
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9BindProgram(
|
cgD3D9BindProgram(
|
||||||
CGprogram prog
|
CGprogram prog
|
||||||
);
|
);
|
||||||
|
|
||||||
/* ----- Parameter Management ----------- */
|
/* ----- Parameter Management ----------- */
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetUniform(
|
cgD3D9SetUniform(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
const void* floats
|
const void* floats
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetUniformArray(
|
cgD3D9SetUniformArray(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
DWORD offset,
|
DWORD offset,
|
||||||
DWORD numItems,
|
DWORD numItems,
|
||||||
const void* values
|
const void* values
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetUniformMatrix(
|
cgD3D9SetUniformMatrix(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
const D3DMATRIX* matrix
|
const D3DMATRIX* matrix
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetUniformMatrixArray(
|
cgD3D9SetUniformMatrixArray(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
DWORD offset,
|
DWORD offset,
|
||||||
DWORD numItems,
|
DWORD numItems,
|
||||||
const D3DMATRIX* matrices
|
const D3DMATRIX* matrices
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetTexture(
|
cgD3D9SetTexture(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
IDirect3DBaseTexture9* tex
|
IDirect3DBaseTexture9* tex
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetSamplerState(
|
cgD3D9SetSamplerState(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
D3DSAMPLERSTATETYPE type,
|
D3DSAMPLERSTATETYPE type,
|
||||||
DWORD value
|
DWORD value
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9SetTextureWrapMode(
|
cgD3D9SetTextureWrapMode(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
DWORD value
|
DWORD value
|
||||||
);
|
);
|
||||||
|
|
||||||
/* ----- Parameter Management (Shadowing) ----------- */
|
/* ----- Parameter Management (Shadowing) ----------- */
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9EnableParameterShadowing(
|
cgD3D9EnableParameterShadowing(
|
||||||
CGprogram prog,
|
CGprogram prog,
|
||||||
CGbool enable
|
CGbool enable
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9IsParameterShadowingEnabled(
|
cgD3D9IsParameterShadowingEnabled(
|
||||||
CGprogram prog
|
CGprogram prog
|
||||||
);
|
);
|
||||||
|
|
||||||
/* --------- Profile Options ----------------- */
|
/* --------- Profile Options ----------------- */
|
||||||
CGD3D9DLL_API CGprofile CGD3D9ENTRY
|
CGD3D9DLL_API CGprofile CGD3D9ENTRY
|
||||||
cgD3D9GetLatestVertexProfile();
|
cgD3D9GetLatestVertexProfile();
|
||||||
|
|
||||||
CGD3D9DLL_API CGprofile CGD3D9ENTRY
|
CGD3D9DLL_API CGprofile CGD3D9ENTRY
|
||||||
cgD3D9GetLatestPixelProfile();
|
cgD3D9GetLatestPixelProfile();
|
||||||
|
|
||||||
CGD3D9DLL_API const char * * CGD3D9ENTRY
|
CGD3D9DLL_API const char * * CGD3D9ENTRY
|
||||||
cgD3D9GetOptimalOptions(
|
cgD3D9GetOptimalOptions(
|
||||||
CGprofile profile
|
CGprofile profile
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9IsProfileSupported(
|
cgD3D9IsProfileSupported(
|
||||||
CGprofile profile
|
CGprofile profile
|
||||||
);
|
);
|
||||||
|
|
||||||
/* --------- Error reporting ----------------- */
|
/* --------- Error reporting ----------------- */
|
||||||
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
CGD3D9DLL_API HRESULT CGD3D9ENTRY
|
||||||
cgD3D9GetLastError();
|
cgD3D9GetLastError();
|
||||||
|
|
||||||
CGD3D9DLL_API const char * CGD3D9ENTRY
|
CGD3D9DLL_API const char * CGD3D9ENTRY
|
||||||
cgD3D9TranslateCGerror(
|
cgD3D9TranslateCGerror(
|
||||||
CGerror error
|
CGerror error
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API const char * CGD3D9ENTRY
|
CGD3D9DLL_API const char * CGD3D9ENTRY
|
||||||
cgD3D9TranslateHRESULT(
|
cgD3D9TranslateHRESULT(
|
||||||
HRESULT hr
|
HRESULT hr
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API void CGD3D9ENTRY
|
CGD3D9DLL_API void CGD3D9ENTRY
|
||||||
cgD3D9EnableDebugTracing(
|
cgD3D9EnableDebugTracing(
|
||||||
CGbool enable
|
CGbool enable
|
||||||
);
|
);
|
||||||
|
|
||||||
/* --------- CgFX support -------------------- */
|
/* --------- CgFX support -------------------- */
|
||||||
|
|
||||||
CGD3D9DLL_API void CGD3D9ENTRY
|
CGD3D9DLL_API void CGD3D9ENTRY
|
||||||
cgD3D9RegisterStates(
|
cgD3D9RegisterStates(
|
||||||
CGcontext ctx
|
CGcontext ctx
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API void CGD3D9ENTRY
|
CGD3D9DLL_API void CGD3D9ENTRY
|
||||||
cgD3D9SetManageTextureParameters(
|
cgD3D9SetManageTextureParameters(
|
||||||
CGcontext ctx,
|
CGcontext ctx,
|
||||||
CGbool flag
|
CGbool flag
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
CGD3D9DLL_API CGbool CGD3D9ENTRY
|
||||||
cgD3D9GetManageTextureParameters(
|
cgD3D9GetManageTextureParameters(
|
||||||
CGcontext ctx
|
CGcontext ctx
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API IDirect3DBaseTexture9 * CGD3D9ENTRY
|
CGD3D9DLL_API IDirect3DBaseTexture9 * CGD3D9ENTRY
|
||||||
cgD3D9GetTextureParameter(
|
cgD3D9GetTextureParameter(
|
||||||
CGparameter param
|
CGparameter param
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API void CGD3D9ENTRY
|
CGD3D9DLL_API void CGD3D9ENTRY
|
||||||
cgD3D9SetTextureParameter(
|
cgD3D9SetTextureParameter(
|
||||||
CGparameter param,
|
CGparameter param,
|
||||||
IDirect3DBaseTexture9 *tex
|
IDirect3DBaseTexture9 *tex
|
||||||
);
|
);
|
||||||
|
|
||||||
CGD3D9DLL_API void CGD3D9ENTRY
|
CGD3D9DLL_API void CGD3D9ENTRY
|
||||||
cgD3D9UnloadAllPrograms( void );
|
cgD3D9UnloadAllPrograms( void );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,111 +1,111 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef __MCM_H__
|
#ifndef __MCM_H__
|
||||||
#define __MCM_H__
|
#define __MCM_H__
|
||||||
|
|
||||||
#include "MemcardManager.h"
|
#include "MemcardManager.h"
|
||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
|
|
||||||
|
|
||||||
class CMemcardManagerDebug : public wxFrame
|
class CMemcardManagerDebug : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CMemcardManagerDebug(wxFrame* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
CMemcardManagerDebug(wxFrame* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||||
virtual ~CMemcardManagerDebug(){};
|
virtual ~CMemcardManagerDebug(){};
|
||||||
void updatePanels(GCMemcard ** memCard,int card);
|
void updatePanels(GCMemcard ** memCard,int card);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ID_NOTEBOOK_MAIN,
|
ID_NOTEBOOK_MAIN,
|
||||||
ID_TAB_HDR,
|
ID_TAB_HDR,
|
||||||
ID_TAB_DIR,
|
ID_TAB_DIR,
|
||||||
ID_TAB_DIR_B,
|
ID_TAB_DIR_B,
|
||||||
ID_TAB_BAT,
|
ID_TAB_BAT,
|
||||||
ID_TAB_BAT_B,
|
ID_TAB_BAT_B,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GCMemcard **memoryCard;
|
GCMemcard **memoryCard;
|
||||||
|
|
||||||
wxNotebook *m_Notebook_MCMD;
|
wxNotebook *m_Notebook_MCMD;
|
||||||
|
|
||||||
wxPanel *m_Tab_HDR,
|
wxPanel *m_Tab_HDR,
|
||||||
*m_Tab_DIR,
|
*m_Tab_DIR,
|
||||||
*m_Tab_DIR_b,
|
*m_Tab_DIR_b,
|
||||||
*m_Tab_BAT,
|
*m_Tab_BAT,
|
||||||
*m_Tab_BAT_b;
|
*m_Tab_BAT_b;
|
||||||
|
|
||||||
wxBoxSizer *sMain,
|
wxBoxSizer *sMain,
|
||||||
*sDebug,
|
*sDebug,
|
||||||
*sDebug2;
|
*sDebug2;
|
||||||
|
|
||||||
wxStaticText *t_HDR_ser[2],
|
wxStaticText *t_HDR_ser[2],
|
||||||
*t_HDR_fmtTime[2],
|
*t_HDR_fmtTime[2],
|
||||||
*t_HDR_SRAMBIAS[2],
|
*t_HDR_SRAMBIAS[2],
|
||||||
*t_HDR_SRAMLANG[2],
|
*t_HDR_SRAMLANG[2],
|
||||||
*t_HDR_Unk2[2],
|
*t_HDR_Unk2[2],
|
||||||
*t_HDR_devID[2],
|
*t_HDR_devID[2],
|
||||||
*t_HDR_Size[2],
|
*t_HDR_Size[2],
|
||||||
*t_HDR_Encoding[2],
|
*t_HDR_Encoding[2],
|
||||||
*t_HDR_UpdateCounter[2],
|
*t_HDR_UpdateCounter[2],
|
||||||
*t_HDR_CheckSum1[2],
|
*t_HDR_CheckSum1[2],
|
||||||
*t_HDR_CheckSum2[2],
|
*t_HDR_CheckSum2[2],
|
||||||
|
|
||||||
*t_DIR_UpdateCounter[2],
|
*t_DIR_UpdateCounter[2],
|
||||||
*t_DIR_CheckSum1[2],
|
*t_DIR_CheckSum1[2],
|
||||||
*t_DIR_CheckSum2[2],
|
*t_DIR_CheckSum2[2],
|
||||||
|
|
||||||
*t_DIR_b_UpdateCounter[2],
|
*t_DIR_b_UpdateCounter[2],
|
||||||
*t_DIR_b_CheckSum1[2],
|
*t_DIR_b_CheckSum1[2],
|
||||||
*t_DIR_b_CheckSum2[2],
|
*t_DIR_b_CheckSum2[2],
|
||||||
|
|
||||||
*t_BAT_CheckSum1[2],
|
*t_BAT_CheckSum1[2],
|
||||||
*t_BAT_CheckSum2[2],
|
*t_BAT_CheckSum2[2],
|
||||||
*t_BAT_UpdateCounter[2],
|
*t_BAT_UpdateCounter[2],
|
||||||
*t_BAT_FreeBlocks[2],
|
*t_BAT_FreeBlocks[2],
|
||||||
*t_BAT_LastAllocated[2],
|
*t_BAT_LastAllocated[2],
|
||||||
*t_BAT_map[256][2],
|
*t_BAT_map[256][2],
|
||||||
|
|
||||||
*t_BAT_b_CheckSum1[2],
|
*t_BAT_b_CheckSum1[2],
|
||||||
*t_BAT_b_CheckSum2[2],
|
*t_BAT_b_CheckSum2[2],
|
||||||
*t_BAT_b_UpdateCounter[2],
|
*t_BAT_b_UpdateCounter[2],
|
||||||
*t_BAT_b_FreeBlocks[2],
|
*t_BAT_b_FreeBlocks[2],
|
||||||
*t_BAT_b_LastAllocated[2];
|
*t_BAT_b_LastAllocated[2];
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
void Init_ChildControls();
|
void Init_ChildControls();
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
|
|
||||||
void Init_HDR();
|
void Init_HDR();
|
||||||
void Init_DIR();
|
void Init_DIR();
|
||||||
void Init_DIR_b();
|
void Init_DIR_b();
|
||||||
void Init_BAT();
|
void Init_BAT();
|
||||||
void Init_BAT_b();
|
void Init_BAT_b();
|
||||||
void updateHDRtab(int card);
|
void updateHDRtab(int card);
|
||||||
void updateDIRtab(int card);
|
void updateDIRtab(int card);
|
||||||
void updateDIRBtab(int card);
|
void updateDIRBtab(int card);
|
||||||
void updateBATtab(int card);
|
void updateBATtab(int card);
|
||||||
void updateBATBtab(int card);
|
void updateBATBtab(int card);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#ifndef _MCM__
|
#ifndef _MCM__
|
||||||
#define _MCM__
|
#define _MCM__
|
||||||
|
|
||||||
void __Log(int logNumber, const char* text, ...){logNumber; text;}
|
void __Log(int logNumber, const char* text, ...){logNumber; text;}
|
||||||
void __Logv(int log, int v, const char *format, ...){log; v; format;}
|
void __Logv(int log, int v, const char *format, ...){log; v; format;}
|
||||||
|
|
||||||
#include "MemcardManager.h"
|
#include "MemcardManager.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
class MCMApp
|
class MCMApp
|
||||||
: public wxApp
|
: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
#include "MCMmain.h"
|
#include "MCMmain.h"
|
||||||
|
|
||||||
IMPLEMENT_APP(MCMApp)
|
IMPLEMENT_APP(MCMApp)
|
||||||
|
|
||||||
CMemcardManager *main_frame;
|
CMemcardManager *main_frame;
|
||||||
|
|
||||||
#if defined HAVE_WX && HAVE_WX
|
#if defined HAVE_WX && HAVE_WX
|
||||||
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int Style)
|
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int Style)
|
||||||
{
|
{
|
||||||
return wxYES == wxMessageBox(wxString::FromAscii(text),
|
return wxYES == wxMessageBox(wxString::FromAscii(text),
|
||||||
wxString::FromAscii(caption),
|
wxString::FromAscii(caption),
|
||||||
(yes_no)?wxYES_NO:wxOK);
|
(yes_no)?wxYES_NO:wxOK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool MCMApp::OnInit()
|
bool MCMApp::OnInit()
|
||||||
{
|
{
|
||||||
// Register message box handler
|
// Register message box handler
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
RegisterMsgAlertHandler(&wxMsgAlert);
|
RegisterMsgAlertHandler(&wxMsgAlert);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
main_frame = new CMemcardManager((wxFrame*) NULL, wxID_ANY, wxString::FromAscii("Memcard Manager"),
|
main_frame = new CMemcardManager((wxFrame*) NULL, wxID_ANY, wxString::FromAscii("Memcard Manager"),
|
||||||
wxPoint(100, 100), wxSize(800, 600));
|
wxPoint(100, 100), wxSize(800, 600));
|
||||||
main_frame->Show();
|
main_frame->Show();
|
||||||
SetTopWindow(main_frame);
|
SetTopWindow(main_frame);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CEXIIPL::GetGCTime()
|
u32 CEXIIPL::GetGCTime()
|
||||||
{
|
{
|
||||||
const u32 cJanuary2000 = 0x386D42C0; // Seconds between 1.1.1970 and 1.1.2000
|
const u32 cJanuary2000 = 0x386D42C0; // Seconds between 1.1.1970 and 1.1.2000
|
||||||
u64 ltime = Common::Timer::GetLocalTimeSinceJan1970();
|
u64 ltime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||||
return ((u32)ltime - cJanuary2000);
|
return ((u32)ltime - cJanuary2000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,94 +1,94 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Main include header for the SDL library */
|
/* Main include header for the SDL library */
|
||||||
|
|
||||||
#ifndef _SDL_H
|
#ifndef _SDL_H
|
||||||
#define _SDL_H
|
#define _SDL_H
|
||||||
|
|
||||||
#include "SDL_main.h"
|
#include "SDL_main.h"
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_audio.h"
|
#include "SDL_audio.h"
|
||||||
#include "SDL_cdrom.h"
|
#include "SDL_cdrom.h"
|
||||||
#include "SDL_cpuinfo.h"
|
#include "SDL_cpuinfo.h"
|
||||||
#include "SDL_endian.h"
|
#include "SDL_endian.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_events.h"
|
#include "SDL_events.h"
|
||||||
#include "SDL_loadso.h"
|
#include "SDL_loadso.h"
|
||||||
#include "SDL_mutex.h"
|
#include "SDL_mutex.h"
|
||||||
#include "SDL_rwops.h"
|
#include "SDL_rwops.h"
|
||||||
#include "SDL_thread.h"
|
#include "SDL_thread.h"
|
||||||
#include "SDL_timer.h"
|
#include "SDL_timer.h"
|
||||||
#include "SDL_video.h"
|
#include "SDL_video.h"
|
||||||
#include "SDL_version.h"
|
#include "SDL_version.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||||
|
|
||||||
/* These are the flags which may be passed to SDL_Init() -- you should
|
/* These are the flags which may be passed to SDL_Init() -- you should
|
||||||
specify the subsystems which you will be using in your application.
|
specify the subsystems which you will be using in your application.
|
||||||
*/
|
*/
|
||||||
#define SDL_INIT_TIMER 0x00000001
|
#define SDL_INIT_TIMER 0x00000001
|
||||||
#define SDL_INIT_AUDIO 0x00000010
|
#define SDL_INIT_AUDIO 0x00000010
|
||||||
#define SDL_INIT_VIDEO 0x00000020
|
#define SDL_INIT_VIDEO 0x00000020
|
||||||
#define SDL_INIT_CDROM 0x00000100
|
#define SDL_INIT_CDROM 0x00000100
|
||||||
#define SDL_INIT_JOYSTICK 0x00000200
|
#define SDL_INIT_JOYSTICK 0x00000200
|
||||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
|
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
|
||||||
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
|
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
|
||||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
||||||
|
|
||||||
/* This function loads the SDL dynamically linked library and initializes
|
/* This function loads the SDL dynamically linked library and initializes
|
||||||
* the subsystems specified by 'flags' (and those satisfying dependencies)
|
* the subsystems specified by 'flags' (and those satisfying dependencies)
|
||||||
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
||||||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
|
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||||
|
|
||||||
/* This function initializes specific SDL subsystems */
|
/* This function initializes specific SDL subsystems */
|
||||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||||
|
|
||||||
/* This function cleans up specific SDL subsystems */
|
/* This function cleans up specific SDL subsystems */
|
||||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||||
|
|
||||||
/* This function returns mask of the specified subsystems which have
|
/* This function returns mask of the specified subsystems which have
|
||||||
been initialized.
|
been initialized.
|
||||||
If 'flags' is 0, it returns a mask of all initialized subsystems.
|
If 'flags' is 0, it returns a mask of all initialized subsystems.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||||
|
|
||||||
/* This function cleans up all initialized subsystems and unloads the
|
/* This function cleans up all initialized subsystems and unloads the
|
||||||
* dynamically linked library. You should call it upon all exit conditions.
|
* dynamically linked library. You should call it upon all exit conditions.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_H */
|
#endif /* _SDL_H */
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL application focus event handling */
|
/* Include file for SDL application focus event handling */
|
||||||
|
|
||||||
#ifndef _SDL_active_h
|
#ifndef _SDL_active_h
|
||||||
#define _SDL_active_h
|
#define _SDL_active_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The available application states */
|
/* The available application states */
|
||||||
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
|
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
|
||||||
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
|
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
|
||||||
#define SDL_APPACTIVE 0x04 /* The application is active */
|
#define SDL_APPACTIVE 0x04 /* The application is active */
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
/*
|
/*
|
||||||
* This function returns the current state of the application, which is a
|
* This function returns the current state of the application, which is a
|
||||||
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
|
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
|
||||||
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
|
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
|
||||||
* see your application, otherwise it has been iconified or disabled.
|
* see your application, otherwise it has been iconified or disabled.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
|
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_active_h */
|
#endif /* _SDL_active_h */
|
||||||
|
|
|
@ -1,253 +1,253 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Access to the raw audio mixing buffer for the SDL library */
|
/* Access to the raw audio mixing buffer for the SDL library */
|
||||||
|
|
||||||
#ifndef _SDL_audio_h
|
#ifndef _SDL_audio_h
|
||||||
#define _SDL_audio_h
|
#define _SDL_audio_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_endian.h"
|
#include "SDL_endian.h"
|
||||||
#include "SDL_mutex.h"
|
#include "SDL_mutex.h"
|
||||||
#include "SDL_thread.h"
|
#include "SDL_thread.h"
|
||||||
#include "SDL_rwops.h"
|
#include "SDL_rwops.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
|
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
|
||||||
typedef struct SDL_AudioSpec {
|
typedef struct SDL_AudioSpec {
|
||||||
int freq; /* DSP frequency -- samples per second */
|
int freq; /* DSP frequency -- samples per second */
|
||||||
Uint16 format; /* Audio data format */
|
Uint16 format; /* Audio data format */
|
||||||
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
|
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
|
||||||
Uint8 silence; /* Audio buffer silence value (calculated) */
|
Uint8 silence; /* Audio buffer silence value (calculated) */
|
||||||
Uint16 samples; /* Audio buffer size in samples (power of 2) */
|
Uint16 samples; /* Audio buffer size in samples (power of 2) */
|
||||||
Uint16 padding; /* Necessary for some compile environments */
|
Uint16 padding; /* Necessary for some compile environments */
|
||||||
Uint32 size; /* Audio buffer size in bytes (calculated) */
|
Uint32 size; /* Audio buffer size in bytes (calculated) */
|
||||||
/* This function is called when the audio device needs more data.
|
/* This function is called when the audio device needs more data.
|
||||||
'stream' is a pointer to the audio data buffer
|
'stream' is a pointer to the audio data buffer
|
||||||
'len' is the length of that buffer in bytes.
|
'len' is the length of that buffer in bytes.
|
||||||
Once the callback returns, the buffer will no longer be valid.
|
Once the callback returns, the buffer will no longer be valid.
|
||||||
Stereo samples are stored in a LRLRLR ordering.
|
Stereo samples are stored in a LRLRLR ordering.
|
||||||
*/
|
*/
|
||||||
void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
|
void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
|
||||||
void *userdata;
|
void *userdata;
|
||||||
} SDL_AudioSpec;
|
} SDL_AudioSpec;
|
||||||
|
|
||||||
/* Audio format flags (defaults to LSB byte order) */
|
/* Audio format flags (defaults to LSB byte order) */
|
||||||
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
|
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
|
||||||
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
|
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
|
||||||
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
|
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
|
||||||
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
|
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
|
||||||
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
|
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
|
||||||
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
|
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
|
||||||
#define AUDIO_U16 AUDIO_U16LSB
|
#define AUDIO_U16 AUDIO_U16LSB
|
||||||
#define AUDIO_S16 AUDIO_S16LSB
|
#define AUDIO_S16 AUDIO_S16LSB
|
||||||
|
|
||||||
/* Native audio byte ordering */
|
/* Native audio byte ordering */
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||||
#else
|
#else
|
||||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* A structure to hold a set of audio conversion filters and buffers */
|
/* A structure to hold a set of audio conversion filters and buffers */
|
||||||
typedef struct SDL_AudioCVT {
|
typedef struct SDL_AudioCVT {
|
||||||
int needed; /* Set to 1 if conversion possible */
|
int needed; /* Set to 1 if conversion possible */
|
||||||
Uint16 src_format; /* Source audio format */
|
Uint16 src_format; /* Source audio format */
|
||||||
Uint16 dst_format; /* Target audio format */
|
Uint16 dst_format; /* Target audio format */
|
||||||
double rate_incr; /* Rate conversion increment */
|
double rate_incr; /* Rate conversion increment */
|
||||||
Uint8 *buf; /* Buffer to hold entire audio data */
|
Uint8 *buf; /* Buffer to hold entire audio data */
|
||||||
int len; /* Length of original audio buffer */
|
int len; /* Length of original audio buffer */
|
||||||
int len_cvt; /* Length of converted audio buffer */
|
int len_cvt; /* Length of converted audio buffer */
|
||||||
int len_mult; /* buffer must be len*len_mult big */
|
int len_mult; /* buffer must be len*len_mult big */
|
||||||
double len_ratio; /* Given len, final size is len*len_ratio */
|
double len_ratio; /* Given len, final size is len*len_ratio */
|
||||||
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
|
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
|
||||||
int filter_index; /* Current audio conversion function */
|
int filter_index; /* Current audio conversion function */
|
||||||
} SDL_AudioCVT;
|
} SDL_AudioCVT;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/* These functions are used internally, and should not be used unless you
|
/* These functions are used internally, and should not be used unless you
|
||||||
* have a specific need to specify the audio driver you want to use.
|
* have a specific need to specify the audio driver you want to use.
|
||||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||||
|
|
||||||
/* This function fills the given character buffer with the name of the
|
/* This function fills the given character buffer with the name of the
|
||||||
* current audio driver, and returns a pointer to it if the audio driver has
|
* current audio driver, and returns a pointer to it if the audio driver has
|
||||||
* been initialized. It returns NULL if no driver has been initialized.
|
* been initialized. It returns NULL if no driver has been initialized.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function opens the audio device with the desired parameters, and
|
* This function opens the audio device with the desired parameters, and
|
||||||
* returns 0 if successful, placing the actual hardware parameters in the
|
* returns 0 if successful, placing the actual hardware parameters in the
|
||||||
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
|
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
|
||||||
* data passed to the callback function will be guaranteed to be in the
|
* data passed to the callback function will be guaranteed to be in the
|
||||||
* requested format, and will be automatically converted to the hardware
|
* requested format, and will be automatically converted to the hardware
|
||||||
* audio format if necessary. This function returns -1 if it failed
|
* audio format if necessary. This function returns -1 if it failed
|
||||||
* to open the audio device, or couldn't set up the audio thread.
|
* to open the audio device, or couldn't set up the audio thread.
|
||||||
*
|
*
|
||||||
* When filling in the desired audio spec structure,
|
* When filling in the desired audio spec structure,
|
||||||
* 'desired->freq' should be the desired audio frequency in samples-per-second.
|
* 'desired->freq' should be the desired audio frequency in samples-per-second.
|
||||||
* 'desired->format' should be the desired audio format.
|
* 'desired->format' should be the desired audio format.
|
||||||
* 'desired->samples' is the desired size of the audio buffer, in samples.
|
* 'desired->samples' is the desired size of the audio buffer, in samples.
|
||||||
* This number should be a power of two, and may be adjusted by the audio
|
* This number should be a power of two, and may be adjusted by the audio
|
||||||
* driver to a value more suitable for the hardware. Good values seem to
|
* driver to a value more suitable for the hardware. Good values seem to
|
||||||
* range between 512 and 8096 inclusive, depending on the application and
|
* range between 512 and 8096 inclusive, depending on the application and
|
||||||
* CPU speed. Smaller values yield faster response time, but can lead
|
* CPU speed. Smaller values yield faster response time, but can lead
|
||||||
* to underflow if the application is doing heavy processing and cannot
|
* to underflow if the application is doing heavy processing and cannot
|
||||||
* fill the audio buffer in time. A stereo sample consists of both right
|
* fill the audio buffer in time. A stereo sample consists of both right
|
||||||
* and left channels in LR ordering.
|
* and left channels in LR ordering.
|
||||||
* Note that the number of samples is directly related to time by the
|
* Note that the number of samples is directly related to time by the
|
||||||
* following formula: ms = (samples*1000)/freq
|
* following formula: ms = (samples*1000)/freq
|
||||||
* 'desired->size' is the size in bytes of the audio buffer, and is
|
* 'desired->size' is the size in bytes of the audio buffer, and is
|
||||||
* calculated by SDL_OpenAudio().
|
* calculated by SDL_OpenAudio().
|
||||||
* 'desired->silence' is the value used to set the buffer to silence,
|
* 'desired->silence' is the value used to set the buffer to silence,
|
||||||
* and is calculated by SDL_OpenAudio().
|
* and is calculated by SDL_OpenAudio().
|
||||||
* 'desired->callback' should be set to a function that will be called
|
* 'desired->callback' should be set to a function that will be called
|
||||||
* when the audio device is ready for more data. It is passed a pointer
|
* when the audio device is ready for more data. It is passed a pointer
|
||||||
* to the audio buffer, and the length in bytes of the audio buffer.
|
* to the audio buffer, and the length in bytes of the audio buffer.
|
||||||
* This function usually runs in a separate thread, and so you should
|
* This function usually runs in a separate thread, and so you should
|
||||||
* protect data structures that it accesses by calling SDL_LockAudio()
|
* protect data structures that it accesses by calling SDL_LockAudio()
|
||||||
* and SDL_UnlockAudio() in your code.
|
* and SDL_UnlockAudio() in your code.
|
||||||
* 'desired->userdata' is passed as the first parameter to your callback
|
* 'desired->userdata' is passed as the first parameter to your callback
|
||||||
* function.
|
* function.
|
||||||
*
|
*
|
||||||
* The audio device starts out playing silence when it's opened, and should
|
* The audio device starts out playing silence when it's opened, and should
|
||||||
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
|
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
|
||||||
* for your audio callback function to be called. Since the audio driver
|
* for your audio callback function to be called. Since the audio driver
|
||||||
* may modify the requested size of the audio buffer, you should allocate
|
* may modify the requested size of the audio buffer, you should allocate
|
||||||
* any local mixing buffers after you open the audio device.
|
* any local mixing buffers after you open the audio device.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
|
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current audio state:
|
* Get the current audio state:
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_AUDIO_STOPPED = 0,
|
SDL_AUDIO_STOPPED = 0,
|
||||||
SDL_AUDIO_PLAYING,
|
SDL_AUDIO_PLAYING,
|
||||||
SDL_AUDIO_PAUSED
|
SDL_AUDIO_PAUSED
|
||||||
} SDL_audiostatus;
|
} SDL_audiostatus;
|
||||||
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
|
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function pauses and unpauses the audio callback processing.
|
* This function pauses and unpauses the audio callback processing.
|
||||||
* It should be called with a parameter of 0 after opening the audio
|
* It should be called with a parameter of 0 after opening the audio
|
||||||
* device to start playing sound. This is so you can safely initialize
|
* device to start playing sound. This is so you can safely initialize
|
||||||
* data for your callback function after opening the audio device.
|
* data for your callback function after opening the audio device.
|
||||||
* Silence will be written to the audio device during the pause.
|
* Silence will be written to the audio device during the pause.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function loads a WAVE from the data source, automatically freeing
|
* This function loads a WAVE from the data source, automatically freeing
|
||||||
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
|
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
|
||||||
* you could do:
|
* you could do:
|
||||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||||
*
|
*
|
||||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||||
* filled with the audio data format of the wave data, and sets
|
* filled with the audio data format of the wave data, and sets
|
||||||
* 'audio_buf' to a malloc()'d buffer containing the audio data,
|
* 'audio_buf' to a malloc()'d buffer containing the audio data,
|
||||||
* and sets 'audio_len' to the length of that audio buffer, in bytes.
|
* and sets 'audio_len' to the length of that audio buffer, in bytes.
|
||||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||||
* done with it.
|
* done with it.
|
||||||
*
|
*
|
||||||
* This function returns NULL and sets the SDL error message if the
|
* This function returns NULL and sets the SDL error message if the
|
||||||
* wave file cannot be opened, uses an unknown data format, or is
|
* wave file cannot be opened, uses an unknown data format, or is
|
||||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
|
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
|
||||||
|
|
||||||
/* Compatibility convenience function -- loads a WAV from a file */
|
/* Compatibility convenience function -- loads a WAV from a file */
|
||||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
|
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function takes a source format and rate and a destination format
|
* This function takes a source format and rate and a destination format
|
||||||
* and rate, and initializes the 'cvt' structure with information needed
|
* and rate, and initializes the 'cvt' structure with information needed
|
||||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||||
* to the other.
|
* to the other.
|
||||||
* This function returns 0, or -1 if there was an error.
|
* This function returns 0, or -1 if there was an error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
||||||
Uint16 src_format, Uint8 src_channels, int src_rate,
|
Uint16 src_format, Uint8 src_channels, int src_rate,
|
||||||
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
|
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
|
||||||
|
|
||||||
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
|
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
|
||||||
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
|
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
|
||||||
* audio data in the source format, this function will convert it in-place
|
* audio data in the source format, this function will convert it in-place
|
||||||
* to the desired format.
|
* to the desired format.
|
||||||
* The data conversion may expand the size of the audio data, so the buffer
|
* The data conversion may expand the size of the audio data, so the buffer
|
||||||
* cvt->buf should be allocated after the cvt structure is initialized by
|
* cvt->buf should be allocated after the cvt structure is initialized by
|
||||||
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
|
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
|
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This takes two audio buffers of the playing audio format and mixes
|
* This takes two audio buffers of the playing audio format and mixes
|
||||||
* them, performing addition, volume adjustment, and overflow clipping.
|
* them, performing addition, volume adjustment, and overflow clipping.
|
||||||
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
||||||
* for full audio volume. Note this does not change hardware volume.
|
* for full audio volume. Note this does not change hardware volume.
|
||||||
* This is provided for convenience -- you can mix your own audio data.
|
* This is provided for convenience -- you can mix your own audio data.
|
||||||
*/
|
*/
|
||||||
#define SDL_MIX_MAXVOLUME 128
|
#define SDL_MIX_MAXVOLUME 128
|
||||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
|
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The lock manipulated by these functions protects the callback function.
|
* The lock manipulated by these functions protects the callback function.
|
||||||
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
|
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
|
||||||
* callback function is not running. Do not call these from the callback
|
* callback function is not running. Do not call these from the callback
|
||||||
* function or you will cause deadlock.
|
* function or you will cause deadlock.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function shuts down audio processing and closes the audio device.
|
* This function shuts down audio processing and closes the audio device.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_audio_h */
|
#endif /* _SDL_audio_h */
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* DEPRECATED */
|
/* DEPRECATED */
|
||||||
#include "SDL_endian.h"
|
#include "SDL_endian.h"
|
||||||
|
|
|
@ -1,171 +1,171 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is the CD-audio control API for Simple DirectMedia Layer */
|
/* This is the CD-audio control API for Simple DirectMedia Layer */
|
||||||
|
|
||||||
#ifndef _SDL_cdrom_h
|
#ifndef _SDL_cdrom_h
|
||||||
#define _SDL_cdrom_h
|
#define _SDL_cdrom_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In order to use these functions, SDL_Init() must have been called
|
/* In order to use these functions, SDL_Init() must have been called
|
||||||
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
|
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
|
||||||
for CD-ROM drives, and load appropriate drivers.
|
for CD-ROM drives, and load appropriate drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The maximum number of CD-ROM tracks on a disk */
|
/* The maximum number of CD-ROM tracks on a disk */
|
||||||
#define SDL_MAX_TRACKS 99
|
#define SDL_MAX_TRACKS 99
|
||||||
|
|
||||||
/* The types of CD-ROM track possible */
|
/* The types of CD-ROM track possible */
|
||||||
#define SDL_AUDIO_TRACK 0x00
|
#define SDL_AUDIO_TRACK 0x00
|
||||||
#define SDL_DATA_TRACK 0x04
|
#define SDL_DATA_TRACK 0x04
|
||||||
|
|
||||||
/* The possible states which a CD-ROM drive can be in. */
|
/* The possible states which a CD-ROM drive can be in. */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CD_TRAYEMPTY,
|
CD_TRAYEMPTY,
|
||||||
CD_STOPPED,
|
CD_STOPPED,
|
||||||
CD_PLAYING,
|
CD_PLAYING,
|
||||||
CD_PAUSED,
|
CD_PAUSED,
|
||||||
CD_ERROR = -1
|
CD_ERROR = -1
|
||||||
} CDstatus;
|
} CDstatus;
|
||||||
|
|
||||||
/* Given a status, returns true if there's a disk in the drive */
|
/* Given a status, returns true if there's a disk in the drive */
|
||||||
#define CD_INDRIVE(status) ((int)(status) > 0)
|
#define CD_INDRIVE(status) ((int)(status) > 0)
|
||||||
|
|
||||||
typedef struct SDL_CDtrack {
|
typedef struct SDL_CDtrack {
|
||||||
Uint8 id; /* Track number */
|
Uint8 id; /* Track number */
|
||||||
Uint8 type; /* Data or audio track */
|
Uint8 type; /* Data or audio track */
|
||||||
Uint16 unused;
|
Uint16 unused;
|
||||||
Uint32 length; /* Length, in frames, of this track */
|
Uint32 length; /* Length, in frames, of this track */
|
||||||
Uint32 offset; /* Offset, in frames, from start of disk */
|
Uint32 offset; /* Offset, in frames, from start of disk */
|
||||||
} SDL_CDtrack;
|
} SDL_CDtrack;
|
||||||
|
|
||||||
/* This structure is only current as of the last call to SDL_CDStatus() */
|
/* This structure is only current as of the last call to SDL_CDStatus() */
|
||||||
typedef struct SDL_CD {
|
typedef struct SDL_CD {
|
||||||
int id; /* Private drive identifier */
|
int id; /* Private drive identifier */
|
||||||
CDstatus status; /* Current drive status */
|
CDstatus status; /* Current drive status */
|
||||||
|
|
||||||
/* The rest of this structure is only valid if there's a CD in drive */
|
/* The rest of this structure is only valid if there's a CD in drive */
|
||||||
int numtracks; /* Number of tracks on disk */
|
int numtracks; /* Number of tracks on disk */
|
||||||
int cur_track; /* Current track position */
|
int cur_track; /* Current track position */
|
||||||
int cur_frame; /* Current frame offset within current track */
|
int cur_frame; /* Current frame offset within current track */
|
||||||
SDL_CDtrack track[SDL_MAX_TRACKS+1];
|
SDL_CDtrack track[SDL_MAX_TRACKS+1];
|
||||||
} SDL_CD;
|
} SDL_CD;
|
||||||
|
|
||||||
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
|
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
|
||||||
#define CD_FPS 75
|
#define CD_FPS 75
|
||||||
#define FRAMES_TO_MSF(f, M,S,F) { \
|
#define FRAMES_TO_MSF(f, M,S,F) { \
|
||||||
int value = f; \
|
int value = f; \
|
||||||
*(F) = value%CD_FPS; \
|
*(F) = value%CD_FPS; \
|
||||||
value /= CD_FPS; \
|
value /= CD_FPS; \
|
||||||
*(S) = value%60; \
|
*(S) = value%60; \
|
||||||
value /= 60; \
|
value /= 60; \
|
||||||
*(M) = value; \
|
*(M) = value; \
|
||||||
}
|
}
|
||||||
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
|
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
|
||||||
|
|
||||||
/* CD-audio API functions: */
|
/* CD-audio API functions: */
|
||||||
|
|
||||||
/* Returns the number of CD-ROM drives on the system, or -1 if
|
/* Returns the number of CD-ROM drives on the system, or -1 if
|
||||||
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
|
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
|
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
|
||||||
|
|
||||||
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
||||||
Example:
|
Example:
|
||||||
"/dev/cdrom"
|
"/dev/cdrom"
|
||||||
"E:"
|
"E:"
|
||||||
"/dev/disk/ide/1/master"
|
"/dev/disk/ide/1/master"
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
|
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
|
||||||
|
|
||||||
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
|
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
|
||||||
or NULL if the drive was invalid or busy. This newly opened CD-ROM
|
or NULL if the drive was invalid or busy. This newly opened CD-ROM
|
||||||
becomes the default CD used when other CD functions are passed a NULL
|
becomes the default CD used when other CD functions are passed a NULL
|
||||||
CD-ROM handle.
|
CD-ROM handle.
|
||||||
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
|
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
|
||||||
|
|
||||||
/* This function returns the current status of the given drive.
|
/* This function returns the current status of the given drive.
|
||||||
If the drive has a CD in it, the table of contents of the CD and current
|
If the drive has a CD in it, the table of contents of the CD and current
|
||||||
play position of the CD will be stored in the SDL_CD structure.
|
play position of the CD will be stored in the SDL_CD structure.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
|
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
|
||||||
|
|
||||||
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
|
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
|
||||||
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
|
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
|
||||||
until the end of the CD. This function will skip data tracks.
|
until the end of the CD. This function will skip data tracks.
|
||||||
This function should only be called after calling SDL_CDStatus() to
|
This function should only be called after calling SDL_CDStatus() to
|
||||||
get track information about the CD.
|
get track information about the CD.
|
||||||
For example:
|
For example:
|
||||||
// Play entire CD:
|
// Play entire CD:
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||||
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
|
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
|
||||||
// Play last track:
|
// Play last track:
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
|
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
|
||||||
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
|
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
|
||||||
}
|
}
|
||||||
// Play first and second track and 10 seconds of third track:
|
// Play first and second track and 10 seconds of third track:
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||||
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
|
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
|
||||||
|
|
||||||
This function returns 0, or -1 if there was an error.
|
This function returns 0, or -1 if there was an error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
|
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
|
||||||
int start_track, int start_frame, int ntracks, int nframes);
|
int start_track, int start_frame, int ntracks, int nframes);
|
||||||
|
|
||||||
/* Play the given CD starting at 'start' frame for 'length' frames.
|
/* Play the given CD starting at 'start' frame for 'length' frames.
|
||||||
It returns 0, or -1 if there was an error.
|
It returns 0, or -1 if there was an error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
||||||
|
|
||||||
/* Pause play -- returns 0, or -1 on error */
|
/* Pause play -- returns 0, or -1 on error */
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
|
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
|
||||||
|
|
||||||
/* Resume play -- returns 0, or -1 on error */
|
/* Resume play -- returns 0, or -1 on error */
|
||||||
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
|
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
|
||||||
|
|
||||||
/* Stop play -- returns 0, or -1 on error */
|
/* Stop play -- returns 0, or -1 on error */
|
||||||
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
|
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
|
||||||
|
|
||||||
/* Eject CD-ROM -- returns 0, or -1 on error */
|
/* Eject CD-ROM -- returns 0, or -1 on error */
|
||||||
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
|
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
|
||||||
|
|
||||||
/* Closes the handle for the CD-ROM drive */
|
/* Closes the handle for the CD-ROM drive */
|
||||||
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
|
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_video_h */
|
#endif /* _SDL_video_h */
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_h
|
#ifndef _SDL_config_h
|
||||||
#define _SDL_config_h
|
#define _SDL_config_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* Add any platform that doesn't build using the configure system */
|
/* Add any platform that doesn't build using the configure system */
|
||||||
#if defined(__DREAMCAST__)
|
#if defined(__DREAMCAST__)
|
||||||
#include "SDL_config_dreamcast.h"
|
#include "SDL_config_dreamcast.h"
|
||||||
#elif defined(__MACOS__)
|
#elif defined(__MACOS__)
|
||||||
#include "SDL_config_macos.h"
|
#include "SDL_config_macos.h"
|
||||||
#elif defined(__MACOSX__)
|
#elif defined(__MACOSX__)
|
||||||
#include "SDL_config_macosx.h"
|
#include "SDL_config_macosx.h"
|
||||||
#elif defined(__SYMBIAN32__)
|
#elif defined(__SYMBIAN32__)
|
||||||
#include "SDL_config_symbian.h" /* must be before win32! */
|
#include "SDL_config_symbian.h" /* must be before win32! */
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
#include "SDL_config_win32.h"
|
#include "SDL_config_win32.h"
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
#include "SDL_config_os2.h"
|
#include "SDL_config_os2.h"
|
||||||
#else
|
#else
|
||||||
#include "SDL_config_minimal.h"
|
#include "SDL_config_minimal.h"
|
||||||
#endif /* platform config */
|
#endif /* platform config */
|
||||||
|
|
||||||
#endif /* _SDL_config_h */
|
#endif /* _SDL_config_h */
|
||||||
|
|
|
@ -1,306 +1,306 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_h
|
#ifndef _SDL_config_h
|
||||||
#define _SDL_config_h
|
#define _SDL_config_h
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
/* General platform specific identifiers */
|
/* General platform specific identifiers */
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* Make sure that this isn't included by Visual C++ */
|
/* Make sure that this isn't included by Visual C++ */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* C language features */
|
/* C language features */
|
||||||
#undef const
|
#undef const
|
||||||
#undef inline
|
#undef inline
|
||||||
#undef volatile
|
#undef volatile
|
||||||
|
|
||||||
/* C datatypes */
|
/* C datatypes */
|
||||||
#undef size_t
|
#undef size_t
|
||||||
#undef int8_t
|
#undef int8_t
|
||||||
#undef uint8_t
|
#undef uint8_t
|
||||||
#undef int16_t
|
#undef int16_t
|
||||||
#undef uint16_t
|
#undef uint16_t
|
||||||
#undef int32_t
|
#undef int32_t
|
||||||
#undef uint32_t
|
#undef uint32_t
|
||||||
#undef int64_t
|
#undef int64_t
|
||||||
#undef uint64_t
|
#undef uint64_t
|
||||||
#undef uintptr_t
|
#undef uintptr_t
|
||||||
#undef SDL_HAS_64BIT_TYPE
|
#undef SDL_HAS_64BIT_TYPE
|
||||||
|
|
||||||
/* Endianness */
|
/* Endianness */
|
||||||
#undef SDL_BYTEORDER
|
#undef SDL_BYTEORDER
|
||||||
|
|
||||||
/* Comment this if you want to build without any C library requirements */
|
/* Comment this if you want to build without any C library requirements */
|
||||||
#undef HAVE_LIBC
|
#undef HAVE_LIBC
|
||||||
#if HAVE_LIBC
|
#if HAVE_LIBC
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#undef HAVE_ALLOCA_H
|
#undef HAVE_ALLOCA_H
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
#undef HAVE_STDIO_H
|
#undef HAVE_STDIO_H
|
||||||
#undef STDC_HEADERS
|
#undef STDC_HEADERS
|
||||||
#undef HAVE_STDLIB_H
|
#undef HAVE_STDLIB_H
|
||||||
#undef HAVE_STDARG_H
|
#undef HAVE_STDARG_H
|
||||||
#undef HAVE_MALLOC_H
|
#undef HAVE_MALLOC_H
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
#undef HAVE_STRING_H
|
#undef HAVE_STRING_H
|
||||||
#undef HAVE_STRINGS_H
|
#undef HAVE_STRINGS_H
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
#undef HAVE_STDINT_H
|
#undef HAVE_STDINT_H
|
||||||
#undef HAVE_CTYPE_H
|
#undef HAVE_CTYPE_H
|
||||||
#undef HAVE_MATH_H
|
#undef HAVE_MATH_H
|
||||||
#undef HAVE_ICONV_H
|
#undef HAVE_ICONV_H
|
||||||
#undef HAVE_SIGNAL_H
|
#undef HAVE_SIGNAL_H
|
||||||
#undef HAVE_ALTIVEC_H
|
#undef HAVE_ALTIVEC_H
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#undef HAVE_MALLOC
|
#undef HAVE_MALLOC
|
||||||
#undef HAVE_CALLOC
|
#undef HAVE_CALLOC
|
||||||
#undef HAVE_REALLOC
|
#undef HAVE_REALLOC
|
||||||
#undef HAVE_FREE
|
#undef HAVE_FREE
|
||||||
#undef HAVE_ALLOCA
|
#undef HAVE_ALLOCA
|
||||||
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
||||||
#undef HAVE_GETENV
|
#undef HAVE_GETENV
|
||||||
#undef HAVE_PUTENV
|
#undef HAVE_PUTENV
|
||||||
#undef HAVE_UNSETENV
|
#undef HAVE_UNSETENV
|
||||||
#endif
|
#endif
|
||||||
#undef HAVE_QSORT
|
#undef HAVE_QSORT
|
||||||
#undef HAVE_ABS
|
#undef HAVE_ABS
|
||||||
#undef HAVE_BCOPY
|
#undef HAVE_BCOPY
|
||||||
#undef HAVE_MEMSET
|
#undef HAVE_MEMSET
|
||||||
#undef HAVE_MEMCPY
|
#undef HAVE_MEMCPY
|
||||||
#undef HAVE_MEMMOVE
|
#undef HAVE_MEMMOVE
|
||||||
#undef HAVE_MEMCMP
|
#undef HAVE_MEMCMP
|
||||||
#undef HAVE_STRLEN
|
#undef HAVE_STRLEN
|
||||||
#undef HAVE_STRLCPY
|
#undef HAVE_STRLCPY
|
||||||
#undef HAVE_STRLCAT
|
#undef HAVE_STRLCAT
|
||||||
#undef HAVE_STRDUP
|
#undef HAVE_STRDUP
|
||||||
#undef HAVE__STRREV
|
#undef HAVE__STRREV
|
||||||
#undef HAVE__STRUPR
|
#undef HAVE__STRUPR
|
||||||
#undef HAVE__STRLWR
|
#undef HAVE__STRLWR
|
||||||
#undef HAVE_INDEX
|
#undef HAVE_INDEX
|
||||||
#undef HAVE_RINDEX
|
#undef HAVE_RINDEX
|
||||||
#undef HAVE_STRCHR
|
#undef HAVE_STRCHR
|
||||||
#undef HAVE_STRRCHR
|
#undef HAVE_STRRCHR
|
||||||
#undef HAVE_STRSTR
|
#undef HAVE_STRSTR
|
||||||
#undef HAVE_ITOA
|
#undef HAVE_ITOA
|
||||||
#undef HAVE__LTOA
|
#undef HAVE__LTOA
|
||||||
#undef HAVE__UITOA
|
#undef HAVE__UITOA
|
||||||
#undef HAVE__ULTOA
|
#undef HAVE__ULTOA
|
||||||
#undef HAVE_STRTOL
|
#undef HAVE_STRTOL
|
||||||
#undef HAVE_STRTOUL
|
#undef HAVE_STRTOUL
|
||||||
#undef HAVE__I64TOA
|
#undef HAVE__I64TOA
|
||||||
#undef HAVE__UI64TOA
|
#undef HAVE__UI64TOA
|
||||||
#undef HAVE_STRTOLL
|
#undef HAVE_STRTOLL
|
||||||
#undef HAVE_STRTOULL
|
#undef HAVE_STRTOULL
|
||||||
#undef HAVE_STRTOD
|
#undef HAVE_STRTOD
|
||||||
#undef HAVE_ATOI
|
#undef HAVE_ATOI
|
||||||
#undef HAVE_ATOF
|
#undef HAVE_ATOF
|
||||||
#undef HAVE_STRCMP
|
#undef HAVE_STRCMP
|
||||||
#undef HAVE_STRNCMP
|
#undef HAVE_STRNCMP
|
||||||
#undef HAVE__STRICMP
|
#undef HAVE__STRICMP
|
||||||
#undef HAVE_STRCASECMP
|
#undef HAVE_STRCASECMP
|
||||||
#undef HAVE__STRNICMP
|
#undef HAVE__STRNICMP
|
||||||
#undef HAVE_STRNCASECMP
|
#undef HAVE_STRNCASECMP
|
||||||
#undef HAVE_SSCANF
|
#undef HAVE_SSCANF
|
||||||
#undef HAVE_SNPRINTF
|
#undef HAVE_SNPRINTF
|
||||||
#undef HAVE_VSNPRINTF
|
#undef HAVE_VSNPRINTF
|
||||||
#undef HAVE_ICONV
|
#undef HAVE_ICONV
|
||||||
#undef HAVE_SIGACTION
|
#undef HAVE_SIGACTION
|
||||||
#undef HAVE_SETJMP
|
#undef HAVE_SETJMP
|
||||||
#undef HAVE_NANOSLEEP
|
#undef HAVE_NANOSLEEP
|
||||||
#undef HAVE_CLOCK_GETTIME
|
#undef HAVE_CLOCK_GETTIME
|
||||||
#undef HAVE_DLVSYM
|
#undef HAVE_DLVSYM
|
||||||
#undef HAVE_GETPAGESIZE
|
#undef HAVE_GETPAGESIZE
|
||||||
#undef HAVE_MPROTECT
|
#undef HAVE_MPROTECT
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* We may need some replacement for stdarg.h here */
|
/* We may need some replacement for stdarg.h here */
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif /* HAVE_LIBC */
|
#endif /* HAVE_LIBC */
|
||||||
|
|
||||||
/* Allow disabling of core subsystems */
|
/* Allow disabling of core subsystems */
|
||||||
#undef SDL_AUDIO_DISABLED
|
#undef SDL_AUDIO_DISABLED
|
||||||
#undef SDL_CDROM_DISABLED
|
#undef SDL_CDROM_DISABLED
|
||||||
#undef SDL_CPUINFO_DISABLED
|
#undef SDL_CPUINFO_DISABLED
|
||||||
#undef SDL_EVENTS_DISABLED
|
#undef SDL_EVENTS_DISABLED
|
||||||
#undef SDL_FILE_DISABLED
|
#undef SDL_FILE_DISABLED
|
||||||
#undef SDL_JOYSTICK_DISABLED
|
#undef SDL_JOYSTICK_DISABLED
|
||||||
#undef SDL_LOADSO_DISABLED
|
#undef SDL_LOADSO_DISABLED
|
||||||
#undef SDL_THREADS_DISABLED
|
#undef SDL_THREADS_DISABLED
|
||||||
#undef SDL_TIMERS_DISABLED
|
#undef SDL_TIMERS_DISABLED
|
||||||
#undef SDL_VIDEO_DISABLED
|
#undef SDL_VIDEO_DISABLED
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#undef SDL_AUDIO_DRIVER_ALSA
|
#undef SDL_AUDIO_DRIVER_ALSA
|
||||||
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_ARTS
|
#undef SDL_AUDIO_DRIVER_ARTS
|
||||||
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_BAUDIO
|
#undef SDL_AUDIO_DRIVER_BAUDIO
|
||||||
#undef SDL_AUDIO_DRIVER_BSD
|
#undef SDL_AUDIO_DRIVER_BSD
|
||||||
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
||||||
#undef SDL_AUDIO_DRIVER_DART
|
#undef SDL_AUDIO_DRIVER_DART
|
||||||
#undef SDL_AUDIO_DRIVER_DC
|
#undef SDL_AUDIO_DRIVER_DC
|
||||||
#undef SDL_AUDIO_DRIVER_DISK
|
#undef SDL_AUDIO_DRIVER_DISK
|
||||||
#undef SDL_AUDIO_DRIVER_DUMMY
|
#undef SDL_AUDIO_DRIVER_DUMMY
|
||||||
#undef SDL_AUDIO_DRIVER_DMEDIA
|
#undef SDL_AUDIO_DRIVER_DMEDIA
|
||||||
#undef SDL_AUDIO_DRIVER_DSOUND
|
#undef SDL_AUDIO_DRIVER_DSOUND
|
||||||
#undef SDL_AUDIO_DRIVER_PULSE
|
#undef SDL_AUDIO_DRIVER_PULSE
|
||||||
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_ESD
|
#undef SDL_AUDIO_DRIVER_ESD
|
||||||
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_MINT
|
#undef SDL_AUDIO_DRIVER_MINT
|
||||||
#undef SDL_AUDIO_DRIVER_MMEAUDIO
|
#undef SDL_AUDIO_DRIVER_MMEAUDIO
|
||||||
#undef SDL_AUDIO_DRIVER_NAS
|
#undef SDL_AUDIO_DRIVER_NAS
|
||||||
#undef SDL_AUDIO_DRIVER_OSS
|
#undef SDL_AUDIO_DRIVER_OSS
|
||||||
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
||||||
#undef SDL_AUDIO_DRIVER_PAUD
|
#undef SDL_AUDIO_DRIVER_PAUD
|
||||||
#undef SDL_AUDIO_DRIVER_QNXNTO
|
#undef SDL_AUDIO_DRIVER_QNXNTO
|
||||||
#undef SDL_AUDIO_DRIVER_SNDMGR
|
#undef SDL_AUDIO_DRIVER_SNDMGR
|
||||||
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||||
#undef SDL_AUDIO_DRIVER_WAVEOUT
|
#undef SDL_AUDIO_DRIVER_WAVEOUT
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#undef SDL_CDROM_AIX
|
#undef SDL_CDROM_AIX
|
||||||
#undef SDL_CDROM_BEOS
|
#undef SDL_CDROM_BEOS
|
||||||
#undef SDL_CDROM_BSDI
|
#undef SDL_CDROM_BSDI
|
||||||
#undef SDL_CDROM_DC
|
#undef SDL_CDROM_DC
|
||||||
#undef SDL_CDROM_DUMMY
|
#undef SDL_CDROM_DUMMY
|
||||||
#undef SDL_CDROM_FREEBSD
|
#undef SDL_CDROM_FREEBSD
|
||||||
#undef SDL_CDROM_LINUX
|
#undef SDL_CDROM_LINUX
|
||||||
#undef SDL_CDROM_MACOS
|
#undef SDL_CDROM_MACOS
|
||||||
#undef SDL_CDROM_MACOSX
|
#undef SDL_CDROM_MACOSX
|
||||||
#undef SDL_CDROM_MINT
|
#undef SDL_CDROM_MINT
|
||||||
#undef SDL_CDROM_OPENBSD
|
#undef SDL_CDROM_OPENBSD
|
||||||
#undef SDL_CDROM_OS2
|
#undef SDL_CDROM_OS2
|
||||||
#undef SDL_CDROM_OSF
|
#undef SDL_CDROM_OSF
|
||||||
#undef SDL_CDROM_QNX
|
#undef SDL_CDROM_QNX
|
||||||
#undef SDL_CDROM_WIN32
|
#undef SDL_CDROM_WIN32
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#undef SDL_INPUT_LINUXEV
|
#undef SDL_INPUT_LINUXEV
|
||||||
#undef SDL_INPUT_TSLIB
|
#undef SDL_INPUT_TSLIB
|
||||||
#undef SDL_JOYSTICK_BEOS
|
#undef SDL_JOYSTICK_BEOS
|
||||||
#undef SDL_JOYSTICK_DC
|
#undef SDL_JOYSTICK_DC
|
||||||
#undef SDL_JOYSTICK_DUMMY
|
#undef SDL_JOYSTICK_DUMMY
|
||||||
#undef SDL_JOYSTICK_IOKIT
|
#undef SDL_JOYSTICK_IOKIT
|
||||||
#undef SDL_JOYSTICK_LINUX
|
#undef SDL_JOYSTICK_LINUX
|
||||||
#undef SDL_JOYSTICK_MACOS
|
#undef SDL_JOYSTICK_MACOS
|
||||||
#undef SDL_JOYSTICK_MINT
|
#undef SDL_JOYSTICK_MINT
|
||||||
#undef SDL_JOYSTICK_OS2
|
#undef SDL_JOYSTICK_OS2
|
||||||
#undef SDL_JOYSTICK_RISCOS
|
#undef SDL_JOYSTICK_RISCOS
|
||||||
#undef SDL_JOYSTICK_WINMM
|
#undef SDL_JOYSTICK_WINMM
|
||||||
#undef SDL_JOYSTICK_USBHID
|
#undef SDL_JOYSTICK_USBHID
|
||||||
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#undef SDL_LOADSO_BEOS
|
#undef SDL_LOADSO_BEOS
|
||||||
#undef SDL_LOADSO_DLCOMPAT
|
#undef SDL_LOADSO_DLCOMPAT
|
||||||
#undef SDL_LOADSO_DLOPEN
|
#undef SDL_LOADSO_DLOPEN
|
||||||
#undef SDL_LOADSO_DUMMY
|
#undef SDL_LOADSO_DUMMY
|
||||||
#undef SDL_LOADSO_LDG
|
#undef SDL_LOADSO_LDG
|
||||||
#undef SDL_LOADSO_MACOS
|
#undef SDL_LOADSO_MACOS
|
||||||
#undef SDL_LOADSO_OS2
|
#undef SDL_LOADSO_OS2
|
||||||
#undef SDL_LOADSO_WIN32
|
#undef SDL_LOADSO_WIN32
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#undef SDL_THREAD_BEOS
|
#undef SDL_THREAD_BEOS
|
||||||
#undef SDL_THREAD_DC
|
#undef SDL_THREAD_DC
|
||||||
#undef SDL_THREAD_OS2
|
#undef SDL_THREAD_OS2
|
||||||
#undef SDL_THREAD_PTH
|
#undef SDL_THREAD_PTH
|
||||||
#undef SDL_THREAD_PTHREAD
|
#undef SDL_THREAD_PTHREAD
|
||||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
||||||
#undef SDL_THREAD_SPROC
|
#undef SDL_THREAD_SPROC
|
||||||
#undef SDL_THREAD_WIN32
|
#undef SDL_THREAD_WIN32
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#undef SDL_TIMER_BEOS
|
#undef SDL_TIMER_BEOS
|
||||||
#undef SDL_TIMER_DC
|
#undef SDL_TIMER_DC
|
||||||
#undef SDL_TIMER_DUMMY
|
#undef SDL_TIMER_DUMMY
|
||||||
#undef SDL_TIMER_MACOS
|
#undef SDL_TIMER_MACOS
|
||||||
#undef SDL_TIMER_MINT
|
#undef SDL_TIMER_MINT
|
||||||
#undef SDL_TIMER_OS2
|
#undef SDL_TIMER_OS2
|
||||||
#undef SDL_TIMER_RISCOS
|
#undef SDL_TIMER_RISCOS
|
||||||
#undef SDL_TIMER_UNIX
|
#undef SDL_TIMER_UNIX
|
||||||
#undef SDL_TIMER_WIN32
|
#undef SDL_TIMER_WIN32
|
||||||
#undef SDL_TIMER_WINCE
|
#undef SDL_TIMER_WINCE
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#undef SDL_VIDEO_DRIVER_AALIB
|
#undef SDL_VIDEO_DRIVER_AALIB
|
||||||
#undef SDL_VIDEO_DRIVER_BWINDOW
|
#undef SDL_VIDEO_DRIVER_BWINDOW
|
||||||
#undef SDL_VIDEO_DRIVER_DC
|
#undef SDL_VIDEO_DRIVER_DC
|
||||||
#undef SDL_VIDEO_DRIVER_DDRAW
|
#undef SDL_VIDEO_DRIVER_DDRAW
|
||||||
#undef SDL_VIDEO_DRIVER_DGA
|
#undef SDL_VIDEO_DRIVER_DGA
|
||||||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||||
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
|
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
|
||||||
#undef SDL_VIDEO_DRIVER_DUMMY
|
#undef SDL_VIDEO_DRIVER_DUMMY
|
||||||
#undef SDL_VIDEO_DRIVER_FBCON
|
#undef SDL_VIDEO_DRIVER_FBCON
|
||||||
#undef SDL_VIDEO_DRIVER_GAPI
|
#undef SDL_VIDEO_DRIVER_GAPI
|
||||||
#undef SDL_VIDEO_DRIVER_GEM
|
#undef SDL_VIDEO_DRIVER_GEM
|
||||||
#undef SDL_VIDEO_DRIVER_GGI
|
#undef SDL_VIDEO_DRIVER_GGI
|
||||||
#undef SDL_VIDEO_DRIVER_IPOD
|
#undef SDL_VIDEO_DRIVER_IPOD
|
||||||
#undef SDL_VIDEO_DRIVER_NANOX
|
#undef SDL_VIDEO_DRIVER_NANOX
|
||||||
#undef SDL_VIDEO_DRIVER_OS2FS
|
#undef SDL_VIDEO_DRIVER_OS2FS
|
||||||
#undef SDL_VIDEO_DRIVER_PHOTON
|
#undef SDL_VIDEO_DRIVER_PHOTON
|
||||||
#undef SDL_VIDEO_DRIVER_PICOGUI
|
#undef SDL_VIDEO_DRIVER_PICOGUI
|
||||||
#undef SDL_VIDEO_DRIVER_PS2GS
|
#undef SDL_VIDEO_DRIVER_PS2GS
|
||||||
#undef SDL_VIDEO_DRIVER_QTOPIA
|
#undef SDL_VIDEO_DRIVER_QTOPIA
|
||||||
#undef SDL_VIDEO_DRIVER_QUARTZ
|
#undef SDL_VIDEO_DRIVER_QUARTZ
|
||||||
#undef SDL_VIDEO_DRIVER_RISCOS
|
#undef SDL_VIDEO_DRIVER_RISCOS
|
||||||
#undef SDL_VIDEO_DRIVER_SVGALIB
|
#undef SDL_VIDEO_DRIVER_SVGALIB
|
||||||
#undef SDL_VIDEO_DRIVER_TOOLBOX
|
#undef SDL_VIDEO_DRIVER_TOOLBOX
|
||||||
#undef SDL_VIDEO_DRIVER_VGL
|
#undef SDL_VIDEO_DRIVER_VGL
|
||||||
#undef SDL_VIDEO_DRIVER_WINDIB
|
#undef SDL_VIDEO_DRIVER_WINDIB
|
||||||
#undef SDL_VIDEO_DRIVER_WSCONS
|
#undef SDL_VIDEO_DRIVER_WSCONS
|
||||||
#undef SDL_VIDEO_DRIVER_X11
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
|
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DPMS
|
#undef SDL_VIDEO_DRIVER_X11_DPMS
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
|
||||||
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
|
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XME
|
#undef SDL_VIDEO_DRIVER_X11_XME
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XV
|
#undef SDL_VIDEO_DRIVER_X11_XV
|
||||||
#undef SDL_VIDEO_DRIVER_XBIOS
|
#undef SDL_VIDEO_DRIVER_XBIOS
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
/* Enable OpenGL support */
|
||||||
#undef SDL_VIDEO_OPENGL
|
#undef SDL_VIDEO_OPENGL
|
||||||
#undef SDL_VIDEO_OPENGL_GLX
|
#undef SDL_VIDEO_OPENGL_GLX
|
||||||
#undef SDL_VIDEO_OPENGL_WGL
|
#undef SDL_VIDEO_OPENGL_WGL
|
||||||
#undef SDL_VIDEO_OPENGL_OSMESA
|
#undef SDL_VIDEO_OPENGL_OSMESA
|
||||||
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
|
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
|
||||||
|
|
||||||
/* Enable assembly routines */
|
/* Enable assembly routines */
|
||||||
#undef SDL_ASSEMBLY_ROUTINES
|
#undef SDL_ASSEMBLY_ROUTINES
|
||||||
#undef SDL_HERMES_BLITTERS
|
#undef SDL_HERMES_BLITTERS
|
||||||
#undef SDL_ALTIVEC_BLITTERS
|
#undef SDL_ALTIVEC_BLITTERS
|
||||||
|
|
||||||
#endif /* _SDL_config_h */
|
#endif /* _SDL_config_h */
|
||||||
|
|
|
@ -1,106 +1,106 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_dreamcast_h
|
#ifndef _SDL_config_dreamcast_h
|
||||||
#define _SDL_config_dreamcast_h
|
#define _SDL_config_dreamcast_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef signed int int32_t;
|
typedef signed int int32_t;
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
typedef signed long long int64_t;
|
typedef signed long long int64_t;
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
typedef unsigned long uintptr_t;
|
typedef unsigned long uintptr_t;
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_GETENV 1
|
#define HAVE_GETENV 1
|
||||||
#define HAVE_PUTENV 1
|
#define HAVE_PUTENV 1
|
||||||
#define HAVE_QSORT 1
|
#define HAVE_QSORT 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_BCOPY 1
|
#define HAVE_BCOPY 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MEMCMP 1
|
#define HAVE_MEMCMP 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
#define HAVE_INDEX 1
|
#define HAVE_INDEX 1
|
||||||
#define HAVE_RINDEX 1
|
#define HAVE_RINDEX 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_STRICMP 1
|
#define HAVE_STRICMP 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
#define HAVE_SNPRINTF 1
|
#define HAVE_SNPRINTF 1
|
||||||
#define HAVE_VSNPRINTF 1
|
#define HAVE_VSNPRINTF 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_DC 1
|
#define SDL_AUDIO_DRIVER_DC 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#define SDL_CDROM_DC 1
|
#define SDL_CDROM_DC 1
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#define SDL_JOYSTICK_DC 1
|
#define SDL_JOYSTICK_DC 1
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#define SDL_LOADSO_DUMMY 1
|
#define SDL_LOADSO_DUMMY 1
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREAD_DC 1
|
#define SDL_THREAD_DC 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#define SDL_TIMER_DC 1
|
#define SDL_TIMER_DC 1
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#define SDL_VIDEO_DRIVER_DC 1
|
#define SDL_VIDEO_DRIVER_DC 1
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
#endif /* _SDL_config_dreamcast_h */
|
#endif /* _SDL_config_dreamcast_h */
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_macos_h
|
#ifndef _SDL_config_macos_h
|
||||||
#define _SDL_config_macos_h
|
#define _SDL_config_macos_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
|
|
||||||
typedef SInt8 int8_t;
|
typedef SInt8 int8_t;
|
||||||
typedef UInt8 uint8_t;
|
typedef UInt8 uint8_t;
|
||||||
typedef SInt16 int16_t;
|
typedef SInt16 int16_t;
|
||||||
typedef UInt16 uint16_t;
|
typedef UInt16 uint16_t;
|
||||||
typedef SInt32 int32_t;
|
typedef SInt32 int32_t;
|
||||||
typedef UInt32 uint32_t;
|
typedef UInt32 uint32_t;
|
||||||
typedef SInt64 int64_t;
|
typedef SInt64 int64_t;
|
||||||
typedef UInt64 uint64_t;
|
typedef UInt64 uint64_t;
|
||||||
typedef unsigned long uintptr_t;
|
typedef unsigned long uintptr_t;
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MEMCMP 1
|
#define HAVE_MEMCMP 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_ITOA 1
|
#define HAVE_ITOA 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_CARBON
|
||||||
#define SDL_CDROM_DUMMY 1
|
#define SDL_CDROM_DUMMY 1
|
||||||
#else
|
#else
|
||||||
#define SDL_CDROM_MACOS 1
|
#define SDL_CDROM_MACOS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_CARBON
|
||||||
#define SDL_JOYSTICK_DUMMY 1
|
#define SDL_JOYSTICK_DUMMY 1
|
||||||
#else
|
#else
|
||||||
#define SDL_JOYSTICK_MACOS 1
|
#define SDL_JOYSTICK_MACOS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#define SDL_LOADSO_MACOS 1
|
#define SDL_LOADSO_MACOS 1
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREADS_DISABLED 1
|
#define SDL_THREADS_DISABLED 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#define SDL_TIMER_MACOS 1
|
#define SDL_TIMER_MACOS 1
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
|
#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
|
||||||
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
/* Enable OpenGL support */
|
||||||
#define SDL_VIDEO_OPENGL 1
|
#define SDL_VIDEO_OPENGL 1
|
||||||
|
|
||||||
#endif /* _SDL_config_macos_h */
|
#endif /* _SDL_config_macos_h */
|
||||||
|
|
|
@ -1,135 +1,135 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_macosx_h
|
#ifndef _SDL_config_macosx_h
|
||||||
#define _SDL_config_macosx_h
|
#define _SDL_config_macosx_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
|
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
||||||
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
||||||
#define HAVE_ALLOCA_H 1
|
#define HAVE_ALLOCA_H 1
|
||||||
#endif
|
#endif
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_GETENV 1
|
#define HAVE_GETENV 1
|
||||||
#define HAVE_PUTENV 1
|
#define HAVE_PUTENV 1
|
||||||
#define HAVE_UNSETENV 1
|
#define HAVE_UNSETENV 1
|
||||||
#define HAVE_QSORT 1
|
#define HAVE_QSORT 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_BCOPY 1
|
#define HAVE_BCOPY 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MEMCMP 1
|
#define HAVE_MEMCMP 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE_STRLCPY 1
|
#define HAVE_STRLCPY 1
|
||||||
#define HAVE_STRLCAT 1
|
#define HAVE_STRLCAT 1
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOUL 1
|
#define HAVE_STRTOUL 1
|
||||||
#define HAVE_STRTOLL 1
|
#define HAVE_STRTOLL 1
|
||||||
#define HAVE_STRTOULL 1
|
#define HAVE_STRTOULL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_STRNCASECMP 1
|
#define HAVE_STRNCASECMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
#define HAVE_SNPRINTF 1
|
#define HAVE_SNPRINTF 1
|
||||||
#define HAVE_VSNPRINTF 1
|
#define HAVE_VSNPRINTF 1
|
||||||
#define HAVE_SIGACTION 1
|
#define HAVE_SIGACTION 1
|
||||||
#define HAVE_SETJMP 1
|
#define HAVE_SETJMP 1
|
||||||
#define HAVE_NANOSLEEP 1
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||||
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#define SDL_CDROM_MACOSX 1
|
#define SDL_CDROM_MACOSX 1
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#define SDL_JOYSTICK_IOKIT 1
|
#define SDL_JOYSTICK_IOKIT 1
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#ifdef __ppc__
|
#ifdef __ppc__
|
||||||
/* For Mac OS X 10.2 compatibility */
|
/* For Mac OS X 10.2 compatibility */
|
||||||
#define SDL_LOADSO_DLCOMPAT 1
|
#define SDL_LOADSO_DLCOMPAT 1
|
||||||
#else
|
#else
|
||||||
#define SDL_LOADSO_DLOPEN 1
|
#define SDL_LOADSO_DLOPEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREAD_PTHREAD 1
|
#define SDL_THREAD_PTHREAD 1
|
||||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#define SDL_TIMER_UNIX 1
|
#define SDL_TIMER_UNIX 1
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
|
#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
|
||||||
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
||||||
#else
|
#else
|
||||||
#define SDL_VIDEO_DRIVER_QUARTZ 1
|
#define SDL_VIDEO_DRIVER_QUARTZ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
/* Enable OpenGL support */
|
||||||
#define SDL_VIDEO_OPENGL 1
|
#define SDL_VIDEO_OPENGL 1
|
||||||
|
|
||||||
/* Enable assembly routines */
|
/* Enable assembly routines */
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
#define SDL_ASSEMBLY_ROUTINES 1
|
||||||
#ifdef __ppc__
|
#ifdef __ppc__
|
||||||
#define SDL_ALTIVEC_BLITTERS 1
|
#define SDL_ALTIVEC_BLITTERS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SDL_config_macosx_h */
|
#endif /* _SDL_config_macosx_h */
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_minimal_h
|
#ifndef _SDL_config_minimal_h
|
||||||
#define _SDL_config_minimal_h
|
#define _SDL_config_minimal_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is the minimal configuration that can be used to build SDL */
|
/* This is the minimal configuration that can be used to build SDL */
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef signed int int32_t;
|
typedef signed int int32_t;
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
typedef unsigned long uintptr_t;
|
typedef unsigned long uintptr_t;
|
||||||
|
|
||||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
||||||
#define SDL_CDROM_DISABLED 1
|
#define SDL_CDROM_DISABLED 1
|
||||||
|
|
||||||
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
||||||
#define SDL_JOYSTICK_DISABLED 1
|
#define SDL_JOYSTICK_DISABLED 1
|
||||||
|
|
||||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||||
#define SDL_LOADSO_DISABLED 1
|
#define SDL_LOADSO_DISABLED 1
|
||||||
|
|
||||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||||
#define SDL_THREADS_DISABLED 1
|
#define SDL_THREADS_DISABLED 1
|
||||||
|
|
||||||
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
||||||
#define SDL_TIMERS_DISABLED 1
|
#define SDL_TIMERS_DISABLED 1
|
||||||
|
|
||||||
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
#endif /* _SDL_config_minimal_h */
|
#endif /* _SDL_config_minimal_h */
|
||||||
|
|
|
@ -1,115 +1,115 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_nds_h
|
#ifndef _SDL_config_nds_h
|
||||||
#define _SDL_config_nds_h
|
#define _SDL_config_nds_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
/* General platform specific identifiers */
|
/* General platform specific identifiers */
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* C datatypes */
|
/* C datatypes */
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Endianness */
|
/* Endianness */
|
||||||
#define SDL_BYTEORDER 1234
|
#define SDL_BYTEORDER 1234
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#define HAVE_ALLOCA_H 1
|
#define HAVE_ALLOCA_H 1
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STDLIB_H 1
|
#define HAVE_STDLIB_H 1
|
||||||
#define HAVE_STDARG_H 1
|
#define HAVE_STDARG_H 1
|
||||||
#define HAVE_MALLOC_H 1
|
#define HAVE_MALLOC_H 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
#define HAVE_ICONV_H 1
|
#define HAVE_ICONV_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_GETENV 1
|
#define HAVE_GETENV 1
|
||||||
#define HAVE_PUTENV 1
|
#define HAVE_PUTENV 1
|
||||||
#define HAVE_UNSETENV 1
|
#define HAVE_UNSETENV 1
|
||||||
#define HAVE_QSORT 1
|
#define HAVE_QSORT 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_BCOPY 1
|
#define HAVE_BCOPY 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE_STRLCPY 1
|
#define HAVE_STRLCPY 1
|
||||||
#define HAVE_STRLCAT 1
|
#define HAVE_STRLCAT 1
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOUL 1
|
#define HAVE_STRTOUL 1
|
||||||
#define HAVE_STRTOLL 1
|
#define HAVE_STRTOLL 1
|
||||||
#define HAVE_STRTOULL 1
|
#define HAVE_STRTOULL 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_STRNCASECMP 1
|
#define HAVE_STRNCASECMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
#define HAVE_SNPRINTF 1
|
#define HAVE_SNPRINTF 1
|
||||||
#define HAVE_VSNPRINTF 1
|
#define HAVE_VSNPRINTF 1
|
||||||
#define HAVE_SETJMP 1
|
#define HAVE_SETJMP 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_NDS 1
|
#define SDL_AUDIO_DRIVER_NDS 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
||||||
#define SDL_CDROM_DISABLED 1
|
#define SDL_CDROM_DISABLED 1
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#define SDL_JOYSTICK_NDS 1
|
#define SDL_JOYSTICK_NDS 1
|
||||||
|
|
||||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||||
#define SDL_LOADSO_DISABLED 1
|
#define SDL_LOADSO_DISABLED 1
|
||||||
|
|
||||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||||
#define SDL_THREADS_DISABLED 1
|
#define SDL_THREADS_DISABLED 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#define SDL_TIMER_NDS 1
|
#define SDL_TIMER_NDS 1
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#define SDL_VIDEO_DRIVER_NDS 1
|
#define SDL_VIDEO_DRIVER_NDS 1
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
#endif /* _SDL_config_nds_h */
|
#endif /* _SDL_config_nds_h */
|
||||||
|
|
|
@ -1,141 +1,141 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_os2_h
|
#ifndef _SDL_config_os2_h
|
||||||
#define _SDL_config_os2_h
|
#define _SDL_config_os2_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef signed int int32_t;
|
typedef signed int int32_t;
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
typedef unsigned long uintptr_t;
|
typedef unsigned long uintptr_t;
|
||||||
typedef signed long long int64_t;
|
typedef signed long long int64_t;
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Use Watcom's LIBC */
|
/* Use Watcom's LIBC */
|
||||||
#define HAVE_LIBC 1
|
#define HAVE_LIBC 1
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STDLIB_H 1
|
#define HAVE_STDLIB_H 1
|
||||||
#define HAVE_STDARG_H 1
|
#define HAVE_STDARG_H 1
|
||||||
#define HAVE_MALLOC_H 1
|
#define HAVE_MALLOC_H 1
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_STRINGS_H 1
|
#define HAVE_STRINGS_H 1
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_GETENV 1
|
#define HAVE_GETENV 1
|
||||||
#define HAVE_PUTENV 1
|
#define HAVE_PUTENV 1
|
||||||
#define HAVE_UNSETENV 1
|
#define HAVE_UNSETENV 1
|
||||||
#define HAVE_QSORT 1
|
#define HAVE_QSORT 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_BCOPY 1
|
#define HAVE_BCOPY 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MEMCMP 1
|
#define HAVE_MEMCMP 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE_STRLCPY 1
|
#define HAVE_STRLCPY 1
|
||||||
#define HAVE_STRLCAT 1
|
#define HAVE_STRLCAT 1
|
||||||
#define HAVE_STRDUP 1
|
#define HAVE_STRDUP 1
|
||||||
#define HAVE__STRREV 1
|
#define HAVE__STRREV 1
|
||||||
#define HAVE__STRUPR 1
|
#define HAVE__STRUPR 1
|
||||||
#define HAVE__STRLWR 1
|
#define HAVE__STRLWR 1
|
||||||
#define HAVE_INDEX 1
|
#define HAVE_INDEX 1
|
||||||
#define HAVE_RINDEX 1
|
#define HAVE_RINDEX 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_ITOA 1
|
#define HAVE_ITOA 1
|
||||||
#define HAVE__LTOA 1
|
#define HAVE__LTOA 1
|
||||||
#define HAVE__UITOA 1
|
#define HAVE__UITOA 1
|
||||||
#define HAVE__ULTOA 1
|
#define HAVE__ULTOA 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE__I64TOA 1
|
#define HAVE__I64TOA 1
|
||||||
#define HAVE__UI64TOA 1
|
#define HAVE__UI64TOA 1
|
||||||
#define HAVE_STRTOLL 1
|
#define HAVE_STRTOLL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_STRICMP 1
|
#define HAVE_STRICMP 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
#define HAVE_SNPRINTF 1
|
#define HAVE_SNPRINTF 1
|
||||||
#define HAVE_VSNPRINTF 1
|
#define HAVE_VSNPRINTF 1
|
||||||
#define HAVE_SETJMP 1
|
#define HAVE_SETJMP 1
|
||||||
#define HAVE_CLOCK_GETTIME 1
|
#define HAVE_CLOCK_GETTIME 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_DART 1
|
#define SDL_AUDIO_DRIVER_DART 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#define SDL_CDROM_OS2 1
|
#define SDL_CDROM_OS2 1
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#define SDL_JOYSTICK_OS2 1
|
#define SDL_JOYSTICK_OS2 1
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#define SDL_LOADSO_OS2 1
|
#define SDL_LOADSO_OS2 1
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREAD_OS2 1
|
#define SDL_THREAD_OS2 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#define SDL_TIMER_OS2 1
|
#define SDL_TIMER_OS2 1
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
#define SDL_VIDEO_DRIVER_OS2FS 1
|
#define SDL_VIDEO_DRIVER_OS2FS 1
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
/* Enable OpenGL support */
|
||||||
/* Nothing here yet for OS/2... :( */
|
/* Nothing here yet for OS/2... :( */
|
||||||
|
|
||||||
/* Enable assembly routines where available */
|
/* Enable assembly routines where available */
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
#define SDL_ASSEMBLY_ROUTINES 1
|
||||||
|
|
||||||
#endif /* _SDL_config_os2_h */
|
#endif /* _SDL_config_os2_h */
|
||||||
|
|
|
@ -1,180 +1,180 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_config_win32_h
|
#ifndef _SDL_config_win32_h
|
||||||
#define _SDL_config_win32_h
|
#define _SDL_config_win32_h
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
/* This is a set of defines to configure the SDL features */
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__DMC__)
|
#if defined(__GNUC__) || defined(__DMC__)
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
typedef signed __int8 int8_t;
|
typedef signed __int8 int8_t;
|
||||||
typedef unsigned __int8 uint8_t;
|
typedef unsigned __int8 uint8_t;
|
||||||
typedef signed __int16 int16_t;
|
typedef signed __int16 int16_t;
|
||||||
typedef unsigned __int16 uint16_t;
|
typedef unsigned __int16 uint16_t;
|
||||||
typedef signed __int32 int32_t;
|
typedef signed __int32 int32_t;
|
||||||
typedef unsigned __int32 uint32_t;
|
typedef unsigned __int32 uint32_t;
|
||||||
typedef signed __int64 int64_t;
|
typedef signed __int64 int64_t;
|
||||||
typedef unsigned __int64 uint64_t;
|
typedef unsigned __int64 uint64_t;
|
||||||
#ifndef _UINTPTR_T_DEFINED
|
#ifndef _UINTPTR_T_DEFINED
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
typedef unsigned __int64 uintptr_t;
|
typedef unsigned __int64 uintptr_t;
|
||||||
#else
|
#else
|
||||||
typedef unsigned int uintptr_t;
|
typedef unsigned int uintptr_t;
|
||||||
#endif
|
#endif
|
||||||
#define _UINTPTR_T_DEFINED
|
#define _UINTPTR_T_DEFINED
|
||||||
#endif
|
#endif
|
||||||
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||||
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
||||||
#define DWORD_PTR DWORD
|
#define DWORD_PTR DWORD
|
||||||
#endif
|
#endif
|
||||||
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
||||||
#define LONG_PTR LONG
|
#define LONG_PTR LONG
|
||||||
#endif
|
#endif
|
||||||
#else /* !__GNUC__ && !_MSC_VER */
|
#else /* !__GNUC__ && !_MSC_VER */
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef signed int int32_t;
|
typedef signed int int32_t;
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
typedef signed long long int64_t;
|
typedef signed long long int64_t;
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
#ifndef _SIZE_T_DEFINED_
|
#ifndef _SIZE_T_DEFINED_
|
||||||
#define _SIZE_T_DEFINED_
|
#define _SIZE_T_DEFINED_
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
#endif
|
#endif
|
||||||
typedef unsigned int uintptr_t;
|
typedef unsigned int uintptr_t;
|
||||||
#endif /* __GNUC__ || _MSC_VER */
|
#endif /* __GNUC__ || _MSC_VER */
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
/* Enabled for SDL 1.2 (binary compatibility) */
|
/* Enabled for SDL 1.2 (binary compatibility) */
|
||||||
#define HAVE_LIBC 1
|
#define HAVE_LIBC 1
|
||||||
#ifdef HAVE_LIBC
|
#ifdef HAVE_LIBC
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
#define HAVE_CALLOC 1
|
#define HAVE_CALLOC 1
|
||||||
#define HAVE_REALLOC 1
|
#define HAVE_REALLOC 1
|
||||||
#define HAVE_FREE 1
|
#define HAVE_FREE 1
|
||||||
#define HAVE_ALLOCA 1
|
#define HAVE_ALLOCA 1
|
||||||
#define HAVE_QSORT 1
|
#define HAVE_QSORT 1
|
||||||
#define HAVE_ABS 1
|
#define HAVE_ABS 1
|
||||||
#define HAVE_MEMSET 1
|
#define HAVE_MEMSET 1
|
||||||
#define HAVE_MEMCPY 1
|
#define HAVE_MEMCPY 1
|
||||||
#define HAVE_MEMMOVE 1
|
#define HAVE_MEMMOVE 1
|
||||||
#define HAVE_MEMCMP 1
|
#define HAVE_MEMCMP 1
|
||||||
#define HAVE_STRLEN 1
|
#define HAVE_STRLEN 1
|
||||||
#define HAVE__STRREV 1
|
#define HAVE__STRREV 1
|
||||||
#define HAVE__STRUPR 1
|
#define HAVE__STRUPR 1
|
||||||
#define HAVE__STRLWR 1
|
#define HAVE__STRLWR 1
|
||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
#define HAVE_ITOA 1
|
#define HAVE_ITOA 1
|
||||||
#define HAVE__LTOA 1
|
#define HAVE__LTOA 1
|
||||||
#define HAVE__ULTOA 1
|
#define HAVE__ULTOA 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOUL 1
|
#define HAVE_STRTOUL 1
|
||||||
#define HAVE_STRTOLL 1
|
#define HAVE_STRTOLL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
#define HAVE_ATOF 1
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE__STRICMP 1
|
#define HAVE__STRICMP 1
|
||||||
#define HAVE__STRNICMP 1
|
#define HAVE__STRNICMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
#else
|
#else
|
||||||
#define HAVE_STDARG_H 1
|
#define HAVE_STDARG_H 1
|
||||||
#define HAVE_STDDEF_H 1
|
#define HAVE_STDDEF_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||||
#endif
|
#endif
|
||||||
#define SDL_AUDIO_DRIVER_WAVEOUT 1
|
#define SDL_AUDIO_DRIVER_WAVEOUT 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
/* Enable various cdrom drivers */
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#define SDL_CDROM_DISABLED 1
|
#define SDL_CDROM_DISABLED 1
|
||||||
#else
|
#else
|
||||||
#define SDL_CDROM_WIN32 1
|
#define SDL_CDROM_WIN32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#define SDL_JOYSTICK_DISABLED 1
|
#define SDL_JOYSTICK_DISABLED 1
|
||||||
#else
|
#else
|
||||||
#define SDL_JOYSTICK_WINMM 1
|
#define SDL_JOYSTICK_WINMM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
#define SDL_LOADSO_WIN32 1
|
#define SDL_LOADSO_WIN32 1
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREAD_WIN32 1
|
#define SDL_THREAD_WIN32 1
|
||||||
|
|
||||||
/* Enable various timer systems */
|
/* Enable various timer systems */
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#define SDL_TIMER_WINCE 1
|
#define SDL_TIMER_WINCE 1
|
||||||
#else
|
#else
|
||||||
#define SDL_TIMER_WIN32 1
|
#define SDL_TIMER_WIN32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various video drivers */
|
/* Enable various video drivers */
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#define SDL_VIDEO_DRIVER_GAPI 1
|
#define SDL_VIDEO_DRIVER_GAPI 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#define SDL_VIDEO_DRIVER_DDRAW 1
|
#define SDL_VIDEO_DRIVER_DDRAW 1
|
||||||
#endif
|
#endif
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
#define SDL_VIDEO_DRIVER_WINDIB 1
|
#define SDL_VIDEO_DRIVER_WINDIB 1
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
/* Enable OpenGL support */
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#define SDL_VIDEO_OPENGL 1
|
#define SDL_VIDEO_OPENGL 1
|
||||||
#define SDL_VIDEO_OPENGL_WGL 1
|
#define SDL_VIDEO_OPENGL_WGL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||||
#ifndef _WIN64
|
#ifndef _WIN64
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
#define SDL_ASSEMBLY_ROUTINES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SDL_config_win32_h */
|
#endif /* _SDL_config_win32_h */
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* CPU feature detection for SDL */
|
/* CPU feature detection for SDL */
|
||||||
|
|
||||||
#ifndef _SDL_cpuinfo_h
|
#ifndef _SDL_cpuinfo_h
|
||||||
#define _SDL_cpuinfo_h
|
#define _SDL_cpuinfo_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function returns true if the CPU has the RDTSC instruction
|
/* This function returns true if the CPU has the RDTSC instruction
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has MMX features
|
/* This function returns true if the CPU has MMX features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has MMX Ext. features
|
/* This function returns true if the CPU has MMX Ext. features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has 3DNow features
|
/* This function returns true if the CPU has 3DNow features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has 3DNow! Ext. features
|
/* This function returns true if the CPU has 3DNow! Ext. features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has SSE features
|
/* This function returns true if the CPU has SSE features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has SSE2 features
|
/* This function returns true if the CPU has SSE2 features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||||
|
|
||||||
/* This function returns true if the CPU has AltiVec features
|
/* This function returns true if the CPU has AltiVec features
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_cpuinfo_h */
|
#endif /* _SDL_cpuinfo_h */
|
||||||
|
|
|
@ -1,194 +1,194 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Functions for reading and writing endian-specific values */
|
/* Functions for reading and writing endian-specific values */
|
||||||
|
|
||||||
#ifndef _SDL_endian_h
|
#ifndef _SDL_endian_h
|
||||||
#define _SDL_endian_h
|
#define _SDL_endian_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
/* The two types of endianness */
|
/* The two types of endianness */
|
||||||
#define SDL_LIL_ENDIAN 1234
|
#define SDL_LIL_ENDIAN 1234
|
||||||
#define SDL_BIG_ENDIAN 4321
|
#define SDL_BIG_ENDIAN 4321
|
||||||
|
|
||||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
||||||
#if defined(__hppa__) || \
|
#if defined(__hppa__) || \
|
||||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||||
defined(__sparc__)
|
defined(__sparc__)
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||||
#else
|
#else
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
#endif /* !SDL_BYTEORDER */
|
#endif /* !SDL_BYTEORDER */
|
||||||
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use inline functions for compilers that support them, and static
|
/* Use inline functions for compilers that support them, and static
|
||||||
functions for those that do not. Because these functions become
|
functions for those that do not. Because these functions become
|
||||||
static for compilers that do not support inline functions, this
|
static for compilers that do not support inline functions, this
|
||||||
header should only be included in files that actually use them.
|
header should only be included in files that actually use them.
|
||||||
*/
|
*/
|
||||||
#if defined(__GNUC__) && defined(__i386__) && \
|
#if defined(__GNUC__) && defined(__i386__) && \
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
|
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
|
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
Uint16 result;
|
Uint16 result;
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
||||||
return((x<<8)|(x>>8));
|
return((x<<8)|(x>>8));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__) && \
|
#if defined(__GNUC__) && defined(__i386__) && \
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswap %0" : "=r" (x) : "0" (x));
|
__asm__("bswap %0" : "=r" (x) : "0" (x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswapl %0" : "=r" (x) : "0" (x));
|
__asm__("bswapl %0" : "=r" (x) : "0" (x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
Uint32 result;
|
Uint32 result;
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
|
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
|
||||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
|
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
|
||||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
||||||
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SDL_HAS_64BIT_TYPE
|
#ifdef SDL_HAS_64BIT_TYPE
|
||||||
#if defined(__GNUC__) && defined(__i386__) && \
|
#if defined(__GNUC__) && defined(__i386__) && \
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
struct { Uint32 a,b; } s;
|
struct { Uint32 a,b; } s;
|
||||||
Uint64 u;
|
Uint64 u;
|
||||||
} v;
|
} v;
|
||||||
v.u = x;
|
v.u = x;
|
||||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||||
: "=r" (v.s.a), "=r" (v.s.b)
|
: "=r" (v.s.a), "=r" (v.s.b)
|
||||||
: "0" (v.s.a), "1" (v.s.b));
|
: "0" (v.s.a), "1" (v.s.b));
|
||||||
return v.u;
|
return v.u;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
__asm__("bswapq %0" : "=r" (x) : "0" (x));
|
__asm__("bswapq %0" : "=r" (x) : "0" (x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
Uint32 hi, lo;
|
Uint32 hi, lo;
|
||||||
|
|
||||||
/* Separate into high and low 32-bit values and swap them */
|
/* Separate into high and low 32-bit values and swap them */
|
||||||
lo = (Uint32)(x&0xFFFFFFFF);
|
lo = (Uint32)(x&0xFFFFFFFF);
|
||||||
x >>= 32;
|
x >>= 32;
|
||||||
hi = (Uint32)(x&0xFFFFFFFF);
|
hi = (Uint32)(x&0xFFFFFFFF);
|
||||||
x = SDL_Swap32(lo);
|
x = SDL_Swap32(lo);
|
||||||
x <<= 32;
|
x <<= 32;
|
||||||
x |= SDL_Swap32(hi);
|
x |= SDL_Swap32(hi);
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* This is mainly to keep compilers from complaining in SDL code.
|
/* This is mainly to keep compilers from complaining in SDL code.
|
||||||
If there is no real 64-bit datatype, then compilers will complain about
|
If there is no real 64-bit datatype, then compilers will complain about
|
||||||
the fake 64-bit datatype that SDL provides when it compiles user code.
|
the fake 64-bit datatype that SDL provides when it compiles user code.
|
||||||
*/
|
*/
|
||||||
#define SDL_Swap64(X) (X)
|
#define SDL_Swap64(X) (X)
|
||||||
#endif /* SDL_HAS_64BIT_TYPE */
|
#endif /* SDL_HAS_64BIT_TYPE */
|
||||||
|
|
||||||
|
|
||||||
/* Byteswap item from the specified endianness to the native endianness */
|
/* Byteswap item from the specified endianness to the native endianness */
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
#define SDL_SwapLE16(X) (X)
|
#define SDL_SwapLE16(X) (X)
|
||||||
#define SDL_SwapLE32(X) (X)
|
#define SDL_SwapLE32(X) (X)
|
||||||
#define SDL_SwapLE64(X) (X)
|
#define SDL_SwapLE64(X) (X)
|
||||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||||
#else
|
#else
|
||||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||||
#define SDL_SwapBE16(X) (X)
|
#define SDL_SwapBE16(X) (X)
|
||||||
#define SDL_SwapBE32(X) (X)
|
#define SDL_SwapBE32(X) (X)
|
||||||
#define SDL_SwapBE64(X) (X)
|
#define SDL_SwapBE64(X) (X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_endian_h */
|
#endif /* _SDL_endian_h */
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Simple error message routines for SDL */
|
/* Simple error message routines for SDL */
|
||||||
|
|
||||||
#ifndef _SDL_error_h
|
#ifndef _SDL_error_h
|
||||||
#define _SDL_error_h
|
#define _SDL_error_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions */
|
/* Public functions */
|
||||||
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
||||||
extern DECLSPEC char * SDLCALL SDL_GetError(void);
|
extern DECLSPEC char * SDLCALL SDL_GetError(void);
|
||||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||||
|
|
||||||
/* Private error message function - used internally */
|
/* Private error message function - used internally */
|
||||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_ENOMEM,
|
SDL_ENOMEM,
|
||||||
SDL_EFREAD,
|
SDL_EFREAD,
|
||||||
SDL_EFWRITE,
|
SDL_EFWRITE,
|
||||||
SDL_EFSEEK,
|
SDL_EFSEEK,
|
||||||
SDL_UNSUPPORTED,
|
SDL_UNSUPPORTED,
|
||||||
SDL_LASTERROR
|
SDL_LASTERROR
|
||||||
} SDL_errorcode;
|
} SDL_errorcode;
|
||||||
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_error_h */
|
#endif /* _SDL_error_h */
|
||||||
|
|
|
@ -1,337 +1,337 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL event handling */
|
/* Include file for SDL event handling */
|
||||||
|
|
||||||
#ifndef _SDL_events_h
|
#ifndef _SDL_events_h
|
||||||
#define _SDL_events_h
|
#define _SDL_events_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_active.h"
|
#include "SDL_active.h"
|
||||||
#include "SDL_keyboard.h"
|
#include "SDL_keyboard.h"
|
||||||
#include "SDL_mouse.h"
|
#include "SDL_mouse.h"
|
||||||
#include "SDL_joystick.h"
|
#include "SDL_joystick.h"
|
||||||
#include "SDL_quit.h"
|
#include "SDL_quit.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* General keyboard/mouse state definitions */
|
/* General keyboard/mouse state definitions */
|
||||||
#define SDL_RELEASED 0
|
#define SDL_RELEASED 0
|
||||||
#define SDL_PRESSED 1
|
#define SDL_PRESSED 1
|
||||||
|
|
||||||
/* Event enumerations */
|
/* Event enumerations */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_NOEVENT = 0, /* Unused (do not remove) */
|
SDL_NOEVENT = 0, /* Unused (do not remove) */
|
||||||
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
|
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
|
||||||
SDL_KEYDOWN, /* Keys pressed */
|
SDL_KEYDOWN, /* Keys pressed */
|
||||||
SDL_KEYUP, /* Keys released */
|
SDL_KEYUP, /* Keys released */
|
||||||
SDL_MOUSEMOTION, /* Mouse moved */
|
SDL_MOUSEMOTION, /* Mouse moved */
|
||||||
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
|
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
|
||||||
SDL_MOUSEBUTTONUP, /* Mouse button released */
|
SDL_MOUSEBUTTONUP, /* Mouse button released */
|
||||||
SDL_JOYAXISMOTION, /* Joystick axis motion */
|
SDL_JOYAXISMOTION, /* Joystick axis motion */
|
||||||
SDL_JOYBALLMOTION, /* Joystick trackball motion */
|
SDL_JOYBALLMOTION, /* Joystick trackball motion */
|
||||||
SDL_JOYHATMOTION, /* Joystick hat position change */
|
SDL_JOYHATMOTION, /* Joystick hat position change */
|
||||||
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
|
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
|
||||||
SDL_JOYBUTTONUP, /* Joystick button released */
|
SDL_JOYBUTTONUP, /* Joystick button released */
|
||||||
SDL_QUIT, /* User-requested quit */
|
SDL_QUIT, /* User-requested quit */
|
||||||
SDL_SYSWMEVENT, /* System specific event */
|
SDL_SYSWMEVENT, /* System specific event */
|
||||||
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
|
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
|
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
|
||||||
SDL_VIDEORESIZE, /* User resized video mode */
|
SDL_VIDEORESIZE, /* User resized video mode */
|
||||||
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
|
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
|
||||||
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
|
||||||
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
|
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
|
||||||
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
||||||
SDL_USEREVENT = 24,
|
SDL_USEREVENT = 24,
|
||||||
/* This last event is only for bounding internal arrays
|
/* This last event is only for bounding internal arrays
|
||||||
It is the number of bits in the event mask datatype -- Uint32
|
It is the number of bits in the event mask datatype -- Uint32
|
||||||
*/
|
*/
|
||||||
SDL_NUMEVENTS = 32
|
SDL_NUMEVENTS = 32
|
||||||
} SDL_EventType;
|
} SDL_EventType;
|
||||||
|
|
||||||
/* Predefined event masks */
|
/* Predefined event masks */
|
||||||
#define SDL_EVENTMASK(X) (1<<(X))
|
#define SDL_EVENTMASK(X) (1<<(X))
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
|
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
|
||||||
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
||||||
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
||||||
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
|
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
|
||||||
SDL_EVENTMASK(SDL_KEYUP),
|
SDL_EVENTMASK(SDL_KEYUP),
|
||||||
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
||||||
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
||||||
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||||
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
|
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
|
||||||
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
|
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
|
||||||
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||||
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
||||||
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
||||||
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
||||||
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
||||||
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||||
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
|
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
|
||||||
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
|
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
|
||||||
SDL_EVENTMASK(SDL_JOYHATMOTION)|
|
SDL_EVENTMASK(SDL_JOYHATMOTION)|
|
||||||
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
|
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
|
||||||
SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||||
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
|
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
|
||||||
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
|
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
|
||||||
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
||||||
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
|
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
|
||||||
} SDL_EventMask ;
|
} SDL_EventMask ;
|
||||||
#define SDL_ALLEVENTS 0xFFFFFFFF
|
#define SDL_ALLEVENTS 0xFFFFFFFF
|
||||||
|
|
||||||
/* Application visibility event structure */
|
/* Application visibility event structure */
|
||||||
typedef struct SDL_ActiveEvent {
|
typedef struct SDL_ActiveEvent {
|
||||||
Uint8 type; /* SDL_ACTIVEEVENT */
|
Uint8 type; /* SDL_ACTIVEEVENT */
|
||||||
Uint8 gain; /* Whether given states were gained or lost (1/0) */
|
Uint8 gain; /* Whether given states were gained or lost (1/0) */
|
||||||
Uint8 state; /* A mask of the focus states */
|
Uint8 state; /* A mask of the focus states */
|
||||||
} SDL_ActiveEvent;
|
} SDL_ActiveEvent;
|
||||||
|
|
||||||
/* Keyboard event structure */
|
/* Keyboard event structure */
|
||||||
typedef struct SDL_KeyboardEvent {
|
typedef struct SDL_KeyboardEvent {
|
||||||
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
|
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
|
||||||
Uint8 which; /* The keyboard device index */
|
Uint8 which; /* The keyboard device index */
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||||
SDL_keysym keysym;
|
SDL_keysym keysym;
|
||||||
} SDL_KeyboardEvent;
|
} SDL_KeyboardEvent;
|
||||||
|
|
||||||
/* Mouse motion event structure */
|
/* Mouse motion event structure */
|
||||||
typedef struct SDL_MouseMotionEvent {
|
typedef struct SDL_MouseMotionEvent {
|
||||||
Uint8 type; /* SDL_MOUSEMOTION */
|
Uint8 type; /* SDL_MOUSEMOTION */
|
||||||
Uint8 which; /* The mouse device index */
|
Uint8 which; /* The mouse device index */
|
||||||
Uint8 state; /* The current button state */
|
Uint8 state; /* The current button state */
|
||||||
Uint16 x, y; /* The X/Y coordinates of the mouse */
|
Uint16 x, y; /* The X/Y coordinates of the mouse */
|
||||||
Sint16 xrel; /* The relative motion in the X direction */
|
Sint16 xrel; /* The relative motion in the X direction */
|
||||||
Sint16 yrel; /* The relative motion in the Y direction */
|
Sint16 yrel; /* The relative motion in the Y direction */
|
||||||
} SDL_MouseMotionEvent;
|
} SDL_MouseMotionEvent;
|
||||||
|
|
||||||
/* Mouse button event structure */
|
/* Mouse button event structure */
|
||||||
typedef struct SDL_MouseButtonEvent {
|
typedef struct SDL_MouseButtonEvent {
|
||||||
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
||||||
Uint8 which; /* The mouse device index */
|
Uint8 which; /* The mouse device index */
|
||||||
Uint8 button; /* The mouse button index */
|
Uint8 button; /* The mouse button index */
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||||
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
|
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
|
||||||
} SDL_MouseButtonEvent;
|
} SDL_MouseButtonEvent;
|
||||||
|
|
||||||
/* Joystick axis motion event structure */
|
/* Joystick axis motion event structure */
|
||||||
typedef struct SDL_JoyAxisEvent {
|
typedef struct SDL_JoyAxisEvent {
|
||||||
Uint8 type; /* SDL_JOYAXISMOTION */
|
Uint8 type; /* SDL_JOYAXISMOTION */
|
||||||
Uint8 which; /* The joystick device index */
|
Uint8 which; /* The joystick device index */
|
||||||
Uint8 axis; /* The joystick axis index */
|
Uint8 axis; /* The joystick axis index */
|
||||||
Sint16 value; /* The axis value (range: -32768 to 32767) */
|
Sint16 value; /* The axis value (range: -32768 to 32767) */
|
||||||
} SDL_JoyAxisEvent;
|
} SDL_JoyAxisEvent;
|
||||||
|
|
||||||
/* Joystick trackball motion event structure */
|
/* Joystick trackball motion event structure */
|
||||||
typedef struct SDL_JoyBallEvent {
|
typedef struct SDL_JoyBallEvent {
|
||||||
Uint8 type; /* SDL_JOYBALLMOTION */
|
Uint8 type; /* SDL_JOYBALLMOTION */
|
||||||
Uint8 which; /* The joystick device index */
|
Uint8 which; /* The joystick device index */
|
||||||
Uint8 ball; /* The joystick trackball index */
|
Uint8 ball; /* The joystick trackball index */
|
||||||
Sint16 xrel; /* The relative motion in the X direction */
|
Sint16 xrel; /* The relative motion in the X direction */
|
||||||
Sint16 yrel; /* The relative motion in the Y direction */
|
Sint16 yrel; /* The relative motion in the Y direction */
|
||||||
} SDL_JoyBallEvent;
|
} SDL_JoyBallEvent;
|
||||||
|
|
||||||
/* Joystick hat position change event structure */
|
/* Joystick hat position change event structure */
|
||||||
typedef struct SDL_JoyHatEvent {
|
typedef struct SDL_JoyHatEvent {
|
||||||
Uint8 type; /* SDL_JOYHATMOTION */
|
Uint8 type; /* SDL_JOYHATMOTION */
|
||||||
Uint8 which; /* The joystick device index */
|
Uint8 which; /* The joystick device index */
|
||||||
Uint8 hat; /* The joystick hat index */
|
Uint8 hat; /* The joystick hat index */
|
||||||
Uint8 value; /* The hat position value:
|
Uint8 value; /* The hat position value:
|
||||||
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
||||||
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
||||||
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
||||||
Note that zero means the POV is centered.
|
Note that zero means the POV is centered.
|
||||||
*/
|
*/
|
||||||
} SDL_JoyHatEvent;
|
} SDL_JoyHatEvent;
|
||||||
|
|
||||||
/* Joystick button event structure */
|
/* Joystick button event structure */
|
||||||
typedef struct SDL_JoyButtonEvent {
|
typedef struct SDL_JoyButtonEvent {
|
||||||
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
||||||
Uint8 which; /* The joystick device index */
|
Uint8 which; /* The joystick device index */
|
||||||
Uint8 button; /* The joystick button index */
|
Uint8 button; /* The joystick button index */
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||||
} SDL_JoyButtonEvent;
|
} SDL_JoyButtonEvent;
|
||||||
|
|
||||||
/* The "window resized" event
|
/* The "window resized" event
|
||||||
When you get this event, you are responsible for setting a new video
|
When you get this event, you are responsible for setting a new video
|
||||||
mode with the new width and height.
|
mode with the new width and height.
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_ResizeEvent {
|
typedef struct SDL_ResizeEvent {
|
||||||
Uint8 type; /* SDL_VIDEORESIZE */
|
Uint8 type; /* SDL_VIDEORESIZE */
|
||||||
int w; /* New width */
|
int w; /* New width */
|
||||||
int h; /* New height */
|
int h; /* New height */
|
||||||
} SDL_ResizeEvent;
|
} SDL_ResizeEvent;
|
||||||
|
|
||||||
/* The "screen redraw" event */
|
/* The "screen redraw" event */
|
||||||
typedef struct SDL_ExposeEvent {
|
typedef struct SDL_ExposeEvent {
|
||||||
Uint8 type; /* SDL_VIDEOEXPOSE */
|
Uint8 type; /* SDL_VIDEOEXPOSE */
|
||||||
} SDL_ExposeEvent;
|
} SDL_ExposeEvent;
|
||||||
|
|
||||||
/* The "quit requested" event */
|
/* The "quit requested" event */
|
||||||
typedef struct SDL_QuitEvent {
|
typedef struct SDL_QuitEvent {
|
||||||
Uint8 type; /* SDL_QUIT */
|
Uint8 type; /* SDL_QUIT */
|
||||||
} SDL_QuitEvent;
|
} SDL_QuitEvent;
|
||||||
|
|
||||||
/* A user-defined event type */
|
/* A user-defined event type */
|
||||||
typedef struct SDL_UserEvent {
|
typedef struct SDL_UserEvent {
|
||||||
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
||||||
int code; /* User defined event code */
|
int code; /* User defined event code */
|
||||||
void *data1; /* User defined data pointer */
|
void *data1; /* User defined data pointer */
|
||||||
void *data2; /* User defined data pointer */
|
void *data2; /* User defined data pointer */
|
||||||
} SDL_UserEvent;
|
} SDL_UserEvent;
|
||||||
|
|
||||||
/* If you want to use this event, you should include SDL_syswm.h */
|
/* If you want to use this event, you should include SDL_syswm.h */
|
||||||
struct SDL_SysWMmsg;
|
struct SDL_SysWMmsg;
|
||||||
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
||||||
typedef struct SDL_SysWMEvent {
|
typedef struct SDL_SysWMEvent {
|
||||||
Uint8 type;
|
Uint8 type;
|
||||||
SDL_SysWMmsg *msg;
|
SDL_SysWMmsg *msg;
|
||||||
} SDL_SysWMEvent;
|
} SDL_SysWMEvent;
|
||||||
|
|
||||||
/* General event structure */
|
/* General event structure */
|
||||||
typedef union SDL_Event {
|
typedef union SDL_Event {
|
||||||
Uint8 type;
|
Uint8 type;
|
||||||
SDL_ActiveEvent active;
|
SDL_ActiveEvent active;
|
||||||
SDL_KeyboardEvent key;
|
SDL_KeyboardEvent key;
|
||||||
SDL_MouseMotionEvent motion;
|
SDL_MouseMotionEvent motion;
|
||||||
SDL_MouseButtonEvent button;
|
SDL_MouseButtonEvent button;
|
||||||
SDL_JoyAxisEvent jaxis;
|
SDL_JoyAxisEvent jaxis;
|
||||||
SDL_JoyBallEvent jball;
|
SDL_JoyBallEvent jball;
|
||||||
SDL_JoyHatEvent jhat;
|
SDL_JoyHatEvent jhat;
|
||||||
SDL_JoyButtonEvent jbutton;
|
SDL_JoyButtonEvent jbutton;
|
||||||
SDL_ResizeEvent resize;
|
SDL_ResizeEvent resize;
|
||||||
SDL_ExposeEvent expose;
|
SDL_ExposeEvent expose;
|
||||||
SDL_QuitEvent quit;
|
SDL_QuitEvent quit;
|
||||||
SDL_UserEvent user;
|
SDL_UserEvent user;
|
||||||
SDL_SysWMEvent syswm;
|
SDL_SysWMEvent syswm;
|
||||||
} SDL_Event;
|
} SDL_Event;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/* Pumps the event loop, gathering events from the input devices.
|
/* Pumps the event loop, gathering events from the input devices.
|
||||||
This function updates the event queue and internal input device state.
|
This function updates the event queue and internal input device state.
|
||||||
This should only be run in the thread that sets the video mode.
|
This should only be run in the thread that sets the video mode.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
||||||
|
|
||||||
/* Checks the event queue for messages and optionally returns them.
|
/* Checks the event queue for messages and optionally returns them.
|
||||||
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
||||||
the back of the event queue.
|
the back of the event queue.
|
||||||
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
||||||
of the event queue, matching 'mask', will be returned and will not
|
of the event queue, matching 'mask', will be returned and will not
|
||||||
be removed from the queue.
|
be removed from the queue.
|
||||||
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
||||||
of the event queue, matching 'mask', will be returned and will be
|
of the event queue, matching 'mask', will be returned and will be
|
||||||
removed from the queue.
|
removed from the queue.
|
||||||
This function returns the number of events actually stored, or -1
|
This function returns the number of events actually stored, or -1
|
||||||
if there was an error. This function is thread-safe.
|
if there was an error. This function is thread-safe.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_ADDEVENT,
|
SDL_ADDEVENT,
|
||||||
SDL_PEEKEVENT,
|
SDL_PEEKEVENT,
|
||||||
SDL_GETEVENT
|
SDL_GETEVENT
|
||||||
} SDL_eventaction;
|
} SDL_eventaction;
|
||||||
/* */
|
/* */
|
||||||
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
|
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
|
||||||
SDL_eventaction action, Uint32 mask);
|
SDL_eventaction action, Uint32 mask);
|
||||||
|
|
||||||
/* Polls for currently pending events, and returns 1 if there are any pending
|
/* Polls for currently pending events, and returns 1 if there are any pending
|
||||||
events, or 0 if there are none available. If 'event' is not NULL, the next
|
events, or 0 if there are none available. If 'event' is not NULL, the next
|
||||||
event is removed from the queue and stored in that area.
|
event is removed from the queue and stored in that area.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
|
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
|
||||||
|
|
||||||
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
||||||
was an error while waiting for events. If 'event' is not NULL, the next
|
was an error while waiting for events. If 'event' is not NULL, the next
|
||||||
event is removed from the queue and stored in that area.
|
event is removed from the queue and stored in that area.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
|
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
|
||||||
|
|
||||||
/* Add an event to the event queue.
|
/* Add an event to the event queue.
|
||||||
This function returns 0 on success, or -1 if the event queue was full
|
This function returns 0 on success, or -1 if the event queue was full
|
||||||
or there was some other error.
|
or there was some other error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
|
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function sets up a filter to process all events before they
|
This function sets up a filter to process all events before they
|
||||||
change internal state and are posted to the internal event queue.
|
change internal state and are posted to the internal event queue.
|
||||||
|
|
||||||
The filter is protypted as:
|
The filter is protypted as:
|
||||||
*/
|
*/
|
||||||
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
|
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
|
||||||
/*
|
/*
|
||||||
If the filter returns 1, then the event will be added to the internal queue.
|
If the filter returns 1, then the event will be added to the internal queue.
|
||||||
If it returns 0, then the event will be dropped from the queue, but the
|
If it returns 0, then the event will be dropped from the queue, but the
|
||||||
internal state will still be updated. This allows selective filtering of
|
internal state will still be updated. This allows selective filtering of
|
||||||
dynamically arriving events.
|
dynamically arriving events.
|
||||||
|
|
||||||
WARNING: Be very careful of what you do in the event filter function, as
|
WARNING: Be very careful of what you do in the event filter function, as
|
||||||
it may run in a different thread!
|
it may run in a different thread!
|
||||||
|
|
||||||
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
||||||
event filter is only called when the window manager desires to close the
|
event filter is only called when the window manager desires to close the
|
||||||
application window. If the event filter returns 1, then the window will
|
application window. If the event filter returns 1, then the window will
|
||||||
be closed, otherwise the window will remain open if possible.
|
be closed, otherwise the window will remain open if possible.
|
||||||
If the quit event is generated by an interrupt signal, it will bypass the
|
If the quit event is generated by an interrupt signal, it will bypass the
|
||||||
internal queue and be delivered to the application at the next event poll.
|
internal queue and be delivered to the application at the next event poll.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
|
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return the current event filter - can be used to "chain" filters.
|
Return the current event filter - can be used to "chain" filters.
|
||||||
If there is no event filter set, this function returns NULL.
|
If there is no event filter set, this function returns NULL.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function allows you to set the state of processing certain events.
|
This function allows you to set the state of processing certain events.
|
||||||
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
||||||
from the event queue and will not event be filtered.
|
from the event queue and will not event be filtered.
|
||||||
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
||||||
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
||||||
current processing state of the specified event.
|
current processing state of the specified event.
|
||||||
*/
|
*/
|
||||||
#define SDL_QUERY -1
|
#define SDL_QUERY -1
|
||||||
#define SDL_IGNORE 0
|
#define SDL_IGNORE 0
|
||||||
#define SDL_DISABLE 0
|
#define SDL_DISABLE 0
|
||||||
#define SDL_ENABLE 1
|
#define SDL_ENABLE 1
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_events_h */
|
#endif /* _SDL_events_h */
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* DEPRECATED */
|
/* DEPRECATED */
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
|
@ -1,167 +1,167 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL joystick event handling */
|
/* Include file for SDL joystick event handling */
|
||||||
|
|
||||||
#ifndef _SDL_joystick_h
|
#ifndef _SDL_joystick_h
|
||||||
#define _SDL_joystick_h
|
#define _SDL_joystick_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In order to use these functions, SDL_Init() must have been called
|
/* In order to use these functions, SDL_Init() must have been called
|
||||||
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
||||||
for joysticks, and load appropriate drivers.
|
for joysticks, and load appropriate drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The joystick structure used to identify an SDL joystick */
|
/* The joystick structure used to identify an SDL joystick */
|
||||||
struct _SDL_Joystick;
|
struct _SDL_Joystick;
|
||||||
typedef struct _SDL_Joystick SDL_Joystick;
|
typedef struct _SDL_Joystick SDL_Joystick;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
/*
|
/*
|
||||||
* Count the number of joysticks attached to the system
|
* Count the number of joysticks attached to the system
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the implementation dependent name of a joystick.
|
* Get the implementation dependent name of a joystick.
|
||||||
* This can be called before any joysticks are opened.
|
* This can be called before any joysticks are opened.
|
||||||
* If no name can be found, this function returns NULL.
|
* If no name can be found, this function returns NULL.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
|
extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a joystick for use - the index passed as an argument refers to
|
* Open a joystick for use - the index passed as an argument refers to
|
||||||
* the N'th joystick on the system. This index is the value which will
|
* the N'th joystick on the system. This index is the value which will
|
||||||
* identify this joystick in future joystick events.
|
* identify this joystick in future joystick events.
|
||||||
*
|
*
|
||||||
* This function returns a joystick identifier, or NULL if an error occurred.
|
* This function returns a joystick identifier, or NULL if an error occurred.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
|
extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
|
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the device index of an opened joystick.
|
* Get the device index of an opened joystick.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the number of general axis controls on a joystick
|
* Get the number of general axis controls on a joystick
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the number of trackballs on a joystick
|
* Get the number of trackballs on a joystick
|
||||||
* Joystick trackballs have only relative motion events associated
|
* Joystick trackballs have only relative motion events associated
|
||||||
* with them and their state cannot be polled.
|
* with them and their state cannot be polled.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the number of POV hats on a joystick
|
* Get the number of POV hats on a joystick
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the number of buttons on a joystick
|
* Get the number of buttons on a joystick
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the current state of the open joysticks.
|
* Update the current state of the open joysticks.
|
||||||
* This is called automatically by the event loop if any joystick
|
* This is called automatically by the event loop if any joystick
|
||||||
* events are enabled.
|
* events are enabled.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable/disable joystick event polling.
|
* Enable/disable joystick event polling.
|
||||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
||||||
* yourself and check the state of the joystick when you want joystick
|
* yourself and check the state of the joystick when you want joystick
|
||||||
* information.
|
* information.
|
||||||
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current state of an axis control on a joystick
|
* Get the current state of an axis control on a joystick
|
||||||
* The state is a value ranging from -32768 to 32767.
|
* The state is a value ranging from -32768 to 32767.
|
||||||
* The axis indices start at index 0.
|
* The axis indices start at index 0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current state of a POV hat on a joystick
|
* Get the current state of a POV hat on a joystick
|
||||||
* The return value is one of the following positions:
|
* The return value is one of the following positions:
|
||||||
*/
|
*/
|
||||||
#define SDL_HAT_CENTERED 0x00
|
#define SDL_HAT_CENTERED 0x00
|
||||||
#define SDL_HAT_UP 0x01
|
#define SDL_HAT_UP 0x01
|
||||||
#define SDL_HAT_RIGHT 0x02
|
#define SDL_HAT_RIGHT 0x02
|
||||||
#define SDL_HAT_DOWN 0x04
|
#define SDL_HAT_DOWN 0x04
|
||||||
#define SDL_HAT_LEFT 0x08
|
#define SDL_HAT_LEFT 0x08
|
||||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||||
/*
|
/*
|
||||||
* The hat indices start at index 0.
|
* The hat indices start at index 0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the ball axis change since the last poll
|
* Get the ball axis change since the last poll
|
||||||
* This returns 0, or -1 if you passed it invalid parameters.
|
* This returns 0, or -1 if you passed it invalid parameters.
|
||||||
* The ball indices start at index 0.
|
* The ball indices start at index 0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current state of a button on a joystick
|
* Get the current state of a button on a joystick
|
||||||
* The button indices start at index 0.
|
* The button indices start at index 0.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close a joystick previously opened with SDL_JoystickOpen()
|
* Close a joystick previously opened with SDL_JoystickOpen()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_joystick_h */
|
#endif /* _SDL_joystick_h */
|
||||||
|
|
|
@ -1,121 +1,121 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL keyboard event handling */
|
/* Include file for SDL keyboard event handling */
|
||||||
|
|
||||||
#ifndef _SDL_keyboard_h
|
#ifndef _SDL_keyboard_h
|
||||||
#define _SDL_keyboard_h
|
#define _SDL_keyboard_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_keysym.h"
|
#include "SDL_keysym.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Keysym structure
|
/* Keysym structure
|
||||||
- The scancode is hardware dependent, and should not be used by general
|
- The scancode is hardware dependent, and should not be used by general
|
||||||
applications. If no hardware scancode is available, it will be 0.
|
applications. If no hardware scancode is available, it will be 0.
|
||||||
|
|
||||||
- The 'unicode' translated character is only available when character
|
- The 'unicode' translated character is only available when character
|
||||||
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
|
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
|
||||||
this is a UNICODE character corresponding to the keypress. If the
|
this is a UNICODE character corresponding to the keypress. If the
|
||||||
high 9 bits of the character are 0, then this maps to the equivalent
|
high 9 bits of the character are 0, then this maps to the equivalent
|
||||||
ASCII character:
|
ASCII character:
|
||||||
char ch;
|
char ch;
|
||||||
if ( (keysym.unicode & 0xFF80) == 0 ) {
|
if ( (keysym.unicode & 0xFF80) == 0 ) {
|
||||||
ch = keysym.unicode & 0x7F;
|
ch = keysym.unicode & 0x7F;
|
||||||
} else {
|
} else {
|
||||||
An international character..
|
An international character..
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_keysym {
|
typedef struct SDL_keysym {
|
||||||
Uint8 scancode; /* hardware specific scancode */
|
Uint8 scancode; /* hardware specific scancode */
|
||||||
SDLKey sym; /* SDL virtual keysym */
|
SDLKey sym; /* SDL virtual keysym */
|
||||||
SDLMod mod; /* current key modifiers */
|
SDLMod mod; /* current key modifiers */
|
||||||
Uint16 unicode; /* translated character */
|
Uint16 unicode; /* translated character */
|
||||||
} SDL_keysym;
|
} SDL_keysym;
|
||||||
|
|
||||||
/* This is the mask which refers to all hotkey bindings */
|
/* This is the mask which refers to all hotkey bindings */
|
||||||
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
|
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
/*
|
/*
|
||||||
* Enable/Disable UNICODE translation of keyboard input.
|
* Enable/Disable UNICODE translation of keyboard input.
|
||||||
* This translation has some overhead, so translation defaults off.
|
* This translation has some overhead, so translation defaults off.
|
||||||
* If 'enable' is 1, translation is enabled.
|
* If 'enable' is 1, translation is enabled.
|
||||||
* If 'enable' is 0, translation is disabled.
|
* If 'enable' is 0, translation is disabled.
|
||||||
* If 'enable' is -1, the translation state is not changed.
|
* If 'enable' is -1, the translation state is not changed.
|
||||||
* It returns the previous state of keyboard translation.
|
* It returns the previous state of keyboard translation.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
|
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
|
||||||
* 'delay' is the initial delay in ms between the time when a key is
|
* 'delay' is the initial delay in ms between the time when a key is
|
||||||
* pressed, and keyboard repeat begins.
|
* pressed, and keyboard repeat begins.
|
||||||
* 'interval' is the time in ms between keyboard repeat events.
|
* 'interval' is the time in ms between keyboard repeat events.
|
||||||
*/
|
*/
|
||||||
#define SDL_DEFAULT_REPEAT_DELAY 500
|
#define SDL_DEFAULT_REPEAT_DELAY 500
|
||||||
#define SDL_DEFAULT_REPEAT_INTERVAL 30
|
#define SDL_DEFAULT_REPEAT_INTERVAL 30
|
||||||
/*
|
/*
|
||||||
* If 'delay' is set to 0, keyboard repeat is disabled.
|
* If 'delay' is set to 0, keyboard repeat is disabled.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
||||||
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a snapshot of the current state of the keyboard.
|
* Get a snapshot of the current state of the keyboard.
|
||||||
* Returns an array of keystates, indexed by the SDLK_* syms.
|
* Returns an array of keystates, indexed by the SDLK_* syms.
|
||||||
* Used:
|
* Used:
|
||||||
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||||
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
|
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current key modifier state
|
* Get the current key modifier state
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the current key modifier state
|
* Set the current key modifier state
|
||||||
* This does not change the keyboard state, only the key modifier flags.
|
* This does not change the keyboard state, only the key modifier flags.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the name of an SDL virtual keysym
|
* Get the name of an SDL virtual keysym
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
|
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_keyboard_h */
|
#endif /* _SDL_keyboard_h */
|
||||||
|
|
|
@ -1,311 +1,311 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_keysym_h
|
#ifndef _SDL_keysym_h
|
||||||
#define _SDL_keysym_h
|
#define _SDL_keysym_h
|
||||||
|
|
||||||
/* What we really want is a mapping of every raw key on the keyboard.
|
/* What we really want is a mapping of every raw key on the keyboard.
|
||||||
To support international keyboards, we use the range 0xA1 - 0xFF
|
To support international keyboards, we use the range 0xA1 - 0xFF
|
||||||
as international virtual keycodes. We'll follow in the footsteps of X11...
|
as international virtual keycodes. We'll follow in the footsteps of X11...
|
||||||
The names of the keys
|
The names of the keys
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
||||||
SDLK_UNKNOWN = 0,
|
SDLK_UNKNOWN = 0,
|
||||||
SDLK_FIRST = 0,
|
SDLK_FIRST = 0,
|
||||||
SDLK_BACKSPACE = 8,
|
SDLK_BACKSPACE = 8,
|
||||||
SDLK_TAB = 9,
|
SDLK_TAB = 9,
|
||||||
SDLK_CLEAR = 12,
|
SDLK_CLEAR = 12,
|
||||||
SDLK_RETURN = 13,
|
SDLK_RETURN = 13,
|
||||||
SDLK_PAUSE = 19,
|
SDLK_PAUSE = 19,
|
||||||
SDLK_ESCAPE = 27,
|
SDLK_ESCAPE = 27,
|
||||||
SDLK_SPACE = 32,
|
SDLK_SPACE = 32,
|
||||||
SDLK_EXCLAIM = 33,
|
SDLK_EXCLAIM = 33,
|
||||||
SDLK_QUOTEDBL = 34,
|
SDLK_QUOTEDBL = 34,
|
||||||
SDLK_HASH = 35,
|
SDLK_HASH = 35,
|
||||||
SDLK_DOLLAR = 36,
|
SDLK_DOLLAR = 36,
|
||||||
SDLK_AMPERSAND = 38,
|
SDLK_AMPERSAND = 38,
|
||||||
SDLK_QUOTE = 39,
|
SDLK_QUOTE = 39,
|
||||||
SDLK_LEFTPAREN = 40,
|
SDLK_LEFTPAREN = 40,
|
||||||
SDLK_RIGHTPAREN = 41,
|
SDLK_RIGHTPAREN = 41,
|
||||||
SDLK_ASTERISK = 42,
|
SDLK_ASTERISK = 42,
|
||||||
SDLK_PLUS = 43,
|
SDLK_PLUS = 43,
|
||||||
SDLK_COMMA = 44,
|
SDLK_COMMA = 44,
|
||||||
SDLK_MINUS = 45,
|
SDLK_MINUS = 45,
|
||||||
SDLK_PERIOD = 46,
|
SDLK_PERIOD = 46,
|
||||||
SDLK_SLASH = 47,
|
SDLK_SLASH = 47,
|
||||||
SDLK_0 = 48,
|
SDLK_0 = 48,
|
||||||
SDLK_1 = 49,
|
SDLK_1 = 49,
|
||||||
SDLK_2 = 50,
|
SDLK_2 = 50,
|
||||||
SDLK_3 = 51,
|
SDLK_3 = 51,
|
||||||
SDLK_4 = 52,
|
SDLK_4 = 52,
|
||||||
SDLK_5 = 53,
|
SDLK_5 = 53,
|
||||||
SDLK_6 = 54,
|
SDLK_6 = 54,
|
||||||
SDLK_7 = 55,
|
SDLK_7 = 55,
|
||||||
SDLK_8 = 56,
|
SDLK_8 = 56,
|
||||||
SDLK_9 = 57,
|
SDLK_9 = 57,
|
||||||
SDLK_COLON = 58,
|
SDLK_COLON = 58,
|
||||||
SDLK_SEMICOLON = 59,
|
SDLK_SEMICOLON = 59,
|
||||||
SDLK_LESS = 60,
|
SDLK_LESS = 60,
|
||||||
SDLK_EQUALS = 61,
|
SDLK_EQUALS = 61,
|
||||||
SDLK_GREATER = 62,
|
SDLK_GREATER = 62,
|
||||||
SDLK_QUESTION = 63,
|
SDLK_QUESTION = 63,
|
||||||
SDLK_AT = 64,
|
SDLK_AT = 64,
|
||||||
/*
|
/*
|
||||||
Skip uppercase letters
|
Skip uppercase letters
|
||||||
*/
|
*/
|
||||||
SDLK_LEFTBRACKET = 91,
|
SDLK_LEFTBRACKET = 91,
|
||||||
SDLK_BACKSLASH = 92,
|
SDLK_BACKSLASH = 92,
|
||||||
SDLK_RIGHTBRACKET = 93,
|
SDLK_RIGHTBRACKET = 93,
|
||||||
SDLK_CARET = 94,
|
SDLK_CARET = 94,
|
||||||
SDLK_UNDERSCORE = 95,
|
SDLK_UNDERSCORE = 95,
|
||||||
SDLK_BACKQUOTE = 96,
|
SDLK_BACKQUOTE = 96,
|
||||||
SDLK_a = 97,
|
SDLK_a = 97,
|
||||||
SDLK_b = 98,
|
SDLK_b = 98,
|
||||||
SDLK_c = 99,
|
SDLK_c = 99,
|
||||||
SDLK_d = 100,
|
SDLK_d = 100,
|
||||||
SDLK_e = 101,
|
SDLK_e = 101,
|
||||||
SDLK_f = 102,
|
SDLK_f = 102,
|
||||||
SDLK_g = 103,
|
SDLK_g = 103,
|
||||||
SDLK_h = 104,
|
SDLK_h = 104,
|
||||||
SDLK_i = 105,
|
SDLK_i = 105,
|
||||||
SDLK_j = 106,
|
SDLK_j = 106,
|
||||||
SDLK_k = 107,
|
SDLK_k = 107,
|
||||||
SDLK_l = 108,
|
SDLK_l = 108,
|
||||||
SDLK_m = 109,
|
SDLK_m = 109,
|
||||||
SDLK_n = 110,
|
SDLK_n = 110,
|
||||||
SDLK_o = 111,
|
SDLK_o = 111,
|
||||||
SDLK_p = 112,
|
SDLK_p = 112,
|
||||||
SDLK_q = 113,
|
SDLK_q = 113,
|
||||||
SDLK_r = 114,
|
SDLK_r = 114,
|
||||||
SDLK_s = 115,
|
SDLK_s = 115,
|
||||||
SDLK_t = 116,
|
SDLK_t = 116,
|
||||||
SDLK_u = 117,
|
SDLK_u = 117,
|
||||||
SDLK_v = 118,
|
SDLK_v = 118,
|
||||||
SDLK_w = 119,
|
SDLK_w = 119,
|
||||||
SDLK_x = 120,
|
SDLK_x = 120,
|
||||||
SDLK_y = 121,
|
SDLK_y = 121,
|
||||||
SDLK_z = 122,
|
SDLK_z = 122,
|
||||||
SDLK_DELETE = 127,
|
SDLK_DELETE = 127,
|
||||||
/* End of ASCII mapped keysyms */
|
/* End of ASCII mapped keysyms */
|
||||||
|
|
||||||
/* International keyboard syms */
|
/* International keyboard syms */
|
||||||
SDLK_WORLD_0 = 160, /* 0xA0 */
|
SDLK_WORLD_0 = 160, /* 0xA0 */
|
||||||
SDLK_WORLD_1 = 161,
|
SDLK_WORLD_1 = 161,
|
||||||
SDLK_WORLD_2 = 162,
|
SDLK_WORLD_2 = 162,
|
||||||
SDLK_WORLD_3 = 163,
|
SDLK_WORLD_3 = 163,
|
||||||
SDLK_WORLD_4 = 164,
|
SDLK_WORLD_4 = 164,
|
||||||
SDLK_WORLD_5 = 165,
|
SDLK_WORLD_5 = 165,
|
||||||
SDLK_WORLD_6 = 166,
|
SDLK_WORLD_6 = 166,
|
||||||
SDLK_WORLD_7 = 167,
|
SDLK_WORLD_7 = 167,
|
||||||
SDLK_WORLD_8 = 168,
|
SDLK_WORLD_8 = 168,
|
||||||
SDLK_WORLD_9 = 169,
|
SDLK_WORLD_9 = 169,
|
||||||
SDLK_WORLD_10 = 170,
|
SDLK_WORLD_10 = 170,
|
||||||
SDLK_WORLD_11 = 171,
|
SDLK_WORLD_11 = 171,
|
||||||
SDLK_WORLD_12 = 172,
|
SDLK_WORLD_12 = 172,
|
||||||
SDLK_WORLD_13 = 173,
|
SDLK_WORLD_13 = 173,
|
||||||
SDLK_WORLD_14 = 174,
|
SDLK_WORLD_14 = 174,
|
||||||
SDLK_WORLD_15 = 175,
|
SDLK_WORLD_15 = 175,
|
||||||
SDLK_WORLD_16 = 176,
|
SDLK_WORLD_16 = 176,
|
||||||
SDLK_WORLD_17 = 177,
|
SDLK_WORLD_17 = 177,
|
||||||
SDLK_WORLD_18 = 178,
|
SDLK_WORLD_18 = 178,
|
||||||
SDLK_WORLD_19 = 179,
|
SDLK_WORLD_19 = 179,
|
||||||
SDLK_WORLD_20 = 180,
|
SDLK_WORLD_20 = 180,
|
||||||
SDLK_WORLD_21 = 181,
|
SDLK_WORLD_21 = 181,
|
||||||
SDLK_WORLD_22 = 182,
|
SDLK_WORLD_22 = 182,
|
||||||
SDLK_WORLD_23 = 183,
|
SDLK_WORLD_23 = 183,
|
||||||
SDLK_WORLD_24 = 184,
|
SDLK_WORLD_24 = 184,
|
||||||
SDLK_WORLD_25 = 185,
|
SDLK_WORLD_25 = 185,
|
||||||
SDLK_WORLD_26 = 186,
|
SDLK_WORLD_26 = 186,
|
||||||
SDLK_WORLD_27 = 187,
|
SDLK_WORLD_27 = 187,
|
||||||
SDLK_WORLD_28 = 188,
|
SDLK_WORLD_28 = 188,
|
||||||
SDLK_WORLD_29 = 189,
|
SDLK_WORLD_29 = 189,
|
||||||
SDLK_WORLD_30 = 190,
|
SDLK_WORLD_30 = 190,
|
||||||
SDLK_WORLD_31 = 191,
|
SDLK_WORLD_31 = 191,
|
||||||
SDLK_WORLD_32 = 192,
|
SDLK_WORLD_32 = 192,
|
||||||
SDLK_WORLD_33 = 193,
|
SDLK_WORLD_33 = 193,
|
||||||
SDLK_WORLD_34 = 194,
|
SDLK_WORLD_34 = 194,
|
||||||
SDLK_WORLD_35 = 195,
|
SDLK_WORLD_35 = 195,
|
||||||
SDLK_WORLD_36 = 196,
|
SDLK_WORLD_36 = 196,
|
||||||
SDLK_WORLD_37 = 197,
|
SDLK_WORLD_37 = 197,
|
||||||
SDLK_WORLD_38 = 198,
|
SDLK_WORLD_38 = 198,
|
||||||
SDLK_WORLD_39 = 199,
|
SDLK_WORLD_39 = 199,
|
||||||
SDLK_WORLD_40 = 200,
|
SDLK_WORLD_40 = 200,
|
||||||
SDLK_WORLD_41 = 201,
|
SDLK_WORLD_41 = 201,
|
||||||
SDLK_WORLD_42 = 202,
|
SDLK_WORLD_42 = 202,
|
||||||
SDLK_WORLD_43 = 203,
|
SDLK_WORLD_43 = 203,
|
||||||
SDLK_WORLD_44 = 204,
|
SDLK_WORLD_44 = 204,
|
||||||
SDLK_WORLD_45 = 205,
|
SDLK_WORLD_45 = 205,
|
||||||
SDLK_WORLD_46 = 206,
|
SDLK_WORLD_46 = 206,
|
||||||
SDLK_WORLD_47 = 207,
|
SDLK_WORLD_47 = 207,
|
||||||
SDLK_WORLD_48 = 208,
|
SDLK_WORLD_48 = 208,
|
||||||
SDLK_WORLD_49 = 209,
|
SDLK_WORLD_49 = 209,
|
||||||
SDLK_WORLD_50 = 210,
|
SDLK_WORLD_50 = 210,
|
||||||
SDLK_WORLD_51 = 211,
|
SDLK_WORLD_51 = 211,
|
||||||
SDLK_WORLD_52 = 212,
|
SDLK_WORLD_52 = 212,
|
||||||
SDLK_WORLD_53 = 213,
|
SDLK_WORLD_53 = 213,
|
||||||
SDLK_WORLD_54 = 214,
|
SDLK_WORLD_54 = 214,
|
||||||
SDLK_WORLD_55 = 215,
|
SDLK_WORLD_55 = 215,
|
||||||
SDLK_WORLD_56 = 216,
|
SDLK_WORLD_56 = 216,
|
||||||
SDLK_WORLD_57 = 217,
|
SDLK_WORLD_57 = 217,
|
||||||
SDLK_WORLD_58 = 218,
|
SDLK_WORLD_58 = 218,
|
||||||
SDLK_WORLD_59 = 219,
|
SDLK_WORLD_59 = 219,
|
||||||
SDLK_WORLD_60 = 220,
|
SDLK_WORLD_60 = 220,
|
||||||
SDLK_WORLD_61 = 221,
|
SDLK_WORLD_61 = 221,
|
||||||
SDLK_WORLD_62 = 222,
|
SDLK_WORLD_62 = 222,
|
||||||
SDLK_WORLD_63 = 223,
|
SDLK_WORLD_63 = 223,
|
||||||
SDLK_WORLD_64 = 224,
|
SDLK_WORLD_64 = 224,
|
||||||
SDLK_WORLD_65 = 225,
|
SDLK_WORLD_65 = 225,
|
||||||
SDLK_WORLD_66 = 226,
|
SDLK_WORLD_66 = 226,
|
||||||
SDLK_WORLD_67 = 227,
|
SDLK_WORLD_67 = 227,
|
||||||
SDLK_WORLD_68 = 228,
|
SDLK_WORLD_68 = 228,
|
||||||
SDLK_WORLD_69 = 229,
|
SDLK_WORLD_69 = 229,
|
||||||
SDLK_WORLD_70 = 230,
|
SDLK_WORLD_70 = 230,
|
||||||
SDLK_WORLD_71 = 231,
|
SDLK_WORLD_71 = 231,
|
||||||
SDLK_WORLD_72 = 232,
|
SDLK_WORLD_72 = 232,
|
||||||
SDLK_WORLD_73 = 233,
|
SDLK_WORLD_73 = 233,
|
||||||
SDLK_WORLD_74 = 234,
|
SDLK_WORLD_74 = 234,
|
||||||
SDLK_WORLD_75 = 235,
|
SDLK_WORLD_75 = 235,
|
||||||
SDLK_WORLD_76 = 236,
|
SDLK_WORLD_76 = 236,
|
||||||
SDLK_WORLD_77 = 237,
|
SDLK_WORLD_77 = 237,
|
||||||
SDLK_WORLD_78 = 238,
|
SDLK_WORLD_78 = 238,
|
||||||
SDLK_WORLD_79 = 239,
|
SDLK_WORLD_79 = 239,
|
||||||
SDLK_WORLD_80 = 240,
|
SDLK_WORLD_80 = 240,
|
||||||
SDLK_WORLD_81 = 241,
|
SDLK_WORLD_81 = 241,
|
||||||
SDLK_WORLD_82 = 242,
|
SDLK_WORLD_82 = 242,
|
||||||
SDLK_WORLD_83 = 243,
|
SDLK_WORLD_83 = 243,
|
||||||
SDLK_WORLD_84 = 244,
|
SDLK_WORLD_84 = 244,
|
||||||
SDLK_WORLD_85 = 245,
|
SDLK_WORLD_85 = 245,
|
||||||
SDLK_WORLD_86 = 246,
|
SDLK_WORLD_86 = 246,
|
||||||
SDLK_WORLD_87 = 247,
|
SDLK_WORLD_87 = 247,
|
||||||
SDLK_WORLD_88 = 248,
|
SDLK_WORLD_88 = 248,
|
||||||
SDLK_WORLD_89 = 249,
|
SDLK_WORLD_89 = 249,
|
||||||
SDLK_WORLD_90 = 250,
|
SDLK_WORLD_90 = 250,
|
||||||
SDLK_WORLD_91 = 251,
|
SDLK_WORLD_91 = 251,
|
||||||
SDLK_WORLD_92 = 252,
|
SDLK_WORLD_92 = 252,
|
||||||
SDLK_WORLD_93 = 253,
|
SDLK_WORLD_93 = 253,
|
||||||
SDLK_WORLD_94 = 254,
|
SDLK_WORLD_94 = 254,
|
||||||
SDLK_WORLD_95 = 255, /* 0xFF */
|
SDLK_WORLD_95 = 255, /* 0xFF */
|
||||||
|
|
||||||
/* Numeric keypad */
|
/* Numeric keypad */
|
||||||
SDLK_KP0 = 256,
|
SDLK_KP0 = 256,
|
||||||
SDLK_KP1 = 257,
|
SDLK_KP1 = 257,
|
||||||
SDLK_KP2 = 258,
|
SDLK_KP2 = 258,
|
||||||
SDLK_KP3 = 259,
|
SDLK_KP3 = 259,
|
||||||
SDLK_KP4 = 260,
|
SDLK_KP4 = 260,
|
||||||
SDLK_KP5 = 261,
|
SDLK_KP5 = 261,
|
||||||
SDLK_KP6 = 262,
|
SDLK_KP6 = 262,
|
||||||
SDLK_KP7 = 263,
|
SDLK_KP7 = 263,
|
||||||
SDLK_KP8 = 264,
|
SDLK_KP8 = 264,
|
||||||
SDLK_KP9 = 265,
|
SDLK_KP9 = 265,
|
||||||
SDLK_KP_PERIOD = 266,
|
SDLK_KP_PERIOD = 266,
|
||||||
SDLK_KP_DIVIDE = 267,
|
SDLK_KP_DIVIDE = 267,
|
||||||
SDLK_KP_MULTIPLY = 268,
|
SDLK_KP_MULTIPLY = 268,
|
||||||
SDLK_KP_MINUS = 269,
|
SDLK_KP_MINUS = 269,
|
||||||
SDLK_KP_PLUS = 270,
|
SDLK_KP_PLUS = 270,
|
||||||
SDLK_KP_ENTER = 271,
|
SDLK_KP_ENTER = 271,
|
||||||
SDLK_KP_EQUALS = 272,
|
SDLK_KP_EQUALS = 272,
|
||||||
|
|
||||||
/* Arrows + Home/End pad */
|
/* Arrows + Home/End pad */
|
||||||
SDLK_UP = 273,
|
SDLK_UP = 273,
|
||||||
SDLK_DOWN = 274,
|
SDLK_DOWN = 274,
|
||||||
SDLK_RIGHT = 275,
|
SDLK_RIGHT = 275,
|
||||||
SDLK_LEFT = 276,
|
SDLK_LEFT = 276,
|
||||||
SDLK_INSERT = 277,
|
SDLK_INSERT = 277,
|
||||||
SDLK_HOME = 278,
|
SDLK_HOME = 278,
|
||||||
SDLK_END = 279,
|
SDLK_END = 279,
|
||||||
SDLK_PAGEUP = 280,
|
SDLK_PAGEUP = 280,
|
||||||
SDLK_PAGEDOWN = 281,
|
SDLK_PAGEDOWN = 281,
|
||||||
|
|
||||||
/* Function keys */
|
/* Function keys */
|
||||||
SDLK_F1 = 282,
|
SDLK_F1 = 282,
|
||||||
SDLK_F2 = 283,
|
SDLK_F2 = 283,
|
||||||
SDLK_F3 = 284,
|
SDLK_F3 = 284,
|
||||||
SDLK_F4 = 285,
|
SDLK_F4 = 285,
|
||||||
SDLK_F5 = 286,
|
SDLK_F5 = 286,
|
||||||
SDLK_F6 = 287,
|
SDLK_F6 = 287,
|
||||||
SDLK_F7 = 288,
|
SDLK_F7 = 288,
|
||||||
SDLK_F8 = 289,
|
SDLK_F8 = 289,
|
||||||
SDLK_F9 = 290,
|
SDLK_F9 = 290,
|
||||||
SDLK_F10 = 291,
|
SDLK_F10 = 291,
|
||||||
SDLK_F11 = 292,
|
SDLK_F11 = 292,
|
||||||
SDLK_F12 = 293,
|
SDLK_F12 = 293,
|
||||||
SDLK_F13 = 294,
|
SDLK_F13 = 294,
|
||||||
SDLK_F14 = 295,
|
SDLK_F14 = 295,
|
||||||
SDLK_F15 = 296,
|
SDLK_F15 = 296,
|
||||||
|
|
||||||
/* Key state modifier keys */
|
/* Key state modifier keys */
|
||||||
SDLK_NUMLOCK = 300,
|
SDLK_NUMLOCK = 300,
|
||||||
SDLK_CAPSLOCK = 301,
|
SDLK_CAPSLOCK = 301,
|
||||||
SDLK_SCROLLOCK = 302,
|
SDLK_SCROLLOCK = 302,
|
||||||
SDLK_RSHIFT = 303,
|
SDLK_RSHIFT = 303,
|
||||||
SDLK_LSHIFT = 304,
|
SDLK_LSHIFT = 304,
|
||||||
SDLK_RCTRL = 305,
|
SDLK_RCTRL = 305,
|
||||||
SDLK_LCTRL = 306,
|
SDLK_LCTRL = 306,
|
||||||
SDLK_RALT = 307,
|
SDLK_RALT = 307,
|
||||||
SDLK_LALT = 308,
|
SDLK_LALT = 308,
|
||||||
SDLK_RMETA = 309,
|
SDLK_RMETA = 309,
|
||||||
SDLK_LMETA = 310,
|
SDLK_LMETA = 310,
|
||||||
SDLK_LSUPER = 311, /* Left "Windows" key */
|
SDLK_LSUPER = 311, /* Left "Windows" key */
|
||||||
SDLK_RSUPER = 312, /* Right "Windows" key */
|
SDLK_RSUPER = 312, /* Right "Windows" key */
|
||||||
SDLK_MODE = 313, /* "Alt Gr" key */
|
SDLK_MODE = 313, /* "Alt Gr" key */
|
||||||
SDLK_COMPOSE = 314, /* Multi-key compose key */
|
SDLK_COMPOSE = 314, /* Multi-key compose key */
|
||||||
|
|
||||||
/* Miscellaneous function keys */
|
/* Miscellaneous function keys */
|
||||||
SDLK_HELP = 315,
|
SDLK_HELP = 315,
|
||||||
SDLK_PRINT = 316,
|
SDLK_PRINT = 316,
|
||||||
SDLK_SYSREQ = 317,
|
SDLK_SYSREQ = 317,
|
||||||
SDLK_BREAK = 318,
|
SDLK_BREAK = 318,
|
||||||
SDLK_MENU = 319,
|
SDLK_MENU = 319,
|
||||||
SDLK_POWER = 320, /* Power Macintosh power key */
|
SDLK_POWER = 320, /* Power Macintosh power key */
|
||||||
SDLK_EURO = 321, /* Some european keyboards */
|
SDLK_EURO = 321, /* Some european keyboards */
|
||||||
SDLK_UNDO = 322, /* Atari keyboard has Undo */
|
SDLK_UNDO = 322, /* Atari keyboard has Undo */
|
||||||
|
|
||||||
/* Add any other keys here */
|
/* Add any other keys here */
|
||||||
|
|
||||||
SDLK_LAST
|
SDLK_LAST
|
||||||
} SDLKey;
|
} SDLKey;
|
||||||
|
|
||||||
/* Enumeration of valid key mods (possibly OR'd together) */
|
/* Enumeration of valid key mods (possibly OR'd together) */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
KMOD_NONE = 0x0000,
|
KMOD_NONE = 0x0000,
|
||||||
KMOD_LSHIFT= 0x0001,
|
KMOD_LSHIFT= 0x0001,
|
||||||
KMOD_RSHIFT= 0x0002,
|
KMOD_RSHIFT= 0x0002,
|
||||||
KMOD_LCTRL = 0x0040,
|
KMOD_LCTRL = 0x0040,
|
||||||
KMOD_RCTRL = 0x0080,
|
KMOD_RCTRL = 0x0080,
|
||||||
KMOD_LALT = 0x0100,
|
KMOD_LALT = 0x0100,
|
||||||
KMOD_RALT = 0x0200,
|
KMOD_RALT = 0x0200,
|
||||||
KMOD_LMETA = 0x0400,
|
KMOD_LMETA = 0x0400,
|
||||||
KMOD_RMETA = 0x0800,
|
KMOD_RMETA = 0x0800,
|
||||||
KMOD_NUM = 0x1000,
|
KMOD_NUM = 0x1000,
|
||||||
KMOD_CAPS = 0x2000,
|
KMOD_CAPS = 0x2000,
|
||||||
KMOD_MODE = 0x4000,
|
KMOD_MODE = 0x4000,
|
||||||
KMOD_RESERVED = 0x8000
|
KMOD_RESERVED = 0x8000
|
||||||
} SDLMod;
|
} SDLMod;
|
||||||
|
|
||||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||||
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
||||||
|
|
||||||
#endif /* _SDL_keysym_h */
|
#endif /* _SDL_keysym_h */
|
||||||
|
|
|
@ -1,74 +1,74 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* System dependent library loading routines */
|
/* System dependent library loading routines */
|
||||||
|
|
||||||
/* Some things to keep in mind:
|
/* Some things to keep in mind:
|
||||||
- These functions only work on C function names. Other languages may
|
- These functions only work on C function names. Other languages may
|
||||||
have name mangling and intrinsic language support that varies from
|
have name mangling and intrinsic language support that varies from
|
||||||
compiler to compiler.
|
compiler to compiler.
|
||||||
- Make sure you declare your function pointers with the same calling
|
- Make sure you declare your function pointers with the same calling
|
||||||
convention as the actual library function. Your code will crash
|
convention as the actual library function. Your code will crash
|
||||||
mysteriously if you do not do this.
|
mysteriously if you do not do this.
|
||||||
- Avoid namespace collisions. If you load a symbol from the library,
|
- Avoid namespace collisions. If you load a symbol from the library,
|
||||||
it is not defined whether or not it goes into the global symbol
|
it is not defined whether or not it goes into the global symbol
|
||||||
namespace for the application. If it does and it conflicts with
|
namespace for the application. If it does and it conflicts with
|
||||||
symbols in your code or other shared libraries, you will not get
|
symbols in your code or other shared libraries, you will not get
|
||||||
the results you expect. :)
|
the results you expect. :)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _SDL_loadso_h
|
#ifndef _SDL_loadso_h
|
||||||
#define _SDL_loadso_h
|
#define _SDL_loadso_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function dynamically loads a shared object and returns a pointer
|
/* This function dynamically loads a shared object and returns a pointer
|
||||||
* to the object handle (or NULL if there was an error).
|
* to the object handle (or NULL if there was an error).
|
||||||
* The 'sofile' parameter is a system dependent name of the object file.
|
* The 'sofile' parameter is a system dependent name of the object file.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
||||||
|
|
||||||
/* Given an object handle, this function looks up the address of the
|
/* Given an object handle, this function looks up the address of the
|
||||||
* named function in the shared object and returns it. This address
|
* named function in the shared object and returns it. This address
|
||||||
* is no longer valid after calling SDL_UnloadObject().
|
* is no longer valid after calling SDL_UnloadObject().
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
||||||
|
|
||||||
/* Unload a shared object from memory */
|
/* Unload a shared object from memory */
|
||||||
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_loadso_h */
|
#endif /* _SDL_loadso_h */
|
||||||
|
|
|
@ -1,98 +1,98 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_main_h
|
#ifndef _SDL_main_h
|
||||||
#define _SDL_main_h
|
#define _SDL_main_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
||||||
|
|
||||||
#if defined(__WIN32__) || \
|
#if defined(__WIN32__) || \
|
||||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||||
defined(__MACOS__) || defined(__MACOSX__) || \
|
defined(__MACOS__) || defined(__MACOSX__) || \
|
||||||
defined(__SYMBIAN32__) || defined(QWS)
|
defined(__SYMBIAN32__) || defined(QWS)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define C_LINKAGE "C"
|
#define C_LINKAGE "C"
|
||||||
#else
|
#else
|
||||||
#define C_LINKAGE
|
#define C_LINKAGE
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/* The application's main() function must be called with C linkage,
|
/* The application's main() function must be called with C linkage,
|
||||||
and should be declared like this:
|
and should be declared like this:
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#define main SDL_main
|
#define main SDL_main
|
||||||
|
|
||||||
/* The prototype for the application's main() function */
|
/* The prototype for the application's main() function */
|
||||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
/* From the SDL library code -- needed for registering the app on Win32 */
|
/* From the SDL library code -- needed for registering the app on Win32 */
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This should be called from your WinMain() function, if any */
|
/* This should be called from your WinMain() function, if any */
|
||||||
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
|
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
|
||||||
/* This can also be called, but is no longer necessary */
|
/* This can also be called, but is no longer necessary */
|
||||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
||||||
/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
|
/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
|
||||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
|
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
|
||||||
#if defined(__MACOS__)
|
#if defined(__MACOS__)
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Forward declaration so we don't need to include QuickDraw.h */
|
/* Forward declaration so we don't need to include QuickDraw.h */
|
||||||
struct QDGlobals;
|
struct QDGlobals;
|
||||||
|
|
||||||
/* This should be called from your main() function, if any */
|
/* This should be called from your main() function, if any */
|
||||||
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* Need to redefine main()? */
|
#endif /* Need to redefine main()? */
|
||||||
|
|
||||||
#endif /* _SDL_main_h */
|
#endif /* _SDL_main_h */
|
||||||
|
|
|
@ -1,140 +1,140 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL mouse event handling */
|
/* Include file for SDL mouse event handling */
|
||||||
|
|
||||||
#ifndef _SDL_mouse_h
|
#ifndef _SDL_mouse_h
|
||||||
#define _SDL_mouse_h
|
#define _SDL_mouse_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_video.h"
|
#include "SDL_video.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct WMcursor WMcursor; /* Implementation dependent */
|
typedef struct WMcursor WMcursor; /* Implementation dependent */
|
||||||
typedef struct SDL_Cursor {
|
typedef struct SDL_Cursor {
|
||||||
SDL_Rect area; /* The area of the mouse cursor */
|
SDL_Rect area; /* The area of the mouse cursor */
|
||||||
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
|
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
|
||||||
Uint8 *data; /* B/W cursor data */
|
Uint8 *data; /* B/W cursor data */
|
||||||
Uint8 *mask; /* B/W cursor mask */
|
Uint8 *mask; /* B/W cursor mask */
|
||||||
Uint8 *save[2]; /* Place to save cursor area */
|
Uint8 *save[2]; /* Place to save cursor area */
|
||||||
WMcursor *wm_cursor; /* Window-manager cursor */
|
WMcursor *wm_cursor; /* Window-manager cursor */
|
||||||
} SDL_Cursor;
|
} SDL_Cursor;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
/*
|
/*
|
||||||
* Retrieve the current state of the mouse.
|
* Retrieve the current state of the mouse.
|
||||||
* The current button state is returned as a button bitmask, which can
|
* The current button state is returned as a button bitmask, which can
|
||||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||||
* current mouse cursor position. You can pass NULL for either x or y.
|
* current mouse cursor position. You can pass NULL for either x or y.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
|
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve the current state of the mouse.
|
* Retrieve the current state of the mouse.
|
||||||
* The current button state is returned as a button bitmask, which can
|
* The current button state is returned as a button bitmask, which can
|
||||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||||
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the position of the mouse cursor (generates a mouse motion event)
|
* Set the position of the mouse cursor (generates a mouse motion event)
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
|
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a cursor using the specified data and mask (in MSB format).
|
* Create a cursor using the specified data and mask (in MSB format).
|
||||||
* The cursor width must be a multiple of 8 bits.
|
* The cursor width must be a multiple of 8 bits.
|
||||||
*
|
*
|
||||||
* The cursor is created in black and white according to the following:
|
* The cursor is created in black and white according to the following:
|
||||||
* data mask resulting pixel on screen
|
* data mask resulting pixel on screen
|
||||||
* 0 1 White
|
* 0 1 White
|
||||||
* 1 1 Black
|
* 1 1 Black
|
||||||
* 0 0 Transparent
|
* 0 0 Transparent
|
||||||
* 1 0 Inverted color if possible, black if not.
|
* 1 0 Inverted color if possible, black if not.
|
||||||
*
|
*
|
||||||
* Cursors created with this function must be freed with SDL_FreeCursor().
|
* Cursors created with this function must be freed with SDL_FreeCursor().
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
|
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
|
||||||
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the currently active cursor to the specified one.
|
* Set the currently active cursor to the specified one.
|
||||||
* If the cursor is currently visible, the change will be immediately
|
* If the cursor is currently visible, the change will be immediately
|
||||||
* represented on the display.
|
* represented on the display.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
|
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the currently active cursor.
|
* Returns the currently active cursor.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
|
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deallocates a cursor created with SDL_CreateCursor().
|
* Deallocates a cursor created with SDL_CreateCursor().
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
|
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Toggle whether or not the cursor is shown on the screen.
|
* Toggle whether or not the cursor is shown on the screen.
|
||||||
* The cursor start off displayed, but can be turned off.
|
* The cursor start off displayed, but can be turned off.
|
||||||
* SDL_ShowCursor() returns 1 if the cursor was being displayed
|
* SDL_ShowCursor() returns 1 if the cursor was being displayed
|
||||||
* before the call, or 0 if it was not. You can query the current
|
* before the call, or 0 if it was not. You can query the current
|
||||||
* state by passing a 'toggle' value of -1.
|
* state by passing a 'toggle' value of -1.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
||||||
|
|
||||||
/* Used as a mask when testing buttons in buttonstate
|
/* Used as a mask when testing buttons in buttonstate
|
||||||
Button 1: Left mouse button
|
Button 1: Left mouse button
|
||||||
Button 2: Middle mouse button
|
Button 2: Middle mouse button
|
||||||
Button 3: Right mouse button
|
Button 3: Right mouse button
|
||||||
Button 4: Mouse wheel up (may also be a real button)
|
Button 4: Mouse wheel up (may also be a real button)
|
||||||
Button 5: Mouse wheel down (may also be a real button)
|
Button 5: Mouse wheel down (may also be a real button)
|
||||||
*/
|
*/
|
||||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||||
#define SDL_BUTTON_LEFT 1
|
#define SDL_BUTTON_LEFT 1
|
||||||
#define SDL_BUTTON_MIDDLE 2
|
#define SDL_BUTTON_MIDDLE 2
|
||||||
#define SDL_BUTTON_RIGHT 3
|
#define SDL_BUTTON_RIGHT 3
|
||||||
#define SDL_BUTTON_WHEELUP 4
|
#define SDL_BUTTON_WHEELUP 4
|
||||||
#define SDL_BUTTON_WHEELDOWN 5
|
#define SDL_BUTTON_WHEELDOWN 5
|
||||||
#define SDL_BUTTON_X1 6
|
#define SDL_BUTTON_X1 6
|
||||||
#define SDL_BUTTON_X2 7
|
#define SDL_BUTTON_X2 7
|
||||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_mouse_h */
|
#endif /* _SDL_mouse_h */
|
||||||
|
|
|
@ -1,162 +1,162 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_mutex_h
|
#ifndef _SDL_mutex_h
|
||||||
#define _SDL_mutex_h
|
#define _SDL_mutex_h
|
||||||
|
|
||||||
/* Functions to provide thread synchronization primitives
|
/* Functions to provide thread synchronization primitives
|
||||||
|
|
||||||
These are independent of the other SDL routines.
|
These are independent of the other SDL routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Synchronization functions which can time out return this value
|
/* Synchronization functions which can time out return this value
|
||||||
if they time out.
|
if they time out.
|
||||||
*/
|
*/
|
||||||
#define SDL_MUTEX_TIMEDOUT 1
|
#define SDL_MUTEX_TIMEDOUT 1
|
||||||
|
|
||||||
/* This is the timeout value which corresponds to never time out */
|
/* This is the timeout value which corresponds to never time out */
|
||||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* Mutex functions */
|
/* Mutex functions */
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/* The SDL mutex structure, defined in SDL_mutex.c */
|
/* The SDL mutex structure, defined in SDL_mutex.c */
|
||||||
struct SDL_mutex;
|
struct SDL_mutex;
|
||||||
typedef struct SDL_mutex SDL_mutex;
|
typedef struct SDL_mutex SDL_mutex;
|
||||||
|
|
||||||
/* Create a mutex, initialized unlocked */
|
/* Create a mutex, initialized unlocked */
|
||||||
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
|
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
|
||||||
|
|
||||||
/* Lock the mutex (Returns 0, or -1 on error) */
|
/* Lock the mutex (Returns 0, or -1 on error) */
|
||||||
#define SDL_LockMutex(m) SDL_mutexP(m)
|
#define SDL_LockMutex(m) SDL_mutexP(m)
|
||||||
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
|
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
|
||||||
|
|
||||||
/* Unlock the mutex (Returns 0, or -1 on error)
|
/* Unlock the mutex (Returns 0, or -1 on error)
|
||||||
It is an error to unlock a mutex that has not been locked by
|
It is an error to unlock a mutex that has not been locked by
|
||||||
the current thread, and doing so results in undefined behavior.
|
the current thread, and doing so results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
||||||
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
|
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
|
||||||
|
|
||||||
/* Destroy a mutex */
|
/* Destroy a mutex */
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
|
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* Semaphore functions */
|
/* Semaphore functions */
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/* The SDL semaphore structure, defined in SDL_sem.c */
|
/* The SDL semaphore structure, defined in SDL_sem.c */
|
||||||
struct SDL_semaphore;
|
struct SDL_semaphore;
|
||||||
typedef struct SDL_semaphore SDL_sem;
|
typedef struct SDL_semaphore SDL_sem;
|
||||||
|
|
||||||
/* Create a semaphore, initialized with value, returns NULL on failure. */
|
/* Create a semaphore, initialized with value, returns NULL on failure. */
|
||||||
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
||||||
|
|
||||||
/* Destroy a semaphore */
|
/* Destroy a semaphore */
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
|
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
|
||||||
|
|
||||||
/* This function suspends the calling thread until the semaphore pointed
|
/* This function suspends the calling thread until the semaphore pointed
|
||||||
* to by sem has a positive count. It then atomically decreases the semaphore
|
* to by sem has a positive count. It then atomically decreases the semaphore
|
||||||
* count.
|
* count.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
|
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
|
||||||
|
|
||||||
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
|
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
|
||||||
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
|
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
|
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
|
||||||
|
|
||||||
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
|
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
|
||||||
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
|
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
|
||||||
the allotted time, and -1 on error.
|
the allotted time, and -1 on error.
|
||||||
On some platforms this function is implemented by looping with a delay
|
On some platforms this function is implemented by looping with a delay
|
||||||
of 1 ms, and so should be avoided if possible.
|
of 1 ms, and so should be avoided if possible.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
|
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
|
||||||
|
|
||||||
/* Atomically increases the semaphore's count (not blocking), returns 0,
|
/* Atomically increases the semaphore's count (not blocking), returns 0,
|
||||||
or -1 on error.
|
or -1 on error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
|
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
|
||||||
|
|
||||||
/* Returns the current count of the semaphore */
|
/* Returns the current count of the semaphore */
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
|
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
/* Condition variable functions */
|
/* Condition variable functions */
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/* The SDL condition variable structure, defined in SDL_cond.c */
|
/* The SDL condition variable structure, defined in SDL_cond.c */
|
||||||
struct SDL_cond;
|
struct SDL_cond;
|
||||||
typedef struct SDL_cond SDL_cond;
|
typedef struct SDL_cond SDL_cond;
|
||||||
|
|
||||||
/* Create a condition variable */
|
/* Create a condition variable */
|
||||||
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
|
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
|
||||||
|
|
||||||
/* Destroy a condition variable */
|
/* Destroy a condition variable */
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
|
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
|
||||||
|
|
||||||
/* Restart one of the threads that are waiting on the condition variable,
|
/* Restart one of the threads that are waiting on the condition variable,
|
||||||
returns 0 or -1 on error.
|
returns 0 or -1 on error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
|
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
|
||||||
|
|
||||||
/* Restart all threads that are waiting on the condition variable,
|
/* Restart all threads that are waiting on the condition variable,
|
||||||
returns 0 or -1 on error.
|
returns 0 or -1 on error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
|
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
|
||||||
|
|
||||||
/* Wait on the condition variable, unlocking the provided mutex.
|
/* Wait on the condition variable, unlocking the provided mutex.
|
||||||
The mutex must be locked before entering this function!
|
The mutex must be locked before entering this function!
|
||||||
The mutex is re-locked once the condition variable is signaled.
|
The mutex is re-locked once the condition variable is signaled.
|
||||||
Returns 0 when it is signaled, or -1 on error.
|
Returns 0 when it is signaled, or -1 on error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
|
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
|
||||||
|
|
||||||
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
|
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
|
||||||
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
|
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
|
||||||
signaled in the allotted time, and -1 on error.
|
signaled in the allotted time, and -1 on error.
|
||||||
On some platforms this function is implemented by looping with a delay
|
On some platforms this function is implemented by looping with a delay
|
||||||
of 1 ms, and so should be avoided if possible.
|
of 1 ms, and so should be avoided if possible.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
|
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_mutex_h */
|
#endif /* _SDL_mutex_h */
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
#ifndef _SDLname_h_
|
#ifndef _SDLname_h_
|
||||||
#define _SDLname_h_
|
#define _SDLname_h_
|
||||||
|
|
||||||
#if defined(__STDC__) || defined(__cplusplus)
|
#if defined(__STDC__) || defined(__cplusplus)
|
||||||
#define NeedFunctionPrototypes 1
|
#define NeedFunctionPrototypes 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SDL_NAME(X) SDL_##X
|
#define SDL_NAME(X) SDL_##X
|
||||||
|
|
||||||
#endif /* _SDLname_h_ */
|
#endif /* _SDLname_h_ */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,100 +1,100 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Try to get a standard set of platform defines */
|
/* Try to get a standard set of platform defines */
|
||||||
|
|
||||||
#ifndef _SDL_platform_h
|
#ifndef _SDL_platform_h
|
||||||
#define _SDL_platform_h
|
#define _SDL_platform_h
|
||||||
|
|
||||||
#if defined(_AIX)
|
#if defined(_AIX)
|
||||||
#undef __AIX__
|
#undef __AIX__
|
||||||
#define __AIX__ 1
|
#define __AIX__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__BEOS__)
|
#if defined(__BEOS__)
|
||||||
#undef __BEOS__
|
#undef __BEOS__
|
||||||
#define __BEOS__ 1
|
#define __BEOS__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
||||||
#undef __BSDI__
|
#undef __BSDI__
|
||||||
#define __BSDI__ 1
|
#define __BSDI__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(_arch_dreamcast)
|
#if defined(_arch_dreamcast)
|
||||||
#undef __DREAMCAST__
|
#undef __DREAMCAST__
|
||||||
#define __DREAMCAST__ 1
|
#define __DREAMCAST__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
#undef __FREEBSD__
|
#undef __FREEBSD__
|
||||||
#define __FREEBSD__ 1
|
#define __FREEBSD__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||||
#undef __HPUX__
|
#undef __HPUX__
|
||||||
#define __HPUX__ 1
|
#define __HPUX__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
||||||
#undef __IRIX__
|
#undef __IRIX__
|
||||||
#define __IRIX__ 1
|
#define __IRIX__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||||
#undef __LINUX__
|
#undef __LINUX__
|
||||||
#define __LINUX__ 1
|
#define __LINUX__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#undef __MACOSX__
|
#undef __MACOSX__
|
||||||
#define __MACOSX__ 1
|
#define __MACOSX__ 1
|
||||||
#elif defined(macintosh)
|
#elif defined(macintosh)
|
||||||
#undef __MACOS__
|
#undef __MACOS__
|
||||||
#define __MACOS__ 1
|
#define __MACOS__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
#undef __NETBSD__
|
#undef __NETBSD__
|
||||||
#define __NETBSD__ 1
|
#define __NETBSD__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__OpenBSD__)
|
#if defined(__OpenBSD__)
|
||||||
#undef __OPENBSD__
|
#undef __OPENBSD__
|
||||||
#define __OPENBSD__ 1
|
#define __OPENBSD__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__OS2__)
|
#if defined(__OS2__)
|
||||||
#undef __OS2__
|
#undef __OS2__
|
||||||
#define __OS2__ 1
|
#define __OS2__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
||||||
#undef __OSF__
|
#undef __OSF__
|
||||||
#define __OSF__ 1
|
#define __OSF__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__QNXNTO__)
|
#if defined(__QNXNTO__)
|
||||||
#undef __QNXNTO__
|
#undef __QNXNTO__
|
||||||
#define __QNXNTO__ 1
|
#define __QNXNTO__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
||||||
#undef __RISCOS__
|
#undef __RISCOS__
|
||||||
#define __RISCOS__ 1
|
#define __RISCOS__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SVR4)
|
#if defined(__SVR4)
|
||||||
#undef __SOLARIS__
|
#undef __SOLARIS__
|
||||||
#define __SOLARIS__ 1
|
#define __SOLARIS__ 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
#undef __WIN32__
|
#undef __WIN32__
|
||||||
#define __WIN32__ 1
|
#define __WIN32__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SDL_platform_h */
|
#endif /* _SDL_platform_h */
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL quit event handling */
|
/* Include file for SDL quit event handling */
|
||||||
|
|
||||||
#ifndef _SDL_quit_h
|
#ifndef _SDL_quit_h
|
||||||
#define _SDL_quit_h
|
#define _SDL_quit_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
An SDL_QUITEVENT is generated when the user tries to close the application
|
An SDL_QUITEVENT is generated when the user tries to close the application
|
||||||
window. If it is ignored or filtered out, the window will remain open.
|
window. If it is ignored or filtered out, the window will remain open.
|
||||||
If it is not ignored or filtered, it is queued normally and the window
|
If it is not ignored or filtered, it is queued normally and the window
|
||||||
is allowed to close. When the window is closed, screen updates will
|
is allowed to close. When the window is closed, screen updates will
|
||||||
complete, but have no effect.
|
complete, but have no effect.
|
||||||
|
|
||||||
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
||||||
and SIGTERM (system termination request), if handlers do not already
|
and SIGTERM (system termination request), if handlers do not already
|
||||||
exist, that generate SDL_QUITEVENT events as well. There is no way
|
exist, that generate SDL_QUITEVENT events as well. There is no way
|
||||||
to determine the cause of an SDL_QUITEVENT, but setting a signal
|
to determine the cause of an SDL_QUITEVENT, but setting a signal
|
||||||
handler in your application will override the default generation of
|
handler in your application will override the default generation of
|
||||||
quit events for that signal.
|
quit events for that signal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* There are no functions directly affecting the quit event */
|
/* There are no functions directly affecting the quit event */
|
||||||
#define SDL_QuitRequested() \
|
#define SDL_QuitRequested() \
|
||||||
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
||||||
|
|
||||||
#endif /* _SDL_quit_h */
|
#endif /* _SDL_quit_h */
|
||||||
|
|
|
@ -1,144 +1,144 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file provides a general interface for SDL to read and write
|
/* This file provides a general interface for SDL to read and write
|
||||||
data sources. It can easily be extended to files, memory, etc.
|
data sources. It can easily be extended to files, memory, etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_rwops_h
|
#ifndef _SDL_rwops_h
|
||||||
#define _SDL_rwops_h
|
#define _SDL_rwops_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is the read/write operation structure -- very basic */
|
/* This is the read/write operation structure -- very basic */
|
||||||
|
|
||||||
typedef struct SDL_RWops {
|
typedef struct SDL_RWops {
|
||||||
/* Seek to 'offset' relative to whence, one of stdio's whence values:
|
/* Seek to 'offset' relative to whence, one of stdio's whence values:
|
||||||
SEEK_SET, SEEK_CUR, SEEK_END
|
SEEK_SET, SEEK_CUR, SEEK_END
|
||||||
Returns the final offset in the data source.
|
Returns the final offset in the data source.
|
||||||
*/
|
*/
|
||||||
int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
|
int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
|
||||||
|
|
||||||
/* Read up to 'num' objects each of size 'objsize' from the data
|
/* Read up to 'num' objects each of size 'objsize' from the data
|
||||||
source to the area pointed at by 'ptr'.
|
source to the area pointed at by 'ptr'.
|
||||||
Returns the number of objects read, or -1 if the read failed.
|
Returns the number of objects read, or -1 if the read failed.
|
||||||
*/
|
*/
|
||||||
int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
||||||
|
|
||||||
/* Write exactly 'num' objects each of size 'objsize' from the area
|
/* Write exactly 'num' objects each of size 'objsize' from the area
|
||||||
pointed at by 'ptr' to data source.
|
pointed at by 'ptr' to data source.
|
||||||
Returns 'num', or -1 if the write failed.
|
Returns 'num', or -1 if the write failed.
|
||||||
*/
|
*/
|
||||||
int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
|
int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
|
||||||
|
|
||||||
/* Close and free an allocated SDL_FSops structure */
|
/* Close and free an allocated SDL_FSops structure */
|
||||||
int (SDLCALL *close)(struct SDL_RWops *context);
|
int (SDLCALL *close)(struct SDL_RWops *context);
|
||||||
|
|
||||||
Uint32 type;
|
Uint32 type;
|
||||||
union {
|
union {
|
||||||
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
|
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
|
||||||
struct {
|
struct {
|
||||||
int append;
|
int append;
|
||||||
void *h;
|
void *h;
|
||||||
struct {
|
struct {
|
||||||
void *data;
|
void *data;
|
||||||
int size;
|
int size;
|
||||||
int left;
|
int left;
|
||||||
} buffer;
|
} buffer;
|
||||||
} win32io;
|
} win32io;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
struct {
|
struct {
|
||||||
int autoclose;
|
int autoclose;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
} stdio;
|
} stdio;
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
Uint8 *base;
|
Uint8 *base;
|
||||||
Uint8 *here;
|
Uint8 *here;
|
||||||
Uint8 *stop;
|
Uint8 *stop;
|
||||||
} mem;
|
} mem;
|
||||||
struct {
|
struct {
|
||||||
void *data1;
|
void *data1;
|
||||||
} unknown;
|
} unknown;
|
||||||
} hidden;
|
} hidden;
|
||||||
|
|
||||||
} SDL_RWops;
|
} SDL_RWops;
|
||||||
|
|
||||||
|
|
||||||
/* Functions to create SDL_RWops structures from various data sources */
|
/* Functions to create SDL_RWops structures from various data sources */
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
|
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
|
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
|
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
|
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
|
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
|
||||||
|
|
||||||
#define RW_SEEK_SET 0 /* Seek from the beginning of data */
|
#define RW_SEEK_SET 0 /* Seek from the beginning of data */
|
||||||
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
|
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
|
||||||
#define RW_SEEK_END 2 /* Seek relative to the end of data */
|
#define RW_SEEK_END 2 /* Seek relative to the end of data */
|
||||||
|
|
||||||
/* Macros to easily read and write from an SDL_RWops structure */
|
/* Macros to easily read and write from an SDL_RWops structure */
|
||||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
||||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
||||||
|
|
||||||
|
|
||||||
/* Read an item of the specified endianness and return in native format */
|
/* Read an item of the specified endianness and return in native format */
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
|
||||||
|
|
||||||
/* Write an item of native format to the specified endianness */
|
/* Write an item of native format to the specified endianness */
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
|
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
|
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
|
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
|
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
|
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
|
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_rwops_h */
|
#endif /* _SDL_rwops_h */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,214 +1,214 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Include file for SDL custom system window manager hooks */
|
/* Include file for SDL custom system window manager hooks */
|
||||||
|
|
||||||
#ifndef _SDL_syswm_h
|
#ifndef _SDL_syswm_h
|
||||||
#define _SDL_syswm_h
|
#define _SDL_syswm_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_version.h"
|
#include "SDL_version.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
|
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
|
||||||
which contains window-manager specific information and arrives whenever
|
which contains window-manager specific information and arrives whenever
|
||||||
an unhandled window event occurs. This event is ignored by default, but
|
an unhandled window event occurs. This event is ignored by default, but
|
||||||
you can enable it with SDL_EventState()
|
you can enable it with SDL_EventState()
|
||||||
*/
|
*/
|
||||||
#ifdef SDL_PROTOTYPES_ONLY
|
#ifdef SDL_PROTOTYPES_ONLY
|
||||||
struct SDL_SysWMinfo;
|
struct SDL_SysWMinfo;
|
||||||
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* This is the structure for custom window manager events */
|
/* This is the structure for custom window manager events */
|
||||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
/* conflicts with Quickdraw.h */
|
/* conflicts with Quickdraw.h */
|
||||||
#define Cursor X11Cursor
|
#define Cursor X11Cursor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
/* matches the re-define above */
|
/* matches the re-define above */
|
||||||
#undef Cursor
|
#undef Cursor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These are the various supported subsystems under UNIX */
|
/* These are the various supported subsystems under UNIX */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDL_SYSWM_X11
|
SDL_SYSWM_X11
|
||||||
} SDL_SYSWM_TYPE;
|
} SDL_SYSWM_TYPE;
|
||||||
|
|
||||||
/* The UNIX custom event structure */
|
/* The UNIX custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
SDL_SYSWM_TYPE subsystem;
|
SDL_SYSWM_TYPE subsystem;
|
||||||
union {
|
union {
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
} event;
|
} event;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The UNIX custom window manager information structure.
|
/* The UNIX custom window manager information structure.
|
||||||
When this structure is returned, it holds information about which
|
When this structure is returned, it holds information about which
|
||||||
low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
SDL_SYSWM_TYPE subsystem;
|
SDL_SYSWM_TYPE subsystem;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
Display *display; /* The X11 display */
|
Display *display; /* The X11 display */
|
||||||
Window window; /* The X11 display window */
|
Window window; /* The X11 display window */
|
||||||
/* These locking functions should be called around
|
/* These locking functions should be called around
|
||||||
any X11 functions using the display variable,
|
any X11 functions using the display variable,
|
||||||
but not the gfxdisplay variable.
|
but not the gfxdisplay variable.
|
||||||
They lock the event thread, so should not be
|
They lock the event thread, so should not be
|
||||||
called around event functions or from event filters.
|
called around event functions or from event filters.
|
||||||
*/
|
*/
|
||||||
void (*lock_func)(void);
|
void (*lock_func)(void);
|
||||||
void (*unlock_func)(void);
|
void (*unlock_func)(void);
|
||||||
|
|
||||||
/* Introduced in SDL 1.0.2 */
|
/* Introduced in SDL 1.0.2 */
|
||||||
Window fswindow; /* The X11 fullscreen window */
|
Window fswindow; /* The X11 fullscreen window */
|
||||||
Window wmwindow; /* The X11 managed input window */
|
Window wmwindow; /* The X11 managed input window */
|
||||||
|
|
||||||
/* Introduced in SDL 1.2.12 */
|
/* Introduced in SDL 1.2.12 */
|
||||||
Display *gfxdisplay; /* The X11 display to which rendering is done */
|
Display *gfxdisplay; /* The X11 display to which rendering is done */
|
||||||
} x11;
|
} x11;
|
||||||
} info;
|
} info;
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_NANOX)
|
#elif defined(SDL_VIDEO_DRIVER_NANOX)
|
||||||
#include <microwin/nano-X.h>
|
#include <microwin/nano-X.h>
|
||||||
|
|
||||||
/* The generic custom event structure */
|
/* The generic custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int data;
|
int data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The windows custom window manager information structure */
|
/* The windows custom window manager information structure */
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version ;
|
SDL_version version ;
|
||||||
GR_WINDOW_ID window ; /* The display window */
|
GR_WINDOW_ID window ; /* The display window */
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
|
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
/* The windows custom event structure */
|
/* The windows custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
HWND hwnd; /* The window for the message */
|
HWND hwnd; /* The window for the message */
|
||||||
UINT msg; /* The type of message */
|
UINT msg; /* The type of message */
|
||||||
WPARAM wParam; /* WORD message parameter */
|
WPARAM wParam; /* WORD message parameter */
|
||||||
LPARAM lParam; /* LONG message parameter */
|
LPARAM lParam; /* LONG message parameter */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The windows custom window manager information structure */
|
/* The windows custom window manager information structure */
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
HWND window; /* The Win32 display window */
|
HWND window; /* The Win32 display window */
|
||||||
HGLRC hglrc; /* The OpenGL context, if any */
|
HGLRC hglrc; /* The OpenGL context, if any */
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
|
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
|
||||||
|
|
||||||
/* RISC OS custom event structure */
|
/* RISC OS custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int eventCode; /* The window for the message */
|
int eventCode; /* The window for the message */
|
||||||
int pollBlock[64];
|
int pollBlock[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The RISC OS custom window manager information structure */
|
/* The RISC OS custom window manager information structure */
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int wimpVersion; /* Wimp version running under */
|
int wimpVersion; /* Wimp version running under */
|
||||||
int taskHandle; /* The RISC OS task handle */
|
int taskHandle; /* The RISC OS task handle */
|
||||||
int window; /* The RISC OS display window */
|
int window; /* The RISC OS display window */
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
|
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
|
||||||
#include <sys/neutrino.h>
|
#include <sys/neutrino.h>
|
||||||
#include <Ph.h>
|
#include <Ph.h>
|
||||||
|
|
||||||
/* The QNX custom event structure */
|
/* The QNX custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int data;
|
int data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The QNX custom window manager information structure */
|
/* The QNX custom window manager information structure */
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int data;
|
int data;
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* The generic custom event structure */
|
/* The generic custom event structure */
|
||||||
struct SDL_SysWMmsg {
|
struct SDL_SysWMmsg {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int data;
|
int data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The generic custom window manager information structure */
|
/* The generic custom window manager information structure */
|
||||||
typedef struct SDL_SysWMinfo {
|
typedef struct SDL_SysWMinfo {
|
||||||
SDL_version version;
|
SDL_version version;
|
||||||
int data;
|
int data;
|
||||||
} SDL_SysWMinfo;
|
} SDL_SysWMinfo;
|
||||||
|
|
||||||
#endif /* video driver type */
|
#endif /* video driver type */
|
||||||
|
|
||||||
#endif /* SDL_PROTOTYPES_ONLY */
|
#endif /* SDL_PROTOTYPES_ONLY */
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
/*
|
/*
|
||||||
* This function gives you custom hooks into the window manager information.
|
* This function gives you custom hooks into the window manager information.
|
||||||
* It fills the structure pointed to by 'info' with custom information and
|
* It fills the structure pointed to by 'info' with custom information and
|
||||||
* returns 1 if the function is implemented. If it's not implemented, or
|
* returns 1 if the function is implemented. If it's not implemented, or
|
||||||
* the version member of the 'info' structure is invalid, it returns 0.
|
* the version member of the 'info' structure is invalid, it returns 0.
|
||||||
*
|
*
|
||||||
* You typically use this function like this:
|
* You typically use this function like this:
|
||||||
* SDL_SysWMInfo info;
|
* SDL_SysWMInfo info;
|
||||||
* SDL_VERSION(&info.version);
|
* SDL_VERSION(&info.version);
|
||||||
* if ( SDL_GetWMInfo(&info) ) { ... }
|
* if ( SDL_GetWMInfo(&info) ) { ... }
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
|
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_syswm_h */
|
#endif /* _SDL_syswm_h */
|
||||||
|
|
|
@ -1,119 +1,119 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_thread_h
|
#ifndef _SDL_thread_h
|
||||||
#define _SDL_thread_h
|
#define _SDL_thread_h
|
||||||
|
|
||||||
/* Header for the SDL thread management routines
|
/* Header for the SDL thread management routines
|
||||||
|
|
||||||
These are independent of the other SDL routines.
|
These are independent of the other SDL routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
/* Thread synchronization primitives */
|
/* Thread synchronization primitives */
|
||||||
#include "SDL_mutex.h"
|
#include "SDL_mutex.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The SDL thread structure, defined in SDL_thread.c */
|
/* The SDL thread structure, defined in SDL_thread.c */
|
||||||
struct SDL_Thread;
|
struct SDL_Thread;
|
||||||
typedef struct SDL_Thread SDL_Thread;
|
typedef struct SDL_Thread SDL_Thread;
|
||||||
|
|
||||||
/* Create a thread */
|
/* Create a thread */
|
||||||
#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
|
#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
|
||||||
/*
|
/*
|
||||||
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
||||||
creates a new thread for the calling process with the SDL_CreateThread()
|
creates a new thread for the calling process with the SDL_CreateThread()
|
||||||
API. There is a problem with this, that only the RTL of the SDL.DLL will
|
API. There is a problem with this, that only the RTL of the SDL.DLL will
|
||||||
be initialized for those threads, and not the RTL of the calling application!
|
be initialized for those threads, and not the RTL of the calling application!
|
||||||
To solve this, we make a little hack here.
|
To solve this, we make a little hack here.
|
||||||
We'll always use the caller's _beginthread() and _endthread() APIs to
|
We'll always use the caller's _beginthread() and _endthread() APIs to
|
||||||
start a new thread. This way, if it's the SDL.DLL which uses this API,
|
start a new thread. This way, if it's the SDL.DLL which uses this API,
|
||||||
then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
||||||
the application, then the RTL of the application will be used.
|
the application, then the RTL of the application will be used.
|
||||||
So, in short:
|
So, in short:
|
||||||
Always use the _beginthread() and _endthread() of the calling runtime library!
|
Always use the _beginthread() and _endthread() of the calling runtime library!
|
||||||
*/
|
*/
|
||||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
|
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
|
||||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
typedef void (*pfnSDL_CurrentEndThread)(void);
|
||||||
#elif __GNUC__
|
#elif __GNUC__
|
||||||
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||||
unsigned (__stdcall *func)(void *), void *arg,
|
unsigned (__stdcall *func)(void *), void *arg,
|
||||||
unsigned, unsigned *threadID);
|
unsigned, unsigned *threadID);
|
||||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||||
#else
|
#else
|
||||||
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||||
unsigned (__stdcall *func)(void *), void *arg,
|
unsigned (__stdcall *func)(void *), void *arg,
|
||||||
unsigned, unsigned *threadID);
|
unsigned, unsigned *threadID);
|
||||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
|
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
|
||||||
#elif defined(_WIN32_WCE)
|
#elif defined(_WIN32_WCE)
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
||||||
#else
|
#else
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
|
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get the 32-bit thread identifier for the current thread */
|
/* Get the 32-bit thread identifier for the current thread */
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
|
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
|
||||||
|
|
||||||
/* Get the 32-bit thread identifier for the specified thread,
|
/* Get the 32-bit thread identifier for the specified thread,
|
||||||
equivalent to SDL_ThreadID() if the specified thread is NULL.
|
equivalent to SDL_ThreadID() if the specified thread is NULL.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
|
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
|
||||||
|
|
||||||
/* Wait for a thread to finish.
|
/* Wait for a thread to finish.
|
||||||
The return code for the thread function is placed in the area
|
The return code for the thread function is placed in the area
|
||||||
pointed to by 'status', if 'status' is not NULL.
|
pointed to by 'status', if 'status' is not NULL.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
||||||
|
|
||||||
/* Forcefully kill a thread without worrying about its state */
|
/* Forcefully kill a thread without worrying about its state */
|
||||||
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
|
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_thread_h */
|
#endif /* _SDL_thread_h */
|
||||||
|
|
|
@ -1,115 +1,115 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_timer_h
|
#ifndef _SDL_timer_h
|
||||||
#define _SDL_timer_h
|
#define _SDL_timer_h
|
||||||
|
|
||||||
/* Header for the SDL time management routines */
|
/* Header for the SDL time management routines */
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is the OS scheduler timeslice, in milliseconds */
|
/* This is the OS scheduler timeslice, in milliseconds */
|
||||||
#define SDL_TIMESLICE 10
|
#define SDL_TIMESLICE 10
|
||||||
|
|
||||||
/* This is the maximum resolution of the SDL timer on all platforms */
|
/* This is the maximum resolution of the SDL timer on all platforms */
|
||||||
#define TIMER_RESOLUTION 10 /* Experimentally determined */
|
#define TIMER_RESOLUTION 10 /* Experimentally determined */
|
||||||
|
|
||||||
/* Get the number of milliseconds since the SDL library initialization.
|
/* Get the number of milliseconds since the SDL library initialization.
|
||||||
* Note that this value wraps if the program runs for more than ~49 days.
|
* Note that this value wraps if the program runs for more than ~49 days.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||||
|
|
||||||
/* Wait a specified number of milliseconds before returning */
|
/* Wait a specified number of milliseconds before returning */
|
||||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||||
|
|
||||||
/* Function prototype for the timer callback function */
|
/* Function prototype for the timer callback function */
|
||||||
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
|
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
|
||||||
|
|
||||||
/* Set a callback to run after the specified number of milliseconds has
|
/* Set a callback to run after the specified number of milliseconds has
|
||||||
* elapsed. The callback function is passed the current timer interval
|
* elapsed. The callback function is passed the current timer interval
|
||||||
* and returns the next timer interval. If the returned value is the
|
* and returns the next timer interval. If the returned value is the
|
||||||
* same as the one passed in, the periodic alarm continues, otherwise a
|
* same as the one passed in, the periodic alarm continues, otherwise a
|
||||||
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
||||||
* is cancelled.
|
* is cancelled.
|
||||||
*
|
*
|
||||||
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
|
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
|
||||||
*
|
*
|
||||||
* The timer callback function may run in a different thread than your
|
* The timer callback function may run in a different thread than your
|
||||||
* main code, and so shouldn't call any functions from within itself.
|
* main code, and so shouldn't call any functions from within itself.
|
||||||
*
|
*
|
||||||
* The maximum resolution of this timer is 10 ms, which means that if
|
* The maximum resolution of this timer is 10 ms, which means that if
|
||||||
* you request a 16 ms timer, your callback will run approximately 20 ms
|
* you request a 16 ms timer, your callback will run approximately 20 ms
|
||||||
* later on an unloaded system. If you wanted to set a flag signaling
|
* later on an unloaded system. If you wanted to set a flag signaling
|
||||||
* a frame update at 30 frames per second (every 33 ms), you might set a
|
* a frame update at 30 frames per second (every 33 ms), you might set a
|
||||||
* timer for 30 ms:
|
* timer for 30 ms:
|
||||||
* SDL_SetTimer((33/10)*10, flag_update);
|
* SDL_SetTimer((33/10)*10, flag_update);
|
||||||
*
|
*
|
||||||
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
|
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
|
||||||
*
|
*
|
||||||
* Under UNIX, you should not use raise or use SIGALRM and this function
|
* Under UNIX, you should not use raise or use SIGALRM and this function
|
||||||
* in the same program, as it is implemented using setitimer(). You also
|
* in the same program, as it is implemented using setitimer(). You also
|
||||||
* should not use this function in multi-threaded applications as signals
|
* should not use this function in multi-threaded applications as signals
|
||||||
* to multi-threaded apps have undefined behavior in some implementations.
|
* to multi-threaded apps have undefined behavior in some implementations.
|
||||||
*
|
*
|
||||||
* This function returns 0 if successful, or -1 if there was an error.
|
* This function returns 0 if successful, or -1 if there was an error.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
|
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
|
||||||
|
|
||||||
/* New timer API, supports multiple timers
|
/* New timer API, supports multiple timers
|
||||||
* Written by Stephane Peter <megastep@lokigames.com>
|
* Written by Stephane Peter <megastep@lokigames.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Function prototype for the new timer callback function.
|
/* Function prototype for the new timer callback function.
|
||||||
* The callback function is passed the current timer interval and returns
|
* The callback function is passed the current timer interval and returns
|
||||||
* the next timer interval. If the returned value is the same as the one
|
* the next timer interval. If the returned value is the same as the one
|
||||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
* passed in, the periodic alarm continues, otherwise a new alarm is
|
||||||
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
||||||
*/
|
*/
|
||||||
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
|
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
|
||||||
|
|
||||||
/* Definition of the timer ID type */
|
/* Definition of the timer ID type */
|
||||||
typedef struct _SDL_TimerID *SDL_TimerID;
|
typedef struct _SDL_TimerID *SDL_TimerID;
|
||||||
|
|
||||||
/* Add a new timer to the pool of timers already running.
|
/* Add a new timer to the pool of timers already running.
|
||||||
Returns a timer ID, or NULL when an error occurs.
|
Returns a timer ID, or NULL when an error occurs.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
|
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
|
||||||
|
|
||||||
/* Remove one of the multiple timers knowing its ID.
|
/* Remove one of the multiple timers knowing its ID.
|
||||||
* Returns a boolean value indicating success.
|
* Returns a boolean value indicating success.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_timer_h */
|
#endif /* _SDL_timer_h */
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* DEPRECATED */
|
/* DEPRECATED */
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
Copyright (C) 1997-2006 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This header defines the current SDL version */
|
/* This header defines the current SDL version */
|
||||||
|
|
||||||
#ifndef _SDL_version_h
|
#ifndef _SDL_version_h
|
||||||
#define _SDL_version_h
|
#define _SDL_version_h
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||||
*/
|
*/
|
||||||
#define SDL_MAJOR_VERSION 1
|
#define SDL_MAJOR_VERSION 1
|
||||||
#define SDL_MINOR_VERSION 2
|
#define SDL_MINOR_VERSION 2
|
||||||
#define SDL_PATCHLEVEL 13
|
#define SDL_PATCHLEVEL 13
|
||||||
|
|
||||||
typedef struct SDL_version {
|
typedef struct SDL_version {
|
||||||
Uint8 major;
|
Uint8 major;
|
||||||
Uint8 minor;
|
Uint8 minor;
|
||||||
Uint8 patch;
|
Uint8 patch;
|
||||||
} SDL_version;
|
} SDL_version;
|
||||||
|
|
||||||
/* This macro can be used to fill a version structure with the compile-time
|
/* This macro can be used to fill a version structure with the compile-time
|
||||||
* version of the SDL library.
|
* version of the SDL library.
|
||||||
*/
|
*/
|
||||||
#define SDL_VERSION(X) \
|
#define SDL_VERSION(X) \
|
||||||
{ \
|
{ \
|
||||||
(X)->major = SDL_MAJOR_VERSION; \
|
(X)->major = SDL_MAJOR_VERSION; \
|
||||||
(X)->minor = SDL_MINOR_VERSION; \
|
(X)->minor = SDL_MINOR_VERSION; \
|
||||||
(X)->patch = SDL_PATCHLEVEL; \
|
(X)->patch = SDL_PATCHLEVEL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This macro turns the version numbers into a numeric value:
|
/* This macro turns the version numbers into a numeric value:
|
||||||
(1,2,3) -> (1203)
|
(1,2,3) -> (1203)
|
||||||
This assumes that there will never be more than 100 patchlevels
|
This assumes that there will never be more than 100 patchlevels
|
||||||
*/
|
*/
|
||||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
#define SDL_VERSIONNUM(X, Y, Z) \
|
||||||
((X)*1000 + (Y)*100 + (Z))
|
((X)*1000 + (Y)*100 + (Z))
|
||||||
|
|
||||||
/* This is the version number macro for the current SDL version */
|
/* This is the version number macro for the current SDL version */
|
||||||
#define SDL_COMPILEDVERSION \
|
#define SDL_COMPILEDVERSION \
|
||||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
||||||
|
|
||||||
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
|
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
|
||||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
||||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
||||||
|
|
||||||
/* This function gets the version of the dynamically linked SDL library.
|
/* This function gets the version of the dynamically linked SDL library.
|
||||||
it should NOT be used to fill a version structure, instead you should
|
it should NOT be used to fill a version structure, instead you should
|
||||||
use the SDL_Version() macro.
|
use the SDL_Version() macro.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
|
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "close_code.h"
|
#include "close_code.h"
|
||||||
|
|
||||||
#endif /* _SDL_version_h */
|
#endif /* _SDL_version_h */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,41 +1,41 @@
|
||||||
/*
|
/*
|
||||||
SDL - Simple DirectMedia Layer
|
SDL - Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2004 Sam Lantinga
|
Copyright (C) 1997-2004 Sam Lantinga
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2 of the License, or (at your option) any later version.
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Sam Lantinga
|
Sam Lantinga
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file reverses the effects of begin_code.h and should be included
|
/* This file reverses the effects of begin_code.h and should be included
|
||||||
after you finish any function and structure declarations in your headers
|
after you finish any function and structure declarations in your headers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef _begin_code_h
|
#undef _begin_code_h
|
||||||
|
|
||||||
/* Reset structure packing at previous byte alignment */
|
/* Reset structure packing at previous byte alignment */
|
||||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
|
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma nopackwarning
|
#pragma nopackwarning
|
||||||
#endif
|
#endif
|
||||||
#if (defined(__MWERKS__) && defined(__MACOS__))
|
#if (defined(__MWERKS__) && defined(__MACOS__))
|
||||||
#pragma options align=reset
|
#pragma options align=reset
|
||||||
#pragma enumsalwaysint reset
|
#pragma enumsalwaysint reset
|
||||||
#else
|
#else
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
#endif
|
#endif
|
||||||
#endif /* Compiler needs structure packing set */
|
#endif /* Compiler needs structure packing set */
|
||||||
|
|
||||||
|
|
|
@ -1,165 +1,165 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_CONFIG_HPP
|
#ifndef SFML_CONFIG_HPP
|
||||||
#define SFML_CONFIG_HPP
|
#define SFML_CONFIG_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Identify the operating system
|
// Identify the operating system
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#if defined(_WIN32) || defined(__WIN32__)
|
#if defined(_WIN32) || defined(__WIN32__)
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
#define SFML_SYSTEM_WINDOWS
|
#define SFML_SYSTEM_WINDOWS
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(linux) || defined(__linux)
|
#elif defined(linux) || defined(__linux)
|
||||||
|
|
||||||
// Linux
|
// Linux
|
||||||
#define SFML_SYSTEM_LINUX
|
#define SFML_SYSTEM_LINUX
|
||||||
|
|
||||||
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
|
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
|
||||||
|
|
||||||
// MacOS
|
// MacOS
|
||||||
#define SFML_SYSTEM_MACOS
|
#define SFML_SYSTEM_MACOS
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
|
|
||||||
// FreeBSD
|
// FreeBSD
|
||||||
#define SFML_SYSTEM_FREEBSD
|
#define SFML_SYSTEM_FREEBSD
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Unsupported system
|
// Unsupported system
|
||||||
#error This operating system is not supported by SFML library
|
#error This operating system is not supported by SFML library
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define a portable debug macro
|
// Define a portable debug macro
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
|
|
||||||
#define SFML_DEBUG
|
#define SFML_DEBUG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define portable import / export macros
|
// Define portable import / export macros
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
#if defined(SFML_SYSTEM_WINDOWS)
|
||||||
|
|
||||||
#ifdef SFML_DYNAMIC
|
#ifdef SFML_DYNAMIC
|
||||||
|
|
||||||
// Windows platforms
|
// Windows platforms
|
||||||
#ifdef SFML_EXPORTS
|
#ifdef SFML_EXPORTS
|
||||||
|
|
||||||
// From DLL side, we must export
|
// From DLL side, we must export
|
||||||
#define SFML_API __declspec(dllexport)
|
#define SFML_API __declspec(dllexport)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// From client application side, we must import
|
// From client application side, we must import
|
||||||
#define SFML_API __declspec(dllimport)
|
#define SFML_API __declspec(dllimport)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
|
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
|
||||||
// You can read lots ot different things about it, but the point is the code will
|
// You can read lots ot different things about it, but the point is the code will
|
||||||
// just work fine, and so the simplest way to get rid of this warning is to disable it
|
// just work fine, and so the simplest way to get rid of this warning is to disable it
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#pragma warning(disable : 4251)
|
#pragma warning(disable : 4251)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// No specific directive needed for static build
|
// No specific directive needed for static build
|
||||||
#define SFML_API
|
#define SFML_API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Other platforms don't need to define anything
|
// Other platforms don't need to define anything
|
||||||
#define SFML_API
|
#define SFML_API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define portable fixed-size types
|
// Define portable fixed-size types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
// 8 bits integer types
|
// 8 bits integer types
|
||||||
#if UCHAR_MAX == 0xFF
|
#if UCHAR_MAX == 0xFF
|
||||||
typedef signed char Int8;
|
typedef signed char Int8;
|
||||||
typedef unsigned char Uint8;
|
typedef unsigned char Uint8;
|
||||||
#else
|
#else
|
||||||
#error No 8 bits integer type for this platform
|
#error No 8 bits integer type for this platform
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 16 bits integer types
|
// 16 bits integer types
|
||||||
#if USHRT_MAX == 0xFFFF
|
#if USHRT_MAX == 0xFFFF
|
||||||
typedef signed short Int16;
|
typedef signed short Int16;
|
||||||
typedef unsigned short Uint16;
|
typedef unsigned short Uint16;
|
||||||
#elif UINT_MAX == 0xFFFF
|
#elif UINT_MAX == 0xFFFF
|
||||||
typedef signed int Int16;
|
typedef signed int Int16;
|
||||||
typedef unsigned int Uint16;
|
typedef unsigned int Uint16;
|
||||||
#elif ULONG_MAX == 0xFFFF
|
#elif ULONG_MAX == 0xFFFF
|
||||||
typedef signed long Int16;
|
typedef signed long Int16;
|
||||||
typedef unsigned long Uint16;
|
typedef unsigned long Uint16;
|
||||||
#else
|
#else
|
||||||
#error No 16 bits integer type for this platform
|
#error No 16 bits integer type for this platform
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 32 bits integer types
|
// 32 bits integer types
|
||||||
#if USHRT_MAX == 0xFFFFFFFF
|
#if USHRT_MAX == 0xFFFFFFFF
|
||||||
typedef signed short Int32;
|
typedef signed short Int32;
|
||||||
typedef unsigned short Uint32;
|
typedef unsigned short Uint32;
|
||||||
#elif UINT_MAX == 0xFFFFFFFF
|
#elif UINT_MAX == 0xFFFFFFFF
|
||||||
typedef signed int Int32;
|
typedef signed int Int32;
|
||||||
typedef unsigned int Uint32;
|
typedef unsigned int Uint32;
|
||||||
#elif ULONG_MAX == 0xFFFFFFFF
|
#elif ULONG_MAX == 0xFFFFFFFF
|
||||||
typedef signed long Int32;
|
typedef signed long Int32;
|
||||||
typedef unsigned long Uint32;
|
typedef unsigned long Uint32;
|
||||||
#else
|
#else
|
||||||
#error No 32 bits integer type for this platform
|
#error No 32 bits integer type for this platform
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_CONFIG_HPP
|
#endif // SFML_CONFIG_HPP
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_NETWORK_HPP
|
#ifndef SFML_NETWORK_HPP
|
||||||
#define SFML_NETWORK_HPP
|
#define SFML_NETWORK_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <SFML/System.hpp>
|
#include <SFML/System.hpp>
|
||||||
#include <SFML/Network/Ftp.hpp>
|
#include <SFML/Network/Ftp.hpp>
|
||||||
#include <SFML/Network/Http.hpp>
|
#include <SFML/Network/Http.hpp>
|
||||||
#include <SFML/Network/IPAddress.hpp>
|
#include <SFML/Network/IPAddress.hpp>
|
||||||
#include <SFML/Network/Packet.hpp>
|
#include <SFML/Network/Packet.hpp>
|
||||||
#include <SFML/Network/Selector.hpp>
|
#include <SFML/Network/Selector.hpp>
|
||||||
#include <SFML/Network/SocketTCP.hpp>
|
#include <SFML/Network/SocketTCP.hpp>
|
||||||
#include <SFML/Network/SocketUDP.hpp>
|
#include <SFML/Network/SocketUDP.hpp>
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_NETWORK_HPP
|
#endif // SFML_NETWORK_HPP
|
||||||
|
|
|
@ -1,448 +1,448 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_FTP_HPP
|
#ifndef SFML_FTP_HPP
|
||||||
#define SFML_FTP_HPP
|
#define SFML_FTP_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/System/NonCopyable.hpp>
|
#include <SFML/System/NonCopyable.hpp>
|
||||||
#include <SFML/Network/SocketTCP.hpp>
|
#include <SFML/Network/SocketTCP.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
class IPAddress;
|
class IPAddress;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class provides methods for manipulating the FTP
|
/// This class provides methods for manipulating the FTP
|
||||||
/// protocol (described in RFC 959).
|
/// protocol (described in RFC 959).
|
||||||
/// It provides easy access and transfers to remote
|
/// It provides easy access and transfers to remote
|
||||||
/// directories and files on a FTP server
|
/// directories and files on a FTP server
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Ftp : NonCopyable
|
class SFML_API Ftp : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumeration of transfer modes
|
/// Enumeration of transfer modes
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum TransferMode
|
enum TransferMode
|
||||||
{
|
{
|
||||||
Binary, ///< Binary mode (file is transfered as a sequence of bytes)
|
Binary, ///< Binary mode (file is transfered as a sequence of bytes)
|
||||||
Ascii, ///< Text mode using ASCII encoding
|
Ascii, ///< Text mode using ASCII encoding
|
||||||
Ebcdic ///< Text mode using EBCDIC encoding
|
Ebcdic ///< Text mode using EBCDIC encoding
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class wraps a FTP response, which is basically :
|
/// This class wraps a FTP response, which is basically :
|
||||||
/// - a status code
|
/// - a status code
|
||||||
/// - a message
|
/// - a message
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Response
|
class SFML_API Response
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumerate all the valid status codes returned in
|
/// Enumerate all the valid status codes returned in
|
||||||
/// a FTP response
|
/// a FTP response
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
// 1xx: the requested action is being initiated,
|
// 1xx: the requested action is being initiated,
|
||||||
// expect another reply before proceeding with a new command
|
// expect another reply before proceeding with a new command
|
||||||
RestartMarkerReply = 110, ///< Restart marker reply
|
RestartMarkerReply = 110, ///< Restart marker reply
|
||||||
ServiceReadySoon = 120, ///< Service ready in N minutes
|
ServiceReadySoon = 120, ///< Service ready in N minutes
|
||||||
DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting
|
DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting
|
||||||
OpeningDataConnection = 150, ///< File status ok, about to open data connection
|
OpeningDataConnection = 150, ///< File status ok, about to open data connection
|
||||||
|
|
||||||
// 2xx: the requested action has been successfully completed
|
// 2xx: the requested action has been successfully completed
|
||||||
Ok = 200, ///< Command ok
|
Ok = 200, ///< Command ok
|
||||||
PointlessCommand = 202, ///< Command not implemented
|
PointlessCommand = 202, ///< Command not implemented
|
||||||
SystemStatus = 211, ///< System status, or system help reply
|
SystemStatus = 211, ///< System status, or system help reply
|
||||||
DirectoryStatus = 212, ///< Directory status
|
DirectoryStatus = 212, ///< Directory status
|
||||||
FileStatus = 213, ///< File status
|
FileStatus = 213, ///< File status
|
||||||
HelpMessage = 214, ///< Help message
|
HelpMessage = 214, ///< Help message
|
||||||
SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
||||||
ServiceReady = 220, ///< Service ready for new user
|
ServiceReady = 220, ///< Service ready for new user
|
||||||
ClosingConnection = 221, ///< Service closing control connection
|
ClosingConnection = 221, ///< Service closing control connection
|
||||||
DataConnectionOpened = 225, ///< Data connection open, no transfer in progress
|
DataConnectionOpened = 225, ///< Data connection open, no transfer in progress
|
||||||
ClosingDataConnection = 226, ///< Closing data connection, requested file action successful
|
ClosingDataConnection = 226, ///< Closing data connection, requested file action successful
|
||||||
EnteringPassiveMode = 227, ///< Entering passive mode
|
EnteringPassiveMode = 227, ///< Entering passive mode
|
||||||
LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate
|
LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate
|
||||||
FileActionOk = 250, ///< Requested file action ok
|
FileActionOk = 250, ///< Requested file action ok
|
||||||
DirectoryOk = 257, ///< PATHNAME created
|
DirectoryOk = 257, ///< PATHNAME created
|
||||||
|
|
||||||
// 3xx: the command has been accepted, but the requested action
|
// 3xx: the command has been accepted, but the requested action
|
||||||
// is dormant, pending receipt of further information
|
// is dormant, pending receipt of further information
|
||||||
NeedPassword = 331, ///< User name ok, need password
|
NeedPassword = 331, ///< User name ok, need password
|
||||||
NeedAccountToLogIn = 332, ///< Need account for login
|
NeedAccountToLogIn = 332, ///< Need account for login
|
||||||
NeedInformation = 350, ///< Requested file action pending further information
|
NeedInformation = 350, ///< Requested file action pending further information
|
||||||
|
|
||||||
// 4xx: the command was not accepted and the requested action did not take place,
|
// 4xx: the command was not accepted and the requested action did not take place,
|
||||||
// but the error condition is temporary and the action may be requested again
|
// but the error condition is temporary and the action may be requested again
|
||||||
ServiceUnavailable = 421, ///< Service not available, closing control connection
|
ServiceUnavailable = 421, ///< Service not available, closing control connection
|
||||||
DataConnectionUnavailable = 425, ///< Can't open data connection
|
DataConnectionUnavailable = 425, ///< Can't open data connection
|
||||||
TransferAborted = 426, ///< Connection closed, transfer aborted
|
TransferAborted = 426, ///< Connection closed, transfer aborted
|
||||||
FileActionAborted = 450, ///< Requested file action not taken
|
FileActionAborted = 450, ///< Requested file action not taken
|
||||||
LocalError = 451, ///< Requested action aborted, local error in processing
|
LocalError = 451, ///< Requested action aborted, local error in processing
|
||||||
InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
|
InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
|
||||||
|
|
||||||
// 5xx: the command was not accepted and
|
// 5xx: the command was not accepted and
|
||||||
// the requested action did not take place
|
// the requested action did not take place
|
||||||
CommandUnknown = 500, ///< Syntax error, command unrecognized
|
CommandUnknown = 500, ///< Syntax error, command unrecognized
|
||||||
ParametersUnknown = 501, ///< Syntax error in parameters or arguments
|
ParametersUnknown = 501, ///< Syntax error in parameters or arguments
|
||||||
CommandNotImplemented = 502, ///< Command not implemented
|
CommandNotImplemented = 502, ///< Command not implemented
|
||||||
BadCommandSequence = 503, ///< Bad sequence of commands
|
BadCommandSequence = 503, ///< Bad sequence of commands
|
||||||
ParameterNotImplemented = 504, ///< Command not implemented for that parameter
|
ParameterNotImplemented = 504, ///< Command not implemented for that parameter
|
||||||
NotLoggedIn = 530, ///< Not logged in
|
NotLoggedIn = 530, ///< Not logged in
|
||||||
NeedAccountToStore = 532, ///< Need account for storing files
|
NeedAccountToStore = 532, ///< Need account for storing files
|
||||||
FileUnavailable = 550, ///< Requested action not taken, file unavailable
|
FileUnavailable = 550, ///< Requested action not taken, file unavailable
|
||||||
PageTypeUnknown = 551, ///< Requested action aborted, page type unknown
|
PageTypeUnknown = 551, ///< Requested action aborted, page type unknown
|
||||||
NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation
|
NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation
|
||||||
FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed
|
FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed
|
||||||
|
|
||||||
// 10xx: SFML custom codes
|
// 10xx: SFML custom codes
|
||||||
InvalidResponse = 1000, ///< Response is not a valid FTP one
|
InvalidResponse = 1000, ///< Response is not a valid FTP one
|
||||||
ConnectionFailed = 1001, ///< Connection with server failed
|
ConnectionFailed = 1001, ///< Connection with server failed
|
||||||
ConnectionClosed = 1002, ///< Connection with server closed
|
ConnectionClosed = 1002, ///< Connection with server closed
|
||||||
InvalidFile = 1003 ///< Invalid file to upload / download
|
InvalidFile = 1003 ///< Invalid file to upload / download
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param Code : Response status code (InvalidResponse by default)
|
/// \param Code : Response status code (InvalidResponse by default)
|
||||||
/// \param Message : Response message (empty by default)
|
/// \param Message : Response message (empty by default)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response(Status Code = InvalidResponse, const std::string& Message = "");
|
Response(Status Code = InvalidResponse, const std::string& Message = "");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Convenience function to check if the response status code
|
/// Convenience function to check if the response status code
|
||||||
/// means a success
|
/// means a success
|
||||||
///
|
///
|
||||||
/// \return True if status is success (code < 400)
|
/// \return True if status is success (code < 400)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool IsOk() const;
|
bool IsOk() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the response status code
|
/// Get the response status code
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Status GetStatus() const;
|
Status GetStatus() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the full message contained in the response
|
/// Get the full message contained in the response
|
||||||
///
|
///
|
||||||
/// \return The response message
|
/// \return The response message
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::string& GetMessage() const;
|
const std::string& GetMessage() const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Status myStatus; ///< Status code returned from the server
|
Status myStatus; ///< Status code returned from the server
|
||||||
std::string myMessage; ///< Last message received from the server
|
std::string myMessage; ///< Last message received from the server
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Specialization of FTP response returning a directory
|
/// Specialization of FTP response returning a directory
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API DirectoryResponse : public Response
|
class SFML_API DirectoryResponse : public Response
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param Resp : Source response
|
/// \param Resp : Source response
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
DirectoryResponse(Response Resp);
|
DirectoryResponse(Response Resp);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the directory returned in the response
|
/// Get the directory returned in the response
|
||||||
///
|
///
|
||||||
/// \return Directory name
|
/// \return Directory name
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::string& GetDirectory() const;
|
const std::string& GetDirectory() const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::string myDirectory; ///< Directory extracted from the response message
|
std::string myDirectory; ///< Directory extracted from the response message
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Specialization of FTP response returning a filename lisiting
|
/// Specialization of FTP response returning a filename lisiting
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API ListingResponse : public Response
|
class SFML_API ListingResponse : public Response
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param Resp : Source response
|
/// \param Resp : Source response
|
||||||
/// \param Data : Data containing the raw listing
|
/// \param Data : Data containing the raw listing
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ListingResponse(Response Resp, const std::vector<char>& Data);
|
ListingResponse(Response Resp, const std::vector<char>& Data);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the number of filenames in the listing
|
/// Get the number of filenames in the listing
|
||||||
///
|
///
|
||||||
/// \return Total number of filenames
|
/// \return Total number of filenames
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::size_t GetCount() const;
|
std::size_t GetCount() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the Index-th filename in the directory
|
/// Get the Index-th filename in the directory
|
||||||
///
|
///
|
||||||
/// \param Index : Index of the filename to get
|
/// \param Index : Index of the filename to get
|
||||||
///
|
///
|
||||||
/// \return Index-th filename
|
/// \return Index-th filename
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::string& GetFilename(std::size_t Index) const;
|
const std::string& GetFilename(std::size_t Index) const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::vector<std::string> myFilenames; ///< Filenames extracted from the data
|
std::vector<std::string> myFilenames; ///< Filenames extracted from the data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor -- close the connection with the server
|
/// Destructor -- close the connection with the server
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~Ftp();
|
~Ftp();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Connect to the specified FTP server
|
/// Connect to the specified FTP server
|
||||||
///
|
///
|
||||||
/// \param Server : FTP server to connect to
|
/// \param Server : FTP server to connect to
|
||||||
/// \param Port : Port used for connection (21 by default, standard FTP port)
|
/// \param Port : Port used for connection (21 by default, standard FTP port)
|
||||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f);
|
Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Log in using anonymous account
|
/// Log in using anonymous account
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Login();
|
Response Login();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Log in using a username and a password
|
/// Log in using a username and a password
|
||||||
///
|
///
|
||||||
/// \param UserName : User name
|
/// \param UserName : User name
|
||||||
/// \param Password : Password
|
/// \param Password : Password
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Login(const std::string& UserName, const std::string& Password);
|
Response Login(const std::string& UserName, const std::string& Password);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Close the connection with FTP server
|
/// Close the connection with FTP server
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Disconnect();
|
Response Disconnect();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send a null command just to prevent from being disconnected
|
/// Send a null command just to prevent from being disconnected
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response KeepAlive();
|
Response KeepAlive();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the current working directory
|
/// Get the current working directory
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
DirectoryResponse GetWorkingDirectory();
|
DirectoryResponse GetWorkingDirectory();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the contents of the given directory
|
/// Get the contents of the given directory
|
||||||
/// (subdirectories and files)
|
/// (subdirectories and files)
|
||||||
///
|
///
|
||||||
/// \param Directory : Directory to list ("" by default, the current one)
|
/// \param Directory : Directory to list ("" by default, the current one)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ListingResponse GetDirectoryListing(const std::string& Directory = "");
|
ListingResponse GetDirectoryListing(const std::string& Directory = "");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the current working directory
|
/// Change the current working directory
|
||||||
///
|
///
|
||||||
/// \param Directory : New directory, relative to the current one
|
/// \param Directory : New directory, relative to the current one
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response ChangeDirectory(const std::string& Directory);
|
Response ChangeDirectory(const std::string& Directory);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Go to the parent directory of the current one
|
/// Go to the parent directory of the current one
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response ParentDirectory();
|
Response ParentDirectory();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new directory
|
/// Create a new directory
|
||||||
///
|
///
|
||||||
/// \param Name : Name of the directory to create
|
/// \param Name : Name of the directory to create
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response MakeDirectory(const std::string& Name);
|
Response MakeDirectory(const std::string& Name);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove an existing directory
|
/// Remove an existing directory
|
||||||
///
|
///
|
||||||
/// \param Name : Name of the directory to remove
|
/// \param Name : Name of the directory to remove
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response DeleteDirectory(const std::string& Name);
|
Response DeleteDirectory(const std::string& Name);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Rename a file
|
/// Rename a file
|
||||||
///
|
///
|
||||||
/// \param File : File to rename
|
/// \param File : File to rename
|
||||||
/// \param NewName : New name
|
/// \param NewName : New name
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response RenameFile(const std::string& File, const std::string& NewName);
|
Response RenameFile(const std::string& File, const std::string& NewName);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove an existing file
|
/// Remove an existing file
|
||||||
///
|
///
|
||||||
/// \param Name : File to remove
|
/// \param Name : File to remove
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response DeleteFile(const std::string& Name);
|
Response DeleteFile(const std::string& Name);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Download a file from the server
|
/// Download a file from the server
|
||||||
///
|
///
|
||||||
/// \param DistantFile : Path of the distant file to download
|
/// \param DistantFile : Path of the distant file to download
|
||||||
/// \param DestPath : Where to put to file on the local computer
|
/// \param DestPath : Where to put to file on the local computer
|
||||||
/// \param Mode : Transfer mode (binary by default)
|
/// \param Mode : Transfer mode (binary by default)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary);
|
Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Upload a file to the server
|
/// Upload a file to the server
|
||||||
///
|
///
|
||||||
/// \param LocalFile : Path of the local file to upload
|
/// \param LocalFile : Path of the local file to upload
|
||||||
/// \param DestPath : Where to put to file on the server
|
/// \param DestPath : Where to put to file on the server
|
||||||
/// \param Mode : Transfer mode (binary by default)
|
/// \param Mode : Transfer mode (binary by default)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary);
|
Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send a command to the FTP server
|
/// Send a command to the FTP server
|
||||||
///
|
///
|
||||||
/// \param Command : Command to send
|
/// \param Command : Command to send
|
||||||
/// \param Parameter : Command parameter ("" by default)
|
/// \param Parameter : Command parameter ("" by default)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response SendCommand(const std::string& Command, const std::string& Parameter = "");
|
Response SendCommand(const std::string& Command, const std::string& Parameter = "");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Receive a response from the server
|
/// Receive a response from the server
|
||||||
/// (usually after a command has been sent)
|
/// (usually after a command has been sent)
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response GetResponse();
|
Response GetResponse();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Utility class for exchanging datas with the server
|
/// Utility class for exchanging datas with the server
|
||||||
/// on the data channel
|
/// on the data channel
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class DataChannel;
|
class DataChannel;
|
||||||
|
|
||||||
friend class DataChannel;
|
friend class DataChannel;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketTCP myCommandSocket; ///< Socket holding the control connection with the server
|
SocketTCP myCommandSocket; ///< Socket holding the control connection with the server
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_FTP_HPP
|
#endif // SFML_FTP_HPP
|
||||||
|
|
|
@ -1,340 +1,340 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_HTTP_HPP
|
#ifndef SFML_HTTP_HPP
|
||||||
#define SFML_HTTP_HPP
|
#define SFML_HTTP_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/System/NonCopyable.hpp>
|
#include <SFML/System/NonCopyable.hpp>
|
||||||
#include <SFML/Network/IPAddress.hpp>
|
#include <SFML/Network/IPAddress.hpp>
|
||||||
#include <SFML/Network/SocketTCP.hpp>
|
#include <SFML/Network/SocketTCP.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class provides methods for manipulating the HTTP
|
/// This class provides methods for manipulating the HTTP
|
||||||
/// protocol (described in RFC 1945).
|
/// protocol (described in RFC 1945).
|
||||||
/// It can connect to a website, get its files, send requests, etc.
|
/// It can connect to a website, get its files, send requests, etc.
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Http : NonCopyable
|
class SFML_API Http : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class wraps an HTTP request, which is basically :
|
/// This class wraps an HTTP request, which is basically :
|
||||||
/// - a header with a method, a target URI, and a set of field/value pairs
|
/// - a header with a method, a target URI, and a set of field/value pairs
|
||||||
/// - an optional body (for POST requests)
|
/// - an optional body (for POST requests)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Request
|
class SFML_API Request
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumerate the available HTTP methods for a request
|
/// Enumerate the available HTTP methods for a request
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum Method
|
enum Method
|
||||||
{
|
{
|
||||||
Get, ///< Request in get mode, standard method to retrieve a page
|
Get, ///< Request in get mode, standard method to retrieve a page
|
||||||
Post, ///< Request in post mode, usually to send data to a page
|
Post, ///< Request in post mode, usually to send data to a page
|
||||||
Head ///< Request a page's header only
|
Head ///< Request a page's header only
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param RequestMethod : Method to use for the request (Get by default)
|
/// \param RequestMethod : Method to use for the request (Get by default)
|
||||||
/// \param URI : Target URI ("/" by default -- index page)
|
/// \param URI : Target URI ("/" by default -- index page)
|
||||||
/// \param Body : Content of the request's body (empty by default)
|
/// \param Body : Content of the request's body (empty by default)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = "");
|
Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = "");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the value of a field; the field is added if it doesn't exist
|
/// Set the value of a field; the field is added if it doesn't exist
|
||||||
///
|
///
|
||||||
/// \param Field : Name of the field to set (case-insensitive)
|
/// \param Field : Name of the field to set (case-insensitive)
|
||||||
/// \param Value : Value of the field
|
/// \param Value : Value of the field
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetField(const std::string& Field, const std::string& Value);
|
void SetField(const std::string& Field, const std::string& Value);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the request method.
|
/// Set the request method.
|
||||||
/// This parameter is Http::Request::Get by default
|
/// This parameter is Http::Request::Get by default
|
||||||
///
|
///
|
||||||
/// \param RequestMethod : Method to use for the request
|
/// \param RequestMethod : Method to use for the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMethod(Method RequestMethod);
|
void SetMethod(Method RequestMethod);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the target URI of the request.
|
/// Set the target URI of the request.
|
||||||
/// This parameter is "/" by default
|
/// This parameter is "/" by default
|
||||||
///
|
///
|
||||||
/// \param URI : URI to request, local to the host
|
/// \param URI : URI to request, local to the host
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetURI(const std::string& URI);
|
void SetURI(const std::string& URI);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the HTTP version of the request.
|
/// Set the HTTP version of the request.
|
||||||
/// This parameter is 1.0 by default
|
/// This parameter is 1.0 by default
|
||||||
///
|
///
|
||||||
/// \param Major : Major version number
|
/// \param Major : Major version number
|
||||||
/// \param Minor : Minor version number
|
/// \param Minor : Minor version number
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetHttpVersion(unsigned int Major, unsigned int Minor);
|
void SetHttpVersion(unsigned int Major, unsigned int Minor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the body of the request. This parameter is optional and
|
/// Set the body of the request. This parameter is optional and
|
||||||
/// makes sense only for POST requests.
|
/// makes sense only for POST requests.
|
||||||
/// This parameter is empty by default
|
/// This parameter is empty by default
|
||||||
///
|
///
|
||||||
/// \param Body : Content of the request body
|
/// \param Body : Content of the request body
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetBody(const std::string& Body);
|
void SetBody(const std::string& Body);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
friend class Http;
|
friend class Http;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the string representation of the request header
|
/// Get the string representation of the request header
|
||||||
///
|
///
|
||||||
/// \return String containing the request
|
/// \return String containing the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if the given field has been defined
|
/// Check if the given field has been defined
|
||||||
///
|
///
|
||||||
/// \param Field : Name of the field to check (case-insensitive)
|
/// \param Field : Name of the field to check (case-insensitive)
|
||||||
///
|
///
|
||||||
/// \return True if the field exists
|
/// \return True if the field exists
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool HasField(const std::string& Field) const;
|
bool HasField(const std::string& Field) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Types
|
// Types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef std::map<std::string, std::string> FieldTable;
|
typedef std::map<std::string, std::string> FieldTable;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
FieldTable myFields; ///< Fields of the header
|
FieldTable myFields; ///< Fields of the header
|
||||||
Method myMethod; ///< Method to use for the request
|
Method myMethod; ///< Method to use for the request
|
||||||
std::string myURI; ///< Target URI of the request
|
std::string myURI; ///< Target URI of the request
|
||||||
unsigned int myMajorVersion; ///< Major HTTP version
|
unsigned int myMajorVersion; ///< Major HTTP version
|
||||||
unsigned int myMinorVersion; ///< Minor HTTP version
|
unsigned int myMinorVersion; ///< Minor HTTP version
|
||||||
std::string myBody; ///< Body of the request
|
std::string myBody; ///< Body of the request
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class wraps an HTTP response, which is basically :
|
/// This class wraps an HTTP response, which is basically :
|
||||||
/// - a header with a status code and a set of field/value pairs
|
/// - a header with a status code and a set of field/value pairs
|
||||||
/// - a body (the content of the requested resource)
|
/// - a body (the content of the requested resource)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Response
|
class SFML_API Response
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumerate all the valid status codes returned in
|
/// Enumerate all the valid status codes returned in
|
||||||
/// a HTTP response
|
/// a HTTP response
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
// 2xx: success
|
// 2xx: success
|
||||||
Ok = 200, ///< Most common code returned when operation was successful
|
Ok = 200, ///< Most common code returned when operation was successful
|
||||||
Created = 201, ///< The resource has successfully been created
|
Created = 201, ///< The resource has successfully been created
|
||||||
Accepted = 202, ///< The request has been accepted, but will be processed later by the server
|
Accepted = 202, ///< The request has been accepted, but will be processed later by the server
|
||||||
NoContent = 204, ///< Sent when the server didn't send any data in return
|
NoContent = 204, ///< Sent when the server didn't send any data in return
|
||||||
|
|
||||||
// 3xx: redirection
|
// 3xx: redirection
|
||||||
MultipleChoices = 300, ///< The requested page can be accessed from several locations
|
MultipleChoices = 300, ///< The requested page can be accessed from several locations
|
||||||
MovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
MovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
||||||
MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
||||||
NotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
|
NotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||||
|
|
||||||
// 4xx: client error
|
// 4xx: client error
|
||||||
BadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
BadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
||||||
Unauthorized = 401, ///< The requested page needs an authentification to be accessed
|
Unauthorized = 401, ///< The requested page needs an authentification to be accessed
|
||||||
Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
|
Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
|
||||||
NotFound = 404, ///< The requested page doesn't exist
|
NotFound = 404, ///< The requested page doesn't exist
|
||||||
|
|
||||||
// 5xx: server error
|
// 5xx: server error
|
||||||
InternalServerError = 500, ///< The server encountered an unexpected error
|
InternalServerError = 500, ///< The server encountered an unexpected error
|
||||||
NotImplemented = 501, ///< The server doesn't implement a requested feature
|
NotImplemented = 501, ///< The server doesn't implement a requested feature
|
||||||
BadGateway = 502, ///< The gateway server has received an error from the source server
|
BadGateway = 502, ///< The gateway server has received an error from the source server
|
||||||
ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...)
|
ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...)
|
||||||
|
|
||||||
// 10xx: SFML custom codes
|
// 10xx: SFML custom codes
|
||||||
InvalidResponse = 1000, ///< Response is not a valid HTTP one
|
InvalidResponse = 1000, ///< Response is not a valid HTTP one
|
||||||
ConnectionFailed = 1001 ///< Connection with server failed
|
ConnectionFailed = 1001 ///< Connection with server failed
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response();
|
Response();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the value of a field
|
/// Get the value of a field
|
||||||
///
|
///
|
||||||
/// \param Field : Name of the field to get (case-insensitive)
|
/// \param Field : Name of the field to get (case-insensitive)
|
||||||
///
|
///
|
||||||
/// \return Value of the field, or empty string if not found
|
/// \return Value of the field, or empty string if not found
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::string& GetField(const std::string& Field) const;
|
const std::string& GetField(const std::string& Field) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the header's status code
|
/// Get the header's status code
|
||||||
///
|
///
|
||||||
/// \return Header's status code
|
/// \return Header's status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Status GetStatus() const;
|
Status GetStatus() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the major HTTP version number of the response
|
/// Get the major HTTP version number of the response
|
||||||
///
|
///
|
||||||
/// \return Major version number
|
/// \return Major version number
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int GetMajorHttpVersion() const;
|
unsigned int GetMajorHttpVersion() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the major HTTP version number of the response
|
/// Get the major HTTP version number of the response
|
||||||
///
|
///
|
||||||
/// \return Major version number
|
/// \return Major version number
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int GetMinorHttpVersion() const;
|
unsigned int GetMinorHttpVersion() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the body of the response. The body can contain :
|
/// Get the body of the response. The body can contain :
|
||||||
/// - the requested page (for GET requests)
|
/// - the requested page (for GET requests)
|
||||||
/// - a response from the server (for POST requests)
|
/// - a response from the server (for POST requests)
|
||||||
/// - nothing (for HEAD requests)
|
/// - nothing (for HEAD requests)
|
||||||
/// - an error message (in case of an error)
|
/// - an error message (in case of an error)
|
||||||
///
|
///
|
||||||
/// \return The response body
|
/// \return The response body
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const std::string& GetBody() const;
|
const std::string& GetBody() const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
friend class Http;
|
friend class Http;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the header from a response string
|
/// Construct the header from a response string
|
||||||
///
|
///
|
||||||
/// \param Data : Content of the response's header to parse
|
/// \param Data : Content of the response's header to parse
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void FromString(const std::string& Data);
|
void FromString(const std::string& Data);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Types
|
// Types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef std::map<std::string, std::string> FieldTable;
|
typedef std::map<std::string, std::string> FieldTable;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
FieldTable myFields; ///< Fields of the header
|
FieldTable myFields; ///< Fields of the header
|
||||||
Status myStatus; ///< Status code
|
Status myStatus; ///< Status code
|
||||||
unsigned int myMajorVersion; ///< Major HTTP version
|
unsigned int myMajorVersion; ///< Major HTTP version
|
||||||
unsigned int myMinorVersion; ///< Minor HTTP version
|
unsigned int myMinorVersion; ///< Minor HTTP version
|
||||||
std::string myBody; ///< Body of the response
|
std::string myBody; ///< Body of the response
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Http();
|
Http();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the Http instance with the target host
|
/// Construct the Http instance with the target host
|
||||||
///
|
///
|
||||||
/// \param Host : Web server to connect to
|
/// \param Host : Web server to connect to
|
||||||
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Http(const std::string& Host, unsigned short Port = 0);
|
Http(const std::string& Host, unsigned short Port = 0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set the target host
|
/// Set the target host
|
||||||
///
|
///
|
||||||
/// \param Host : Web server to connect to
|
/// \param Host : Web server to connect to
|
||||||
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetHost(const std::string& Host, unsigned short Port = 0);
|
void SetHost(const std::string& Host, unsigned short Port = 0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send a HTTP request and return the server's response.
|
/// Send a HTTP request and return the server's response.
|
||||||
/// You must be connected to a host before sending requests.
|
/// You must be connected to a host before sending requests.
|
||||||
/// Any missing mandatory header field will be added with an appropriate value.
|
/// Any missing mandatory header field will be added with an appropriate value.
|
||||||
/// Warning : this function waits for the server's response and may
|
/// Warning : this function waits for the server's response and may
|
||||||
/// not return instantly; use a thread if you don't want to block your
|
/// not return instantly; use a thread if you don't want to block your
|
||||||
/// application.
|
/// application.
|
||||||
///
|
///
|
||||||
/// \param Req : Request to send
|
/// \param Req : Request to send
|
||||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||||
///
|
///
|
||||||
/// \return Server's response
|
/// \return Server's response
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response SendRequest(const Request& Req, float Timeout = 0.f);
|
Response SendRequest(const Request& Req, float Timeout = 0.f);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketTCP myConnection; ///< Connection to the host
|
SocketTCP myConnection; ///< Connection to the host
|
||||||
IPAddress myHost; ///< Web host address
|
IPAddress myHost; ///< Web host address
|
||||||
std::string myHostName; ///< Web host name
|
std::string myHostName; ///< Web host name
|
||||||
unsigned short myPort; ///< Port used for connection with host
|
unsigned short myPort; ///< Port used for connection with host
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_HTTP_HPP
|
#endif // SFML_HTTP_HPP
|
||||||
|
|
|
@ -1,231 +1,231 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_IPADDRESS_HPP
|
#ifndef SFML_IPADDRESS_HPP
|
||||||
#define SFML_IPADDRESS_HPP
|
#define SFML_IPADDRESS_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// IPAddress provides easy manipulation of IP v4 addresses
|
/// IPAddress provides easy manipulation of IP v4 addresses
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API IPAddress
|
class SFML_API IPAddress
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor -- constructs an invalid address
|
/// Default constructor -- constructs an invalid address
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IPAddress();
|
IPAddress();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the address from a string
|
/// Construct the address from a string
|
||||||
///
|
///
|
||||||
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IPAddress(const std::string& Address);
|
IPAddress(const std::string& Address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the address from a C-style string ;
|
/// Construct the address from a C-style string ;
|
||||||
/// Needed for implicit conversions from literal strings to IPAddress to work
|
/// Needed for implicit conversions from literal strings to IPAddress to work
|
||||||
///
|
///
|
||||||
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IPAddress(const char* Address);
|
IPAddress(const char* Address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the address from 4 bytes
|
/// Construct the address from 4 bytes
|
||||||
///
|
///
|
||||||
/// \param Byte0 : First byte of the address
|
/// \param Byte0 : First byte of the address
|
||||||
/// \param Byte1 : Second byte of the address
|
/// \param Byte1 : Second byte of the address
|
||||||
/// \param Byte2 : Third byte of the address
|
/// \param Byte2 : Third byte of the address
|
||||||
/// \param Byte3 : Fourth byte of the address
|
/// \param Byte3 : Fourth byte of the address
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3);
|
IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the address from a 32-bits integer
|
/// Construct the address from a 32-bits integer
|
||||||
///
|
///
|
||||||
/// \param Address : 4 bytes of the address packed into a 32-bits integer
|
/// \param Address : 4 bytes of the address packed into a 32-bits integer
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IPAddress(Uint32 Address);
|
IPAddress(Uint32 Address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Tell if the address is a valid one
|
/// Tell if the address is a valid one
|
||||||
///
|
///
|
||||||
/// \return True if address has a valid syntax
|
/// \return True if address has a valid syntax
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get a string representation of the address
|
/// Get a string representation of the address
|
||||||
///
|
///
|
||||||
/// \return String representation of the IP address ("xxx.xxx.xxx.xxx")
|
/// \return String representation of the IP address ("xxx.xxx.xxx.xxx")
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get an integer representation of the address
|
/// Get an integer representation of the address
|
||||||
///
|
///
|
||||||
/// \return 32-bits integer containing the 4 bytes of the address, in system endianness
|
/// \return 32-bits integer containing the 4 bytes of the address, in system endianness
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Uint32 ToInteger() const;
|
Uint32 ToInteger() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the computer's local IP address (from the LAN point of view)
|
/// Get the computer's local IP address (from the LAN point of view)
|
||||||
///
|
///
|
||||||
/// \return Local IP address
|
/// \return Local IP address
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static IPAddress GetLocalAddress();
|
static IPAddress GetLocalAddress();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the computer's public IP address (from the web point of view).
|
/// Get the computer's public IP address (from the web point of view).
|
||||||
/// The only way to get a public address is to ask it to a
|
/// The only way to get a public address is to ask it to a
|
||||||
/// distant website ; as a consequence, this function may be
|
/// distant website ; as a consequence, this function may be
|
||||||
/// very slow -- use it as few as possible !
|
/// very slow -- use it as few as possible !
|
||||||
///
|
///
|
||||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout)
|
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout)
|
||||||
///
|
///
|
||||||
/// \return Public IP address
|
/// \return Public IP address
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static IPAddress GetPublicAddress(float Timeout = 0.f);
|
static IPAddress GetPublicAddress(float Timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator ==
|
/// Comparison operator ==
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this == Other
|
/// \return True if *this == Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator ==(const IPAddress& Other) const;
|
bool operator ==(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator !=
|
/// Comparison operator !=
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this != Other
|
/// \return True if *this != Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator !=(const IPAddress& Other) const;
|
bool operator !=(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <
|
/// Comparison operator <
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this < Other
|
/// \return True if *this < Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator <(const IPAddress& Other) const;
|
bool operator <(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator >
|
/// Comparison operator >
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this > Other
|
/// \return True if *this > Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator >(const IPAddress& Other) const;
|
bool operator >(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <=
|
/// Comparison operator <=
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this <= Other
|
/// \return True if *this <= Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator <=(const IPAddress& Other) const;
|
bool operator <=(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator >=
|
/// Comparison operator >=
|
||||||
///
|
///
|
||||||
/// \param Other : Address to compare
|
/// \param Other : Address to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this >= Other
|
/// \return True if *this >= Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator >=(const IPAddress& Other) const;
|
bool operator >=(const IPAddress& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Static member data
|
// Static member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static const IPAddress LocalHost; ///< Local host address (to connect to the same computer)
|
static const IPAddress LocalHost; ///< Local host address (to connect to the same computer)
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Uint32 myAddress; ///< Address stored as an unsigned 32 bits integer
|
Uint32 myAddress; ///< Address stored as an unsigned 32 bits integer
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator >> overload to extract an address from an input stream
|
/// Operator >> overload to extract an address from an input stream
|
||||||
///
|
///
|
||||||
/// \param Stream : Input stream
|
/// \param Stream : Input stream
|
||||||
/// \param Address : Address to extract
|
/// \param Address : Address to extract
|
||||||
///
|
///
|
||||||
/// \return Reference to the input stream
|
/// \return Reference to the input stream
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
|
SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator << overload to print an address to an output stream
|
/// Operator << overload to print an address to an output stream
|
||||||
///
|
///
|
||||||
/// \param Stream : Output stream
|
/// \param Stream : Output stream
|
||||||
/// \param Address : Address to print
|
/// \param Address : Address to print
|
||||||
///
|
///
|
||||||
/// \return Reference to the output stream
|
/// \return Reference to the output stream
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address);
|
SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address);
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_IPADDRESS_HPP
|
#endif // SFML_IPADDRESS_HPP
|
||||||
|
|
|
@ -1,187 +1,187 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_PACKET_HPP
|
#ifndef SFML_PACKET_HPP
|
||||||
#define SFML_PACKET_HPP
|
#define SFML_PACKET_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Packet wraps data to send / to receive through the network
|
/// Packet wraps data to send / to receive through the network
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Packet
|
class SFML_API Packet
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Packet();
|
Packet();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Virtual destructor
|
/// Virtual destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual ~Packet();
|
virtual ~Packet();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Append data to the end of the packet
|
/// Append data to the end of the packet
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to the bytes to append
|
/// \param Data : Pointer to the bytes to append
|
||||||
/// \param SizeInBytes : Number of bytes to append
|
/// \param SizeInBytes : Number of bytes to append
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Append(const void* Data, std::size_t SizeInBytes);
|
void Append(const void* Data, std::size_t SizeInBytes);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Clear the packet data
|
/// Clear the packet data
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get a pointer to the data contained in the packet
|
/// Get a pointer to the data contained in the packet
|
||||||
/// Warning : the returned pointer may be invalid after you
|
/// Warning : the returned pointer may be invalid after you
|
||||||
/// append data to the packet
|
/// append data to the packet
|
||||||
///
|
///
|
||||||
/// \return Pointer to the data
|
/// \return Pointer to the data
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const char* GetData() const;
|
const char* GetData() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the size of the data contained in the packet
|
/// Get the size of the data contained in the packet
|
||||||
///
|
///
|
||||||
/// \return Data size, in bytes
|
/// \return Data size, in bytes
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::size_t GetDataSize() const;
|
std::size_t GetDataSize() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Tell if the reading position has reached the end of the packet
|
/// Tell if the reading position has reached the end of the packet
|
||||||
///
|
///
|
||||||
/// \return True if all data have been read into the packet
|
/// \return True if all data have been read into the packet
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool EndOfPacket() const;
|
bool EndOfPacket() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return the validity of packet
|
/// Return the validity of packet
|
||||||
///
|
///
|
||||||
/// \return True if last data extraction from packet was successful
|
/// \return True if last data extraction from packet was successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator >> overloads to extract data from the packet
|
/// Operator >> overloads to extract data from the packet
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Packet& operator >>(bool& Data);
|
Packet& operator >>(bool& Data);
|
||||||
Packet& operator >>(Int8& Data);
|
Packet& operator >>(Int8& Data);
|
||||||
Packet& operator >>(Uint8& Data);
|
Packet& operator >>(Uint8& Data);
|
||||||
Packet& operator >>(Int16& Data);
|
Packet& operator >>(Int16& Data);
|
||||||
Packet& operator >>(Uint16& Data);
|
Packet& operator >>(Uint16& Data);
|
||||||
Packet& operator >>(Int32& Data);
|
Packet& operator >>(Int32& Data);
|
||||||
Packet& operator >>(Uint32& Data);
|
Packet& operator >>(Uint32& Data);
|
||||||
Packet& operator >>(float& Data);
|
Packet& operator >>(float& Data);
|
||||||
Packet& operator >>(double& Data);
|
Packet& operator >>(double& Data);
|
||||||
Packet& operator >>(char* Data);
|
Packet& operator >>(char* Data);
|
||||||
Packet& operator >>(std::string& Data);
|
Packet& operator >>(std::string& Data);
|
||||||
Packet& operator >>(wchar_t* Data);
|
Packet& operator >>(wchar_t* Data);
|
||||||
Packet& operator >>(std::wstring& Data);
|
Packet& operator >>(std::wstring& Data);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Operator << overloads to put data into the packet
|
/// Operator << overloads to put data into the packet
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Packet& operator <<(bool Data);
|
Packet& operator <<(bool Data);
|
||||||
Packet& operator <<(Int8 Data);
|
Packet& operator <<(Int8 Data);
|
||||||
Packet& operator <<(Uint8 Data);
|
Packet& operator <<(Uint8 Data);
|
||||||
Packet& operator <<(Int16 Data);
|
Packet& operator <<(Int16 Data);
|
||||||
Packet& operator <<(Uint16 Data);
|
Packet& operator <<(Uint16 Data);
|
||||||
Packet& operator <<(Int32 Data);
|
Packet& operator <<(Int32 Data);
|
||||||
Packet& operator <<(Uint32 Data);
|
Packet& operator <<(Uint32 Data);
|
||||||
Packet& operator <<(float Data);
|
Packet& operator <<(float Data);
|
||||||
Packet& operator <<(double Data);
|
Packet& operator <<(double Data);
|
||||||
Packet& operator <<(const char* Data);
|
Packet& operator <<(const char* Data);
|
||||||
Packet& operator <<(const std::string& Data);
|
Packet& operator <<(const std::string& Data);
|
||||||
Packet& operator <<(const wchar_t* Data);
|
Packet& operator <<(const wchar_t* Data);
|
||||||
Packet& operator <<(const std::wstring& Data);
|
Packet& operator <<(const std::wstring& Data);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
friend class SocketTCP;
|
friend class SocketTCP;
|
||||||
friend class SocketUDP;
|
friend class SocketUDP;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if the packet can extract a given size of bytes
|
/// Check if the packet can extract a given size of bytes
|
||||||
///
|
///
|
||||||
/// \param Size : Size to check
|
/// \param Size : Size to check
|
||||||
///
|
///
|
||||||
/// \return True if Size bytes can be read from the packet's data
|
/// \return True if Size bytes can be read from the packet's data
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CheckSize(std::size_t Size);
|
bool CheckSize(std::size_t Size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Called before the packet is sent to the network
|
/// Called before the packet is sent to the network
|
||||||
///
|
///
|
||||||
/// \param DataSize : Variable to fill with the size of data to send
|
/// \param DataSize : Variable to fill with the size of data to send
|
||||||
///
|
///
|
||||||
/// \return Pointer to the array of bytes to send
|
/// \return Pointer to the array of bytes to send
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual const char* OnSend(std::size_t& DataSize);
|
virtual const char* OnSend(std::size_t& DataSize);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Called after the packet has been received from the network
|
/// Called after the packet has been received from the network
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to the array of received bytes
|
/// \param Data : Pointer to the array of received bytes
|
||||||
/// \param DataSize : Size of the array of bytes
|
/// \param DataSize : Size of the array of bytes
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void OnReceive(const char* Data, std::size_t DataSize);
|
virtual void OnReceive(const char* Data, std::size_t DataSize);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::vector<char> myData; ///< Data stored in the packet
|
std::vector<char> myData; ///< Data stored in the packet
|
||||||
std::size_t myReadPos; ///< Current reading position in the packet
|
std::size_t myReadPos; ///< Current reading position in the packet
|
||||||
bool myIsValid; ///< Reading state of the packet
|
bool myIsValid; ///< Reading state of the packet
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_PACKET_HPP
|
#endif // SFML_PACKET_HPP
|
||||||
|
|
|
@ -1,116 +1,116 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SELECTOR_HPP
|
#ifndef SFML_SELECTOR_HPP
|
||||||
#define SFML_SELECTOR_HPP
|
#define SFML_SELECTOR_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Network/SocketUDP.hpp>
|
#include <SFML/Network/SocketUDP.hpp>
|
||||||
#include <SFML/Network/SocketTCP.hpp>
|
#include <SFML/Network/SocketTCP.hpp>
|
||||||
#include <SFML/Network/SelectorBase.hpp>
|
#include <SFML/Network/SelectorBase.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Selector allow reading from multiple sockets
|
/// Selector allow reading from multiple sockets
|
||||||
/// without blocking. It's a kind of multiplexer
|
/// without blocking. It's a kind of multiplexer
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
class Selector : private SelectorBase
|
class Selector : private SelectorBase
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Add a socket to watch
|
/// Add a socket to watch
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to add
|
/// \param Socket : Socket to add
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Add(Type Socket);
|
void Add(Type Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove a socket
|
/// Remove a socket
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to remove
|
/// \param Socket : Socket to remove
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Remove(Type Socket);
|
void Remove(Type Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove all sockets
|
/// Remove all sockets
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Wait and collect sockets which are ready for reading.
|
/// Wait and collect sockets which are ready for reading.
|
||||||
/// This functions will return either when at least one socket
|
/// This functions will return either when at least one socket
|
||||||
/// is ready, or when the given time is out
|
/// is ready, or when the given time is out
|
||||||
///
|
///
|
||||||
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
||||||
///
|
///
|
||||||
/// \return Number of sockets ready to be read
|
/// \return Number of sockets ready to be read
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Wait(float Timeout = 0.f);
|
unsigned int Wait(float Timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// After a call to Wait(), get the Index-th socket which is
|
/// After a call to Wait(), get the Index-th socket which is
|
||||||
/// ready for reading. The total number of sockets ready
|
/// ready for reading. The total number of sockets ready
|
||||||
/// is the integer returned by the previous call to Wait()
|
/// is the integer returned by the previous call to Wait()
|
||||||
///
|
///
|
||||||
/// \param Index : Index of the socket to get
|
/// \param Index : Index of the socket to get
|
||||||
///
|
///
|
||||||
/// \return The Index-th socket
|
/// \return The Index-th socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Type GetSocketReady(unsigned int Index);
|
Type GetSocketReady(unsigned int Index);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Types
|
// Types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef std::map<SocketHelper::SocketType, Type> SocketTable;
|
typedef std::map<SocketHelper::SocketType, Type> SocketTable;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketTable mySockets; ///< Table matching the SFML socket instances with their low-level handles
|
SocketTable mySockets; ///< Table matching the SFML socket instances with their low-level handles
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <SFML/Network/Selector.inl>
|
#include <SFML/Network/Selector.inl>
|
||||||
|
|
||||||
// Let's define the two only valid types of Selector
|
// Let's define the two only valid types of Selector
|
||||||
typedef Selector<SocketUDP> SelectorUDP;
|
typedef Selector<SocketUDP> SelectorUDP;
|
||||||
typedef Selector<SocketTCP> SelectorTCP;
|
typedef Selector<SocketTCP> SelectorTCP;
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SELECTOR_HPP
|
#endif // SFML_SELECTOR_HPP
|
||||||
|
|
|
@ -1,97 +1,97 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Add a socket to watch
|
/// Add a socket to watch
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
void Selector<Type>::Add(Type Socket)
|
void Selector<Type>::Add(Type Socket)
|
||||||
{
|
{
|
||||||
if (Socket.IsValid())
|
if (Socket.IsValid())
|
||||||
{
|
{
|
||||||
SelectorBase::Add(Socket.mySocket);
|
SelectorBase::Add(Socket.mySocket);
|
||||||
mySockets[Socket.mySocket] = Socket;
|
mySockets[Socket.mySocket] = Socket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove a socket
|
/// Remove a socket
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
void Selector<Type>::Remove(Type Socket)
|
void Selector<Type>::Remove(Type Socket)
|
||||||
{
|
{
|
||||||
typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
|
typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
|
||||||
if (It != mySockets.end())
|
if (It != mySockets.end())
|
||||||
{
|
{
|
||||||
SelectorBase::Remove(Socket.mySocket);
|
SelectorBase::Remove(Socket.mySocket);
|
||||||
mySockets.erase(It);
|
mySockets.erase(It);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove all sockets
|
/// Remove all sockets
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
void Selector<Type>::Clear()
|
void Selector<Type>::Clear()
|
||||||
{
|
{
|
||||||
SelectorBase::Clear();
|
SelectorBase::Clear();
|
||||||
mySockets.clear();
|
mySockets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Wait and collect sockets which are ready for reading.
|
/// Wait and collect sockets which are ready for reading.
|
||||||
/// This functions will return either when at least one socket
|
/// This functions will return either when at least one socket
|
||||||
/// is ready, or when the given time is out
|
/// is ready, or when the given time is out
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
unsigned int Selector<Type>::Wait(float Timeout)
|
unsigned int Selector<Type>::Wait(float Timeout)
|
||||||
{
|
{
|
||||||
// No socket in the selector : return 0
|
// No socket in the selector : return 0
|
||||||
if (mySockets.empty())
|
if (mySockets.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return SelectorBase::Wait(Timeout);
|
return SelectorBase::Wait(Timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// After a call to Wait(), get the Index-th socket which is
|
/// After a call to Wait(), get the Index-th socket which is
|
||||||
/// ready for reading. The total number of sockets ready
|
/// ready for reading. The total number of sockets ready
|
||||||
/// is the integer returned by the previous call to Wait()
|
/// is the integer returned by the previous call to Wait()
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
Type Selector<Type>::GetSocketReady(unsigned int Index)
|
Type Selector<Type>::GetSocketReady(unsigned int Index)
|
||||||
{
|
{
|
||||||
SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
|
SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
|
||||||
|
|
||||||
typename SocketTable::const_iterator It = mySockets.find(Socket);
|
typename SocketTable::const_iterator It = mySockets.find(Socket);
|
||||||
if (It != mySockets.end())
|
if (It != mySockets.end())
|
||||||
return It->second;
|
return It->second;
|
||||||
else
|
else
|
||||||
return Type(Socket);
|
return Type(Socket);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SELECTORBASE_HPP
|
#ifndef SFML_SELECTORBASE_HPP
|
||||||
#define SFML_SELECTORBASE_HPP
|
#define SFML_SELECTORBASE_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
#include <SFML/Network/SocketHelper.hpp>
|
#include <SFML/Network/SocketHelper.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Private base class for selectors.
|
/// Private base class for selectors.
|
||||||
/// As Selector is a template class, this base is needed so that
|
/// As Selector is a template class, this base is needed so that
|
||||||
/// every system call get compiled in SFML (not inlined)
|
/// every system call get compiled in SFML (not inlined)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API SelectorBase
|
class SFML_API SelectorBase
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SelectorBase();
|
SelectorBase();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Add a socket to watch
|
/// Add a socket to watch
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to add
|
/// \param Socket : Socket to add
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Add(SocketHelper::SocketType Socket);
|
void Add(SocketHelper::SocketType Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove a socket
|
/// Remove a socket
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to remove
|
/// \param Socket : Socket to remove
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Remove(SocketHelper::SocketType Socket);
|
void Remove(SocketHelper::SocketType Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove all sockets
|
/// Remove all sockets
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Wait and collect sockets which are ready for reading.
|
/// Wait and collect sockets which are ready for reading.
|
||||||
/// This functions will return either when at least one socket
|
/// This functions will return either when at least one socket
|
||||||
/// is ready, or when the given time is out
|
/// is ready, or when the given time is out
|
||||||
///
|
///
|
||||||
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
||||||
///
|
///
|
||||||
/// \return Number of sockets ready to be read
|
/// \return Number of sockets ready to be read
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Wait(float Timeout = 0.f);
|
unsigned int Wait(float Timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// After a call to Wait(), get the Index-th socket which is
|
/// After a call to Wait(), get the Index-th socket which is
|
||||||
/// ready for reading. The total number of sockets ready
|
/// ready for reading. The total number of sockets ready
|
||||||
/// is the integer returned by the previous call to Wait()
|
/// is the integer returned by the previous call to Wait()
|
||||||
///
|
///
|
||||||
/// \param Index : Index of the socket to get
|
/// \param Index : Index of the socket to get
|
||||||
///
|
///
|
||||||
/// \return The Index-th socket
|
/// \return The Index-th socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketHelper::SocketType GetSocketReady(unsigned int Index);
|
SocketHelper::SocketType GetSocketReady(unsigned int Index);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
fd_set mySet; ///< Set of socket to watch
|
fd_set mySet; ///< Set of socket to watch
|
||||||
fd_set mySetReady; ///< Set of socket which are ready for reading
|
fd_set mySetReady; ///< Set of socket which are ready for reading
|
||||||
int myMaxSocket; ///< Maximum socket index
|
int myMaxSocket; ///< Maximum socket index
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SELECTORBASE_HPP
|
#endif // SFML_SELECTORBASE_HPP
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETHELPER_HPP
|
#ifndef SFML_SOCKETHELPER_HPP
|
||||||
#define SFML_SOCKETHELPER_HPP
|
#define SFML_SOCKETHELPER_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
namespace Socket
|
namespace Socket
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumeration of status returned by socket functions
|
/// Enumeration of status returned by socket functions
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
Done, ///< The socket has sent / received the data
|
Done, ///< The socket has sent / received the data
|
||||||
NotReady, ///< The socket is not ready to send / receive data yet
|
NotReady, ///< The socket is not ready to send / receive data yet
|
||||||
Disconnected, ///< The TCP socket has been disconnected
|
Disconnected, ///< The TCP socket has been disconnected
|
||||||
Error ///< An unexpected error happened
|
Error ///< An unexpected error happened
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#ifdef SFML_SYSTEM_WINDOWS
|
#ifdef SFML_SYSTEM_WINDOWS
|
||||||
|
|
||||||
#include <SFML/Network/Win32/SocketHelper.hpp>
|
#include <SFML/Network/Win32/SocketHelper.hpp>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <SFML/Network/Unix/SocketHelper.hpp>
|
#include <SFML/Network/Unix/SocketHelper.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETHELPER_HPP
|
#endif // SFML_SOCKETHELPER_HPP
|
||||||
|
|
|
@ -1,227 +1,227 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETTCP_HPP
|
#ifndef SFML_SOCKETTCP_HPP
|
||||||
#define SFML_SOCKETTCP_HPP
|
#define SFML_SOCKETTCP_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Network/SocketHelper.hpp>
|
#include <SFML/Network/SocketHelper.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
class Packet;
|
class Packet;
|
||||||
class IPAddress;
|
class IPAddress;
|
||||||
template <typename> class Selector;
|
template <typename> class Selector;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// SocketTCP wraps a socket using TCP protocol to
|
/// SocketTCP wraps a socket using TCP protocol to
|
||||||
/// send data safely (but a bit slower)
|
/// send data safely (but a bit slower)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API SocketTCP
|
class SFML_API SocketTCP
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketTCP();
|
SocketTCP();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the blocking state of the socket.
|
/// Change the blocking state of the socket.
|
||||||
/// The default behaviour of a socket is blocking
|
/// The default behaviour of a socket is blocking
|
||||||
///
|
///
|
||||||
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetBlocking(bool Blocking);
|
void SetBlocking(bool Blocking);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Connect to another computer on a specified port
|
/// Connect to another computer on a specified port
|
||||||
///
|
///
|
||||||
/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved)
|
/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved)
|
||||||
/// \param HostAddress : IP Address of the host to connect to
|
/// \param HostAddress : IP Address of the host to connect to
|
||||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
|
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f);
|
Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Listen to a specified port for incoming data or connections
|
/// Listen to a specified port for incoming data or connections
|
||||||
///
|
///
|
||||||
/// \param Port : Port to listen to
|
/// \param Port : Port to listen to
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Listen(unsigned short Port);
|
bool Listen(unsigned short Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Wait for a connection (must be listening to a port).
|
/// Wait for a connection (must be listening to a port).
|
||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param Connected : Socket containing the connection with the connected client
|
/// \param Connected : Socket containing the connection with the connected client
|
||||||
/// \param Address : Pointer to an address to fill with client infos (NULL by default)
|
/// \param Address : Pointer to an address to fill with client infos (NULL by default)
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL);
|
Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send an array of bytes to the host (must be connected first)
|
/// Send an array of bytes to the host (must be connected first)
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to the bytes to send
|
/// \param Data : Pointer to the bytes to send
|
||||||
/// \param Size : Number of bytes to send
|
/// \param Size : Number of bytes to send
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Send(const char* Data, std::size_t Size);
|
Socket::Status Send(const char* Data, std::size_t Size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Receive an array of bytes from the host (must be connected first).
|
/// Receive an array of bytes from the host (must be connected first).
|
||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
||||||
/// \param MaxSize : Maximum number of bytes to read
|
/// \param MaxSize : Maximum number of bytes to read
|
||||||
/// \param SizeReceived : Number of bytes received
|
/// \param SizeReceived : Number of bytes received
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived);
|
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send a packet of data to the host (must be connected first)
|
/// Send a packet of data to the host (must be connected first)
|
||||||
///
|
///
|
||||||
/// \param PacketToSend : Packet to send
|
/// \param PacketToSend : Packet to send
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Send(Packet& PacketToSend);
|
Socket::Status Send(Packet& PacketToSend);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Receive a packet from the host (must be connected first).
|
/// Receive a packet from the host (must be connected first).
|
||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param PacketToReceive : Packet to fill with received data
|
/// \param PacketToReceive : Packet to fill with received data
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Receive(Packet& PacketToReceive);
|
Socket::Status Receive(Packet& PacketToReceive);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Close the socket
|
/// Close the socket
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Close();
|
bool Close();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if the socket is in a valid state ; this function
|
/// Check if the socket is in a valid state ; this function
|
||||||
/// can be called any time to check if the socket is OK
|
/// can be called any time to check if the socket is OK
|
||||||
///
|
///
|
||||||
/// \return True if the socket is valid
|
/// \return True if the socket is valid
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator ==
|
/// Comparison operator ==
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this == Other
|
/// \return True if *this == Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator ==(const SocketTCP& Other) const;
|
bool operator ==(const SocketTCP& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator !=
|
/// Comparison operator !=
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this != Other
|
/// \return True if *this != Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator !=(const SocketTCP& Other) const;
|
bool operator !=(const SocketTCP& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <.
|
/// Comparison operator <.
|
||||||
/// Provided for compatibility with standard containers, as
|
/// Provided for compatibility with standard containers, as
|
||||||
/// comparing two sockets doesn't make much sense...
|
/// comparing two sockets doesn't make much sense...
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this < Other
|
/// \return True if *this < Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator <(const SocketTCP& Other) const;
|
bool operator <(const SocketTCP& Other) const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
friend class Selector<SocketTCP>;
|
friend class Selector<SocketTCP>;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the socket from a socket descriptor
|
/// Construct the socket from a socket descriptor
|
||||||
/// (for internal use only)
|
/// (for internal use only)
|
||||||
///
|
///
|
||||||
/// \param Descriptor : Socket descriptor
|
/// \param Descriptor : Socket descriptor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketTCP(SocketHelper::SocketType Descriptor);
|
SocketTCP(SocketHelper::SocketType Descriptor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the socket
|
/// Create the socket
|
||||||
///
|
///
|
||||||
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Create(SocketHelper::SocketType Descriptor = 0);
|
void Create(SocketHelper::SocketType Descriptor = 0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketHelper::SocketType mySocket; ///< Socket descriptor
|
SocketHelper::SocketType mySocket; ///< Socket descriptor
|
||||||
Uint32 myPendingHeader; ///< Data of the current pending packet header, if any
|
Uint32 myPendingHeader; ///< Data of the current pending packet header, if any
|
||||||
Uint32 myPendingHeaderSize; ///< Size of the current pending packet header, if any
|
Uint32 myPendingHeaderSize; ///< Size of the current pending packet header, if any
|
||||||
std::vector<char> myPendingPacket; ///< Data of the current pending packet, if any
|
std::vector<char> myPendingPacket; ///< Data of the current pending packet, if any
|
||||||
Int32 myPendingPacketSize; ///< Size of the current pending packet, if any
|
Int32 myPendingPacketSize; ///< Size of the current pending packet, if any
|
||||||
bool myIsBlocking; ///< Is the socket blocking or non-blocking ?
|
bool myIsBlocking; ///< Is the socket blocking or non-blocking ?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETTCP_HPP
|
#endif // SFML_SOCKETTCP_HPP
|
||||||
|
|
|
@ -1,228 +1,228 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETUDP_HPP
|
#ifndef SFML_SOCKETUDP_HPP
|
||||||
#define SFML_SOCKETUDP_HPP
|
#define SFML_SOCKETUDP_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Network/SocketHelper.hpp>
|
#include <SFML/Network/SocketHelper.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
class Packet;
|
class Packet;
|
||||||
class IPAddress;
|
class IPAddress;
|
||||||
template <typename> class Selector;
|
template <typename> class Selector;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// SocketUDP wraps a socket using UDP protocol to
|
/// SocketUDP wraps a socket using UDP protocol to
|
||||||
/// send data fastly (but with less safety)
|
/// send data fastly (but with less safety)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API SocketUDP
|
class SFML_API SocketUDP
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketUDP();
|
SocketUDP();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the blocking state of the socket.
|
/// Change the blocking state of the socket.
|
||||||
/// The default behaviour of a socket is blocking
|
/// The default behaviour of a socket is blocking
|
||||||
///
|
///
|
||||||
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetBlocking(bool Blocking);
|
void SetBlocking(bool Blocking);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Bind the socket to a specific port
|
/// Bind the socket to a specific port
|
||||||
///
|
///
|
||||||
/// \param Port : Port to bind the socket to
|
/// \param Port : Port to bind the socket to
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Bind(unsigned short Port);
|
bool Bind(unsigned short Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Unbind the socket from its previous port, if any
|
/// Unbind the socket from its previous port, if any
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Unbind();
|
bool Unbind();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send an array of bytes
|
/// Send an array of bytes
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to the bytes to send
|
/// \param Data : Pointer to the bytes to send
|
||||||
/// \param Size : Number of bytes to send
|
/// \param Size : Number of bytes to send
|
||||||
/// \param Address : Address of the computer to send the packet to
|
/// \param Address : Address of the computer to send the packet to
|
||||||
/// \param Port : Port to send the data to
|
/// \param Port : Port to send the data to
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port);
|
Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Receive an array of bytes.
|
/// Receive an array of bytes.
|
||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
||||||
/// \param MaxSize : Maximum number of bytes to read
|
/// \param MaxSize : Maximum number of bytes to read
|
||||||
/// \param SizeReceived : Number of bytes received
|
/// \param SizeReceived : Number of bytes received
|
||||||
/// \param Address : Address of the computer which sent the data
|
/// \param Address : Address of the computer which sent the data
|
||||||
/// \param Port : Port on which the remote computer sent the data
|
/// \param Port : Port on which the remote computer sent the data
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port);
|
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send a packet of data
|
/// Send a packet of data
|
||||||
///
|
///
|
||||||
/// \param PacketToSend : Packet to send
|
/// \param PacketToSend : Packet to send
|
||||||
/// \param Address : Address of the computer to send the packet to
|
/// \param Address : Address of the computer to send the packet to
|
||||||
/// \param Port : Port to send the data to
|
/// \param Port : Port to send the data to
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port);
|
Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Receive a packet.
|
/// Receive a packet.
|
||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param PacketToReceive : Packet to fill with received data
|
/// \param PacketToReceive : Packet to fill with received data
|
||||||
/// \param Address : Address of the computer which sent the packet
|
/// \param Address : Address of the computer which sent the packet
|
||||||
/// \param Port : Port on which the remote computer sent the data
|
/// \param Port : Port on which the remote computer sent the data
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port);
|
Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Close the socket
|
/// Close the socket
|
||||||
///
|
///
|
||||||
/// \return True if operation has been successful
|
/// \return True if operation has been successful
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Close();
|
bool Close();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if the socket is in a valid state ; this function
|
/// Check if the socket is in a valid state ; this function
|
||||||
/// can be called any time to check if the socket is OK
|
/// can be called any time to check if the socket is OK
|
||||||
///
|
///
|
||||||
/// \return True if the socket is valid
|
/// \return True if the socket is valid
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the port the socket is currently bound to
|
/// Get the port the socket is currently bound to
|
||||||
///
|
///
|
||||||
/// \return Current port (0 means the socket is not bound)
|
/// \return Current port (0 means the socket is not bound)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned short GetPort() const;
|
unsigned short GetPort() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator ==
|
/// Comparison operator ==
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this == Other
|
/// \return True if *this == Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator ==(const SocketUDP& Other) const;
|
bool operator ==(const SocketUDP& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator !=
|
/// Comparison operator !=
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this != Other
|
/// \return True if *this != Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator !=(const SocketUDP& Other) const;
|
bool operator !=(const SocketUDP& Other) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator <.
|
/// Comparison operator <.
|
||||||
/// Provided for compatibility with standard containers, as
|
/// Provided for compatibility with standard containers, as
|
||||||
/// comparing two sockets doesn't make much sense...
|
/// comparing two sockets doesn't make much sense...
|
||||||
///
|
///
|
||||||
/// \param Other : Socket to compare
|
/// \param Other : Socket to compare
|
||||||
///
|
///
|
||||||
/// \return True if *this < Other
|
/// \return True if *this < Other
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool operator <(const SocketUDP& Other) const;
|
bool operator <(const SocketUDP& Other) const;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
friend class Selector<SocketUDP>;
|
friend class Selector<SocketUDP>;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the socket from a socket descriptor
|
/// Construct the socket from a socket descriptor
|
||||||
/// (for internal use only)
|
/// (for internal use only)
|
||||||
///
|
///
|
||||||
/// \param Descriptor : Socket descriptor
|
/// \param Descriptor : Socket descriptor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketUDP(SocketHelper::SocketType Descriptor);
|
SocketUDP(SocketHelper::SocketType Descriptor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the socket
|
/// Create the socket
|
||||||
///
|
///
|
||||||
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Create(SocketHelper::SocketType Descriptor = 0);
|
void Create(SocketHelper::SocketType Descriptor = 0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SocketHelper::SocketType mySocket; ///< Socket identifier
|
SocketHelper::SocketType mySocket; ///< Socket identifier
|
||||||
unsigned short myPort; ///< Port to which the socket is bound
|
unsigned short myPort; ///< Port to which the socket is bound
|
||||||
Uint32 myPendingHeader; ///< Data of the current pending packet header, if any
|
Uint32 myPendingHeader; ///< Data of the current pending packet header, if any
|
||||||
Uint32 myPendingHeaderSize; ///< Size of the current pending packet header, if any
|
Uint32 myPendingHeaderSize; ///< Size of the current pending packet header, if any
|
||||||
std::vector<char> myPendingPacket; ///< Data of the current pending packet, if any
|
std::vector<char> myPendingPacket; ///< Data of the current pending packet, if any
|
||||||
Int32 myPendingPacketSize; ///< Size of the current pending packet, if any
|
Int32 myPendingPacketSize; ///< Size of the current pending packet, if any
|
||||||
bool myIsBlocking; ///< Is the socket blocking or non-blocking ?
|
bool myIsBlocking; ///< Is the socket blocking or non-blocking ?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETUDP_HPP
|
#endif // SFML_SOCKETUDP_HPP
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETS_HPP
|
#ifndef SFML_SOCKETS_HPP
|
||||||
#define SFML_SOCKETS_HPP
|
#define SFML_SOCKETS_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
|
|
||||||
#ifdef SFML_SYSTEM_WINDOWS
|
#ifdef SFML_SYSTEM_WINDOWS
|
||||||
|
|
||||||
#include <SFML/Network/Win32/Sockets.hpp>
|
#include <SFML/Network/Win32/Sockets.hpp>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <SFML/Network/Unix/Sockets.hpp>
|
#include <SFML/Network/Unix/Sockets.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETS_HPP
|
#endif // SFML_SOCKETS_HPP
|
||||||
|
|
|
@ -1,96 +1,96 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETHELPERUNIX_HPP
|
#ifndef SFML_SOCKETHELPERUNIX_HPP
|
||||||
#define SFML_SOCKETHELPERUNIX_HPP
|
#define SFML_SOCKETHELPERUNIX_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class defines helper functions to do all the
|
/// This class defines helper functions to do all the
|
||||||
/// non-portable socket stuff. This class is meant for internal
|
/// non-portable socket stuff. This class is meant for internal
|
||||||
/// use only
|
/// use only
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API SocketHelper
|
class SFML_API SocketHelper
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define some socket types
|
// Define some socket types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef int SocketType;
|
typedef int SocketType;
|
||||||
typedef socklen_t LengthType;
|
typedef socklen_t LengthType;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return the value of the invalid socket
|
/// Return the value of the invalid socket
|
||||||
///
|
///
|
||||||
/// \return Unique value of the invalid socket
|
/// \return Unique value of the invalid socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static SocketType InvalidSocket();
|
static SocketType InvalidSocket();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Close / destroy a socket
|
/// Close / destroy a socket
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to close
|
/// \param Socket : Socket to close
|
||||||
///
|
///
|
||||||
/// \return True on success
|
/// \return True on success
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static bool Close(SocketType Socket);
|
static bool Close(SocketType Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set a socket as blocking or non-blocking
|
/// Set a socket as blocking or non-blocking
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to modify
|
/// \param Socket : Socket to modify
|
||||||
/// \param Block : New blocking state of the socket
|
/// \param Block : New blocking state of the socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static void SetBlocking(SocketType Socket, bool Block);
|
static void SetBlocking(SocketType Socket, bool Block);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the last socket error status
|
/// Get the last socket error status
|
||||||
///
|
///
|
||||||
/// \return Status corresponding to the last socket error
|
/// \return Status corresponding to the last socket error
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Socket::Status GetErrorStatus();
|
static Socket::Status GetErrorStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETHELPERUNIX_HPP
|
#endif // SFML_SOCKETHELPERUNIX_HPP
|
||||||
|
|
|
@ -1,90 +1,90 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SOCKETHELPERWIN32_HPP
|
#ifndef SFML_SOCKETHELPERWIN32_HPP
|
||||||
#define SFML_SOCKETHELPERWIN32_HPP
|
#define SFML_SOCKETHELPERWIN32_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This class defines helper functions to do all the
|
/// This class defines helper functions to do all the
|
||||||
/// non-portable socket stuff. This class is meant for internal
|
/// non-portable socket stuff. This class is meant for internal
|
||||||
/// use only
|
/// use only
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API SocketHelper
|
class SFML_API SocketHelper
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define some socket types
|
// Define some socket types
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef SOCKET SocketType;
|
typedef SOCKET SocketType;
|
||||||
typedef int LengthType;
|
typedef int LengthType;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return the value of the invalid socket
|
/// Return the value of the invalid socket
|
||||||
///
|
///
|
||||||
/// \return Unique value of the invalid socket
|
/// \return Unique value of the invalid socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static SocketType InvalidSocket();
|
static SocketType InvalidSocket();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Close / destroy a socket
|
/// Close / destroy a socket
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to close
|
/// \param Socket : Socket to close
|
||||||
///
|
///
|
||||||
/// \return True on success
|
/// \return True on success
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static bool Close(SocketType Socket);
|
static bool Close(SocketType Socket);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Set a socket as blocking or non-blocking
|
/// Set a socket as blocking or non-blocking
|
||||||
///
|
///
|
||||||
/// \param Socket : Socket to modify
|
/// \param Socket : Socket to modify
|
||||||
/// \param Block : New blocking state of the socket
|
/// \param Block : New blocking state of the socket
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static void SetBlocking(SocketType Socket, bool Block);
|
static void SetBlocking(SocketType Socket, bool Block);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the last socket error status
|
/// Get the last socket error status
|
||||||
///
|
///
|
||||||
/// \return Status corresponding to the last socket error
|
/// \return Status corresponding to the last socket error
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Socket::Status GetErrorStatus();
|
static Socket::Status GetErrorStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOCKETHELPERWIN32_HPP
|
#endif // SFML_SOCKETHELPERWIN32_HPP
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_SYSTEM_HPP
|
#ifndef SFML_SYSTEM_HPP
|
||||||
#define SFML_SYSTEM_HPP
|
#define SFML_SYSTEM_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
// #include <SFML/System/Clock.hpp>
|
// #include <SFML/System/Clock.hpp>
|
||||||
// #include <SFML/System/Lock.hpp>
|
// #include <SFML/System/Lock.hpp>
|
||||||
// #include <SFML/System/Mutex.hpp>
|
// #include <SFML/System/Mutex.hpp>
|
||||||
// #include <SFML/System/Randomizer.hpp>
|
// #include <SFML/System/Randomizer.hpp>
|
||||||
// #include <SFML/System/Sleep.hpp>
|
// #include <SFML/System/Sleep.hpp>
|
||||||
// #include <SFML/System/Thread.hpp>
|
// #include <SFML/System/Thread.hpp>
|
||||||
// #include <SFML/System/Unicode.hpp>
|
// #include <SFML/System/Unicode.hpp>
|
||||||
// #include <SFML/System/Vector2.hpp>
|
// #include <SFML/System/Vector2.hpp>
|
||||||
// #include <SFML/System/Vector3.hpp>
|
// #include <SFML/System/Vector3.hpp>
|
||||||
|
|
||||||
#endif // SFML_SYSTEM_HPP
|
#endif // SFML_SYSTEM_HPP
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
// subject to the following restrictions:
|
// subject to the following restrictions:
|
||||||
//
|
//
|
||||||
// 1. The origin of this software must not be misrepresented;
|
// 1. The origin of this software must not be misrepresented;
|
||||||
// you must not claim that you wrote the original software.
|
// you must not claim that you wrote the original software.
|
||||||
// If you use this software in a product, an acknowledgment
|
// If you use this software in a product, an acknowledgment
|
||||||
// in the product documentation would be appreciated but is not required.
|
// in the product documentation would be appreciated but is not required.
|
||||||
//
|
//
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
// and must not be misrepresented as being the original software.
|
// and must not be misrepresented as being the original software.
|
||||||
//
|
//
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SFML_NONCOPYABLE_HPP
|
#ifndef SFML_NONCOPYABLE_HPP
|
||||||
#define SFML_NONCOPYABLE_HPP
|
#define SFML_NONCOPYABLE_HPP
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Utility base class to easily declare non-copyable classes.
|
/// Utility base class to easily declare non-copyable classes.
|
||||||
/// Just inherit from NonCopyable to get a non-copyable class
|
/// Just inherit from NonCopyable to get a non-copyable class
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct SFML_API NonCopyable
|
struct SFML_API NonCopyable
|
||||||
{
|
{
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// The default constructor won't be generated, so provide it
|
/// The default constructor won't be generated, so provide it
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NonCopyable() {}
|
NonCopyable() {}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Copy constructor : declare it private and don't implement
|
/// Copy constructor : declare it private and don't implement
|
||||||
/// it to prevent from calling it
|
/// it to prevent from calling it
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NonCopyable(const NonCopyable&);
|
NonCopyable(const NonCopyable&);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Assignment operator : declare it private and don't implement
|
/// Assignment operator : declare it private and don't implement
|
||||||
/// it to prevent from calling it
|
/// it to prevent from calling it
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NonCopyable& operator =(const NonCopyable&);
|
NonCopyable& operator =(const NonCopyable&);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_NONCOPYABLE_HPP
|
#endif // SFML_NONCOPYABLE_HPP
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,123 +1,123 @@
|
||||||
/*
|
/*
|
||||||
Jonathan Dummer
|
Jonathan Dummer
|
||||||
2007-07-31-10.32
|
2007-07-31-10.32
|
||||||
|
|
||||||
simple DXT compression / decompression code
|
simple DXT compression / decompression code
|
||||||
|
|
||||||
public domain
|
public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_IMAGE_DXT
|
#ifndef HEADER_IMAGE_DXT
|
||||||
#define HEADER_IMAGE_DXT
|
#define HEADER_IMAGE_DXT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts an image from an array of unsigned chars (RGB or RGBA) to
|
Converts an image from an array of unsigned chars (RGB or RGBA) to
|
||||||
DXT1 or DXT5, then saves the converted image to disk.
|
DXT1 or DXT5, then saves the converted image to disk.
|
||||||
\return 0 if failed, otherwise returns 1
|
\return 0 if failed, otherwise returns 1
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
save_image_as_DDS
|
save_image_as_DDS
|
||||||
(
|
(
|
||||||
const char *filename,
|
const char *filename,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
const unsigned char *const data
|
const unsigned char *const data
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
take an image and convert it to DXT1 (no alpha)
|
take an image and convert it to DXT1 (no alpha)
|
||||||
**/
|
**/
|
||||||
unsigned char*
|
unsigned char*
|
||||||
convert_image_to_DXT1
|
convert_image_to_DXT1
|
||||||
(
|
(
|
||||||
const unsigned char *const uncompressed,
|
const unsigned char *const uncompressed,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
int *out_size
|
int *out_size
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
take an image and convert it to DXT5 (with alpha)
|
take an image and convert it to DXT5 (with alpha)
|
||||||
**/
|
**/
|
||||||
unsigned char*
|
unsigned char*
|
||||||
convert_image_to_DXT5
|
convert_image_to_DXT5
|
||||||
(
|
(
|
||||||
const unsigned char *const uncompressed,
|
const unsigned char *const uncompressed,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
int *out_size
|
int *out_size
|
||||||
);
|
);
|
||||||
|
|
||||||
/** A bunch of DirectDraw Surface structures and flags **/
|
/** A bunch of DirectDraw Surface structures and flags **/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned int dwMagic;
|
unsigned int dwMagic;
|
||||||
unsigned int dwSize;
|
unsigned int dwSize;
|
||||||
unsigned int dwFlags;
|
unsigned int dwFlags;
|
||||||
unsigned int dwHeight;
|
unsigned int dwHeight;
|
||||||
unsigned int dwWidth;
|
unsigned int dwWidth;
|
||||||
unsigned int dwPitchOrLinearSize;
|
unsigned int dwPitchOrLinearSize;
|
||||||
unsigned int dwDepth;
|
unsigned int dwDepth;
|
||||||
unsigned int dwMipMapCount;
|
unsigned int dwMipMapCount;
|
||||||
unsigned int dwReserved1[ 11 ];
|
unsigned int dwReserved1[ 11 ];
|
||||||
|
|
||||||
/* DDPIXELFORMAT */
|
/* DDPIXELFORMAT */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int dwSize;
|
unsigned int dwSize;
|
||||||
unsigned int dwFlags;
|
unsigned int dwFlags;
|
||||||
unsigned int dwFourCC;
|
unsigned int dwFourCC;
|
||||||
unsigned int dwRGBBitCount;
|
unsigned int dwRGBBitCount;
|
||||||
unsigned int dwRBitMask;
|
unsigned int dwRBitMask;
|
||||||
unsigned int dwGBitMask;
|
unsigned int dwGBitMask;
|
||||||
unsigned int dwBBitMask;
|
unsigned int dwBBitMask;
|
||||||
unsigned int dwAlphaBitMask;
|
unsigned int dwAlphaBitMask;
|
||||||
}
|
}
|
||||||
sPixelFormat;
|
sPixelFormat;
|
||||||
|
|
||||||
/* DDCAPS2 */
|
/* DDCAPS2 */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int dwCaps1;
|
unsigned int dwCaps1;
|
||||||
unsigned int dwCaps2;
|
unsigned int dwCaps2;
|
||||||
unsigned int dwDDSX;
|
unsigned int dwDDSX;
|
||||||
unsigned int dwReserved;
|
unsigned int dwReserved;
|
||||||
}
|
}
|
||||||
sCaps;
|
sCaps;
|
||||||
unsigned int dwReserved2;
|
unsigned int dwReserved2;
|
||||||
}
|
}
|
||||||
DDS_header ;
|
DDS_header ;
|
||||||
|
|
||||||
/* the following constants were copied directly off the MSDN website */
|
/* the following constants were copied directly off the MSDN website */
|
||||||
|
|
||||||
/* The dwFlags member of the original DDSURFACEDESC2 structure
|
/* The dwFlags member of the original DDSURFACEDESC2 structure
|
||||||
can be set to one or more of the following values. */
|
can be set to one or more of the following values. */
|
||||||
#define DDSD_CAPS 0x00000001
|
#define DDSD_CAPS 0x00000001
|
||||||
#define DDSD_HEIGHT 0x00000002
|
#define DDSD_HEIGHT 0x00000002
|
||||||
#define DDSD_WIDTH 0x00000004
|
#define DDSD_WIDTH 0x00000004
|
||||||
#define DDSD_PITCH 0x00000008
|
#define DDSD_PITCH 0x00000008
|
||||||
#define DDSD_PIXELFORMAT 0x00001000
|
#define DDSD_PIXELFORMAT 0x00001000
|
||||||
#define DDSD_MIPMAPCOUNT 0x00020000
|
#define DDSD_MIPMAPCOUNT 0x00020000
|
||||||
#define DDSD_LINEARSIZE 0x00080000
|
#define DDSD_LINEARSIZE 0x00080000
|
||||||
#define DDSD_DEPTH 0x00800000
|
#define DDSD_DEPTH 0x00800000
|
||||||
|
|
||||||
/* DirectDraw Pixel Format */
|
/* DirectDraw Pixel Format */
|
||||||
#define DDPF_ALPHAPIXELS 0x00000001
|
#define DDPF_ALPHAPIXELS 0x00000001
|
||||||
#define DDPF_FOURCC 0x00000004
|
#define DDPF_FOURCC 0x00000004
|
||||||
#define DDPF_RGB 0x00000040
|
#define DDPF_RGB 0x00000040
|
||||||
|
|
||||||
/* The dwCaps1 member of the DDSCAPS2 structure can be
|
/* The dwCaps1 member of the DDSCAPS2 structure can be
|
||||||
set to one or more of the following values. */
|
set to one or more of the following values. */
|
||||||
#define DDSCAPS_COMPLEX 0x00000008
|
#define DDSCAPS_COMPLEX 0x00000008
|
||||||
#define DDSCAPS_TEXTURE 0x00001000
|
#define DDSCAPS_TEXTURE 0x00001000
|
||||||
#define DDSCAPS_MIPMAP 0x00400000
|
#define DDSCAPS_MIPMAP 0x00400000
|
||||||
|
|
||||||
/* The dwCaps2 member of the DDSCAPS2 structure can be
|
/* The dwCaps2 member of the DDSCAPS2 structure can be
|
||||||
set to one or more of the following values. */
|
set to one or more of the following values. */
|
||||||
#define DDSCAPS2_CUBEMAP 0x00000200
|
#define DDSCAPS2_CUBEMAP 0x00000200
|
||||||
#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
|
#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
|
||||||
#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
|
#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
|
||||||
#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
|
#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
|
||||||
#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
|
#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
|
||||||
#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
|
#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
|
||||||
#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
|
#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
|
||||||
#define DDSCAPS2_VOLUME 0x00200000
|
#define DDSCAPS2_VOLUME 0x00200000
|
||||||
|
|
||||||
#endif /* HEADER_IMAGE_DXT */
|
#endif /* HEADER_IMAGE_DXT */
|
||||||
|
|
|
@ -1,435 +1,435 @@
|
||||||
/*
|
/*
|
||||||
Jonathan Dummer
|
Jonathan Dummer
|
||||||
|
|
||||||
image helper functions
|
image helper functions
|
||||||
|
|
||||||
MIT license
|
MIT license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "image_helper.h"
|
#include "image_helper.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* Upscaling the image uses simple bilinear interpolation */
|
/* Upscaling the image uses simple bilinear interpolation */
|
||||||
int
|
int
|
||||||
up_scale_image
|
up_scale_image
|
||||||
(
|
(
|
||||||
const unsigned char* const orig,
|
const unsigned char* const orig,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
unsigned char* resampled,
|
unsigned char* resampled,
|
||||||
int resampled_width, int resampled_height
|
int resampled_width, int resampled_height
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
int x, y, c;
|
int x, y, c;
|
||||||
|
|
||||||
/* error(s) check */
|
/* error(s) check */
|
||||||
if ( (width < 1) || (height < 1) ||
|
if ( (width < 1) || (height < 1) ||
|
||||||
(resampled_width < 2) || (resampled_height < 2) ||
|
(resampled_width < 2) || (resampled_height < 2) ||
|
||||||
(channels < 1) ||
|
(channels < 1) ||
|
||||||
(NULL == orig) || (NULL == resampled) )
|
(NULL == orig) || (NULL == resampled) )
|
||||||
{
|
{
|
||||||
/* signify badness */
|
/* signify badness */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
for each given pixel in the new map, find the exact location
|
for each given pixel in the new map, find the exact location
|
||||||
from the original map which would contribute to this guy
|
from the original map which would contribute to this guy
|
||||||
*/
|
*/
|
||||||
dx = (width - 1.0f) / (resampled_width - 1.0f);
|
dx = (width - 1.0f) / (resampled_width - 1.0f);
|
||||||
dy = (height - 1.0f) / (resampled_height - 1.0f);
|
dy = (height - 1.0f) / (resampled_height - 1.0f);
|
||||||
for ( y = 0; y < resampled_height; ++y )
|
for ( y = 0; y < resampled_height; ++y )
|
||||||
{
|
{
|
||||||
/* find the base y index and fractional offset from that */
|
/* find the base y index and fractional offset from that */
|
||||||
float sampley = y * dy;
|
float sampley = y * dy;
|
||||||
int inty = (int)sampley;
|
int inty = (int)sampley;
|
||||||
/* if( inty < 0 ) { inty = 0; } else */
|
/* if( inty < 0 ) { inty = 0; } else */
|
||||||
if( inty > height - 2 ) { inty = height - 2; }
|
if( inty > height - 2 ) { inty = height - 2; }
|
||||||
sampley -= inty;
|
sampley -= inty;
|
||||||
for ( x = 0; x < resampled_width; ++x )
|
for ( x = 0; x < resampled_width; ++x )
|
||||||
{
|
{
|
||||||
float samplex = x * dx;
|
float samplex = x * dx;
|
||||||
int intx = (int)samplex;
|
int intx = (int)samplex;
|
||||||
int base_index;
|
int base_index;
|
||||||
/* find the base x index and fractional offset from that */
|
/* find the base x index and fractional offset from that */
|
||||||
/* if( intx < 0 ) { intx = 0; } else */
|
/* if( intx < 0 ) { intx = 0; } else */
|
||||||
if( intx > width - 2 ) { intx = width - 2; }
|
if( intx > width - 2 ) { intx = width - 2; }
|
||||||
samplex -= intx;
|
samplex -= intx;
|
||||||
/* base index into the original image */
|
/* base index into the original image */
|
||||||
base_index = (inty * width + intx) * channels;
|
base_index = (inty * width + intx) * channels;
|
||||||
for ( c = 0; c < channels; ++c )
|
for ( c = 0; c < channels; ++c )
|
||||||
{
|
{
|
||||||
/* do the sampling */
|
/* do the sampling */
|
||||||
float value = 0.5f;
|
float value = 0.5f;
|
||||||
value += orig[base_index]
|
value += orig[base_index]
|
||||||
*(1.0f-samplex)*(1.0f-sampley);
|
*(1.0f-samplex)*(1.0f-sampley);
|
||||||
value += orig[base_index+channels]
|
value += orig[base_index+channels]
|
||||||
*(samplex)*(1.0f-sampley);
|
*(samplex)*(1.0f-sampley);
|
||||||
value += orig[base_index+width*channels]
|
value += orig[base_index+width*channels]
|
||||||
*(1.0f-samplex)*(sampley);
|
*(1.0f-samplex)*(sampley);
|
||||||
value += orig[base_index+width*channels+channels]
|
value += orig[base_index+width*channels+channels]
|
||||||
*(samplex)*(sampley);
|
*(samplex)*(sampley);
|
||||||
/* move to the next channel */
|
/* move to the next channel */
|
||||||
++base_index;
|
++base_index;
|
||||||
/* save the new value */
|
/* save the new value */
|
||||||
resampled[y*resampled_width*channels+x*channels+c] =
|
resampled[y*resampled_width*channels+x*channels+c] =
|
||||||
(unsigned char)(value);
|
(unsigned char)(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* done */
|
/* done */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mipmap_image
|
mipmap_image
|
||||||
(
|
(
|
||||||
const unsigned char* const orig,
|
const unsigned char* const orig,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
unsigned char* resampled,
|
unsigned char* resampled,
|
||||||
int block_size_x, int block_size_y
|
int block_size_x, int block_size_y
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int mip_width, mip_height;
|
int mip_width, mip_height;
|
||||||
int i, j, c;
|
int i, j, c;
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (width < 1) || (height < 1) ||
|
if( (width < 1) || (height < 1) ||
|
||||||
(channels < 1) || (orig == NULL) ||
|
(channels < 1) || (orig == NULL) ||
|
||||||
(resampled == NULL) ||
|
(resampled == NULL) ||
|
||||||
(block_size_x < 1) || (block_size_y < 1) )
|
(block_size_x < 1) || (block_size_y < 1) )
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
mip_width = width / block_size_x;
|
mip_width = width / block_size_x;
|
||||||
mip_height = height / block_size_y;
|
mip_height = height / block_size_y;
|
||||||
if( mip_width < 1 )
|
if( mip_width < 1 )
|
||||||
{
|
{
|
||||||
mip_width = 1;
|
mip_width = 1;
|
||||||
}
|
}
|
||||||
if( mip_height < 1 )
|
if( mip_height < 1 )
|
||||||
{
|
{
|
||||||
mip_height = 1;
|
mip_height = 1;
|
||||||
}
|
}
|
||||||
for( j = 0; j < mip_height; ++j )
|
for( j = 0; j < mip_height; ++j )
|
||||||
{
|
{
|
||||||
for( i = 0; i < mip_width; ++i )
|
for( i = 0; i < mip_width; ++i )
|
||||||
{
|
{
|
||||||
for( c = 0; c < channels; ++c )
|
for( c = 0; c < channels; ++c )
|
||||||
{
|
{
|
||||||
const int index = (j*block_size_y)*width*channels + (i*block_size_x)*channels + c;
|
const int index = (j*block_size_y)*width*channels + (i*block_size_x)*channels + c;
|
||||||
int sum_value;
|
int sum_value;
|
||||||
int u,v;
|
int u,v;
|
||||||
int u_block = block_size_x;
|
int u_block = block_size_x;
|
||||||
int v_block = block_size_y;
|
int v_block = block_size_y;
|
||||||
int block_area;
|
int block_area;
|
||||||
/* do a bit of checking so we don't over-run the boundaries
|
/* do a bit of checking so we don't over-run the boundaries
|
||||||
(necessary for non-square textures!) */
|
(necessary for non-square textures!) */
|
||||||
if( block_size_x * (i+1) > width )
|
if( block_size_x * (i+1) > width )
|
||||||
{
|
{
|
||||||
u_block = width - i*block_size_y;
|
u_block = width - i*block_size_y;
|
||||||
}
|
}
|
||||||
if( block_size_y * (j+1) > height )
|
if( block_size_y * (j+1) > height )
|
||||||
{
|
{
|
||||||
v_block = height - j*block_size_y;
|
v_block = height - j*block_size_y;
|
||||||
}
|
}
|
||||||
block_area = u_block*v_block;
|
block_area = u_block*v_block;
|
||||||
/* for this pixel, see what the average
|
/* for this pixel, see what the average
|
||||||
of all the values in the block are.
|
of all the values in the block are.
|
||||||
note: start the sum at the rounding value, not at 0 */
|
note: start the sum at the rounding value, not at 0 */
|
||||||
sum_value = block_area >> 1;
|
sum_value = block_area >> 1;
|
||||||
for( v = 0; v < v_block; ++v )
|
for( v = 0; v < v_block; ++v )
|
||||||
for( u = 0; u < u_block; ++u )
|
for( u = 0; u < u_block; ++u )
|
||||||
{
|
{
|
||||||
sum_value += orig[index + v*width*channels + u*channels];
|
sum_value += orig[index + v*width*channels + u*channels];
|
||||||
}
|
}
|
||||||
resampled[j*mip_width*channels + i*channels + c] = sum_value / block_area;
|
resampled[j*mip_width*channels + i*channels + c] = sum_value / block_area;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scale_image_RGB_to_NTSC_safe
|
scale_image_RGB_to_NTSC_safe
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const float scale_lo = 16.0f - 0.499f;
|
const float scale_lo = 16.0f - 0.499f;
|
||||||
const float scale_hi = 235.0f + 0.499f;
|
const float scale_hi = 235.0f + 0.499f;
|
||||||
int i, j;
|
int i, j;
|
||||||
int nc = channels;
|
int nc = channels;
|
||||||
unsigned char scale_LUT[256];
|
unsigned char scale_LUT[256];
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (width < 1) || (height < 1) ||
|
if( (width < 1) || (height < 1) ||
|
||||||
(channels < 1) || (orig == NULL) )
|
(channels < 1) || (orig == NULL) )
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* set up the scaling Look Up Table */
|
/* set up the scaling Look Up Table */
|
||||||
for( i = 0; i < 256; ++i )
|
for( i = 0; i < 256; ++i )
|
||||||
{
|
{
|
||||||
scale_LUT[i] = (unsigned char)((scale_hi - scale_lo) * i / 255.0f + scale_lo);
|
scale_LUT[i] = (unsigned char)((scale_hi - scale_lo) * i / 255.0f + scale_lo);
|
||||||
}
|
}
|
||||||
/* for channels = 2 or 4, ignore the alpha component */
|
/* for channels = 2 or 4, ignore the alpha component */
|
||||||
nc -= 1 - (channels & 1);
|
nc -= 1 - (channels & 1);
|
||||||
/* OK, go through the image and scale any non-alpha components */
|
/* OK, go through the image and scale any non-alpha components */
|
||||||
for( i = 0; i < width*height*channels; i += channels )
|
for( i = 0; i < width*height*channels; i += channels )
|
||||||
{
|
{
|
||||||
for( j = 0; j < nc; ++j )
|
for( j = 0; j < nc; ++j )
|
||||||
{
|
{
|
||||||
orig[i+j] = scale_LUT[orig[i+j]];
|
orig[i+j] = scale_LUT[orig[i+j]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char clamp_byte( int x ) { return ( (x) < 0 ? (0) : ( (x) > 255 ? 255 : (x) ) ); }
|
unsigned char clamp_byte( int x ) { return ( (x) < 0 ? (0) : ( (x) > 255 ? 255 : (x) ) ); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function takes the RGB components of the image
|
This function takes the RGB components of the image
|
||||||
and converts them into YCoCg. 3 components will be
|
and converts them into YCoCg. 3 components will be
|
||||||
re-ordered to CoYCg (for optimum DXT1 compression),
|
re-ordered to CoYCg (for optimum DXT1 compression),
|
||||||
while 4 components will be ordered CoCgAY (for DXT5
|
while 4 components will be ordered CoCgAY (for DXT5
|
||||||
compression).
|
compression).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
convert_RGB_to_YCoCg
|
convert_RGB_to_YCoCg
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (width < 1) || (height < 1) ||
|
if( (width < 1) || (height < 1) ||
|
||||||
(channels < 3) || (channels > 4) ||
|
(channels < 3) || (channels > 4) ||
|
||||||
(orig == NULL) )
|
(orig == NULL) )
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* do the conversion */
|
/* do the conversion */
|
||||||
if( channels == 3 )
|
if( channels == 3 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < width*height*3; i += 3 )
|
for( i = 0; i < width*height*3; i += 3 )
|
||||||
{
|
{
|
||||||
int r = orig[i+0];
|
int r = orig[i+0];
|
||||||
int g = (orig[i+1] + 1) >> 1;
|
int g = (orig[i+1] + 1) >> 1;
|
||||||
int b = orig[i+2];
|
int b = orig[i+2];
|
||||||
int tmp = (2 + r + b) >> 2;
|
int tmp = (2 + r + b) >> 2;
|
||||||
/* Co */
|
/* Co */
|
||||||
orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );
|
orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );
|
||||||
/* Y */
|
/* Y */
|
||||||
orig[i+1] = clamp_byte( g + tmp );
|
orig[i+1] = clamp_byte( g + tmp );
|
||||||
/* Cg */
|
/* Cg */
|
||||||
orig[i+2] = clamp_byte( 128 + g - tmp );
|
orig[i+2] = clamp_byte( 128 + g - tmp );
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
for( i = 0; i < width*height*4; i += 4 )
|
for( i = 0; i < width*height*4; i += 4 )
|
||||||
{
|
{
|
||||||
int r = orig[i+0];
|
int r = orig[i+0];
|
||||||
int g = (orig[i+1] + 1) >> 1;
|
int g = (orig[i+1] + 1) >> 1;
|
||||||
int b = orig[i+2];
|
int b = orig[i+2];
|
||||||
unsigned char a = orig[i+3];
|
unsigned char a = orig[i+3];
|
||||||
int tmp = (2 + r + b) >> 2;
|
int tmp = (2 + r + b) >> 2;
|
||||||
/* Co */
|
/* Co */
|
||||||
orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );
|
orig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );
|
||||||
/* Cg */
|
/* Cg */
|
||||||
orig[i+1] = clamp_byte( 128 + g - tmp );
|
orig[i+1] = clamp_byte( 128 + g - tmp );
|
||||||
/* Alpha */
|
/* Alpha */
|
||||||
orig[i+2] = a;
|
orig[i+2] = a;
|
||||||
/* Y */
|
/* Y */
|
||||||
orig[i+3] = clamp_byte( g + tmp );
|
orig[i+3] = clamp_byte( g + tmp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* done */
|
/* done */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function takes the YCoCg components of the image
|
This function takes the YCoCg components of the image
|
||||||
and converts them into RGB. See above.
|
and converts them into RGB. See above.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
convert_YCoCg_to_RGB
|
convert_YCoCg_to_RGB
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (width < 1) || (height < 1) ||
|
if( (width < 1) || (height < 1) ||
|
||||||
(channels < 3) || (channels > 4) ||
|
(channels < 3) || (channels > 4) ||
|
||||||
(orig == NULL) )
|
(orig == NULL) )
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* do the conversion */
|
/* do the conversion */
|
||||||
if( channels == 3 )
|
if( channels == 3 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < width*height*3; i += 3 )
|
for( i = 0; i < width*height*3; i += 3 )
|
||||||
{
|
{
|
||||||
int co = orig[i+0] - 128;
|
int co = orig[i+0] - 128;
|
||||||
int y = orig[i+1];
|
int y = orig[i+1];
|
||||||
int cg = orig[i+2] - 128;
|
int cg = orig[i+2] - 128;
|
||||||
/* R */
|
/* R */
|
||||||
orig[i+0] = clamp_byte( y + co - cg );
|
orig[i+0] = clamp_byte( y + co - cg );
|
||||||
/* G */
|
/* G */
|
||||||
orig[i+1] = clamp_byte( y + cg );
|
orig[i+1] = clamp_byte( y + cg );
|
||||||
/* B */
|
/* B */
|
||||||
orig[i+2] = clamp_byte( y - co - cg );
|
orig[i+2] = clamp_byte( y - co - cg );
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
for( i = 0; i < width*height*4; i += 4 )
|
for( i = 0; i < width*height*4; i += 4 )
|
||||||
{
|
{
|
||||||
int co = orig[i+0] - 128;
|
int co = orig[i+0] - 128;
|
||||||
int cg = orig[i+1] - 128;
|
int cg = orig[i+1] - 128;
|
||||||
unsigned char a = orig[i+2];
|
unsigned char a = orig[i+2];
|
||||||
int y = orig[i+3];
|
int y = orig[i+3];
|
||||||
/* R */
|
/* R */
|
||||||
orig[i+0] = clamp_byte( y + co - cg );
|
orig[i+0] = clamp_byte( y + co - cg );
|
||||||
/* G */
|
/* G */
|
||||||
orig[i+1] = clamp_byte( y + cg );
|
orig[i+1] = clamp_byte( y + cg );
|
||||||
/* B */
|
/* B */
|
||||||
orig[i+2] = clamp_byte( y - co - cg );
|
orig[i+2] = clamp_byte( y - co - cg );
|
||||||
/* A */
|
/* A */
|
||||||
orig[i+3] = a;
|
orig[i+3] = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* done */
|
/* done */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
find_max_RGBE
|
find_max_RGBE
|
||||||
(
|
(
|
||||||
unsigned char *image,
|
unsigned char *image,
|
||||||
int width, int height
|
int width, int height
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
float max_val = 0.0f;
|
float max_val = 0.0f;
|
||||||
unsigned char *img = image;
|
unsigned char *img = image;
|
||||||
int i, j;
|
int i, j;
|
||||||
for( i = width * height; i > 0; --i )
|
for( i = width * height; i > 0; --i )
|
||||||
{
|
{
|
||||||
/* float scale = powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
/* float scale = powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
||||||
float scale = ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
float scale = ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
||||||
for( j = 0; j < 3; ++j )
|
for( j = 0; j < 3; ++j )
|
||||||
{
|
{
|
||||||
if( img[j] * scale > max_val )
|
if( img[j] * scale > max_val )
|
||||||
{
|
{
|
||||||
max_val = img[j] * scale;
|
max_val = img[j] * scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* next pixel */
|
/* next pixel */
|
||||||
img += 4;
|
img += 4;
|
||||||
}
|
}
|
||||||
return max_val;
|
return max_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RGBE_to_RGBdivA
|
RGBE_to_RGBdivA
|
||||||
(
|
(
|
||||||
unsigned char *image,
|
unsigned char *image,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int rescale_to_max
|
int rescale_to_max
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* local variables */
|
/* local variables */
|
||||||
int i, iv;
|
int i, iv;
|
||||||
unsigned char *img = image;
|
unsigned char *img = image;
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (!image) || (width < 1) || (height < 1) )
|
if( (!image) || (width < 1) || (height < 1) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* convert (note: no negative numbers, but 0.0 is possible) */
|
/* convert (note: no negative numbers, but 0.0 is possible) */
|
||||||
if( rescale_to_max )
|
if( rescale_to_max )
|
||||||
{
|
{
|
||||||
scale = 255.0f / find_max_RGBE( image, width, height );
|
scale = 255.0f / find_max_RGBE( image, width, height );
|
||||||
}
|
}
|
||||||
for( i = width * height; i > 0; --i )
|
for( i = width * height; i > 0; --i )
|
||||||
{
|
{
|
||||||
/* decode this pixel, and find the max */
|
/* decode this pixel, and find the max */
|
||||||
float r,g,b,e, m;
|
float r,g,b,e, m;
|
||||||
/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
||||||
e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
||||||
r = e * img[0];
|
r = e * img[0];
|
||||||
g = e * img[1];
|
g = e * img[1];
|
||||||
b = e * img[2];
|
b = e * img[2];
|
||||||
m = (r > g) ? r : g;
|
m = (r > g) ? r : g;
|
||||||
m = (b > m) ? b : m;
|
m = (b > m) ? b : m;
|
||||||
/* and encode it into RGBdivA */
|
/* and encode it into RGBdivA */
|
||||||
iv = (m != 0.0f) ? (int)(255.0f / m) : 1.0f;
|
iv = (m != 0.0f) ? (int)(255.0f / m) : 1.0f;
|
||||||
iv = (iv < 1) ? 1 : iv;
|
iv = (iv < 1) ? 1 : iv;
|
||||||
img[3] = (iv > 255) ? 255 : iv;
|
img[3] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * r + 0.5f);
|
iv = (int)(img[3] * r + 0.5f);
|
||||||
img[0] = (iv > 255) ? 255 : iv;
|
img[0] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * g + 0.5f);
|
iv = (int)(img[3] * g + 0.5f);
|
||||||
img[1] = (iv > 255) ? 255 : iv;
|
img[1] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * b + 0.5f);
|
iv = (int)(img[3] * b + 0.5f);
|
||||||
img[2] = (iv > 255) ? 255 : iv;
|
img[2] = (iv > 255) ? 255 : iv;
|
||||||
/* and on to the next pixel */
|
/* and on to the next pixel */
|
||||||
img += 4;
|
img += 4;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RGBE_to_RGBdivA2
|
RGBE_to_RGBdivA2
|
||||||
(
|
(
|
||||||
unsigned char *image,
|
unsigned char *image,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int rescale_to_max
|
int rescale_to_max
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* local variables */
|
/* local variables */
|
||||||
int i, iv;
|
int i, iv;
|
||||||
unsigned char *img = image;
|
unsigned char *img = image;
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
/* error check */
|
/* error check */
|
||||||
if( (!image) || (width < 1) || (height < 1) )
|
if( (!image) || (width < 1) || (height < 1) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* convert (note: no negative numbers, but 0.0 is possible) */
|
/* convert (note: no negative numbers, but 0.0 is possible) */
|
||||||
if( rescale_to_max )
|
if( rescale_to_max )
|
||||||
{
|
{
|
||||||
scale = 255.0f * 255.0f / find_max_RGBE( image, width, height );
|
scale = 255.0f * 255.0f / find_max_RGBE( image, width, height );
|
||||||
}
|
}
|
||||||
for( i = width * height; i > 0; --i )
|
for( i = width * height; i > 0; --i )
|
||||||
{
|
{
|
||||||
/* decode this pixel, and find the max */
|
/* decode this pixel, and find the max */
|
||||||
float r,g,b,e, m;
|
float r,g,b,e, m;
|
||||||
/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */
|
||||||
e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
e = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );
|
||||||
r = e * img[0];
|
r = e * img[0];
|
||||||
g = e * img[1];
|
g = e * img[1];
|
||||||
b = e * img[2];
|
b = e * img[2];
|
||||||
m = (r > g) ? r : g;
|
m = (r > g) ? r : g;
|
||||||
m = (b > m) ? b : m;
|
m = (b > m) ? b : m;
|
||||||
/* and encode it into RGBdivA */
|
/* and encode it into RGBdivA */
|
||||||
iv = (m != 0.0f) ? (int)sqrtf( 255.0f * 255.0f / m ) : 1.0f;
|
iv = (m != 0.0f) ? (int)sqrtf( 255.0f * 255.0f / m ) : 1.0f;
|
||||||
iv = (iv < 1) ? 1 : iv;
|
iv = (iv < 1) ? 1 : iv;
|
||||||
img[3] = (iv > 255) ? 255 : iv;
|
img[3] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * img[3] * r / 255.0f + 0.5f);
|
iv = (int)(img[3] * img[3] * r / 255.0f + 0.5f);
|
||||||
img[0] = (iv > 255) ? 255 : iv;
|
img[0] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * img[3] * g / 255.0f + 0.5f);
|
iv = (int)(img[3] * img[3] * g / 255.0f + 0.5f);
|
||||||
img[1] = (iv > 255) ? 255 : iv;
|
img[1] = (iv > 255) ? 255 : iv;
|
||||||
iv = (int)(img[3] * img[3] * b / 255.0f + 0.5f);
|
iv = (int)(img[3] * img[3] * b / 255.0f + 0.5f);
|
||||||
img[2] = (iv > 255) ? 255 : iv;
|
img[2] = (iv > 255) ? 255 : iv;
|
||||||
/* and on to the next pixel */
|
/* and on to the next pixel */
|
||||||
img += 4;
|
img += 4;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,115 +1,115 @@
|
||||||
/*
|
/*
|
||||||
Jonathan Dummer
|
Jonathan Dummer
|
||||||
|
|
||||||
Image helper functions
|
Image helper functions
|
||||||
|
|
||||||
MIT license
|
MIT license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_IMAGE_HELPER
|
#ifndef HEADER_IMAGE_HELPER
|
||||||
#define HEADER_IMAGE_HELPER
|
#define HEADER_IMAGE_HELPER
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function upscales an image.
|
This function upscales an image.
|
||||||
Not to be used to create MIPmaps,
|
Not to be used to create MIPmaps,
|
||||||
but to make it square,
|
but to make it square,
|
||||||
or to make it a power-of-two sized.
|
or to make it a power-of-two sized.
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
up_scale_image
|
up_scale_image
|
||||||
(
|
(
|
||||||
const unsigned char* const orig,
|
const unsigned char* const orig,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
unsigned char* resampled,
|
unsigned char* resampled,
|
||||||
int resampled_width, int resampled_height
|
int resampled_width, int resampled_height
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function downscales an image.
|
This function downscales an image.
|
||||||
Used for creating MIPmaps,
|
Used for creating MIPmaps,
|
||||||
the incoming image should be a
|
the incoming image should be a
|
||||||
power-of-two sized.
|
power-of-two sized.
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
mipmap_image
|
mipmap_image
|
||||||
(
|
(
|
||||||
const unsigned char* const orig,
|
const unsigned char* const orig,
|
||||||
int width, int height, int channels,
|
int width, int height, int channels,
|
||||||
unsigned char* resampled,
|
unsigned char* resampled,
|
||||||
int block_size_x, int block_size_y
|
int block_size_x, int block_size_y
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function takes the RGB components of the image
|
This function takes the RGB components of the image
|
||||||
and scales each channel from [0,255] to [16,235].
|
and scales each channel from [0,255] to [16,235].
|
||||||
This makes the colors "Safe" for display on NTSC
|
This makes the colors "Safe" for display on NTSC
|
||||||
displays. Note that this is _NOT_ a good idea for
|
displays. Note that this is _NOT_ a good idea for
|
||||||
loading images like normal- or height-maps!
|
loading images like normal- or height-maps!
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
scale_image_RGB_to_NTSC_safe
|
scale_image_RGB_to_NTSC_safe
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function takes the RGB components of the image
|
This function takes the RGB components of the image
|
||||||
and converts them into YCoCg. 3 components will be
|
and converts them into YCoCg. 3 components will be
|
||||||
re-ordered to CoYCg (for optimum DXT1 compression),
|
re-ordered to CoYCg (for optimum DXT1 compression),
|
||||||
while 4 components will be ordered CoCgAY (for DXT5
|
while 4 components will be ordered CoCgAY (for DXT5
|
||||||
compression).
|
compression).
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
convert_RGB_to_YCoCg
|
convert_RGB_to_YCoCg
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function takes the YCoCg components of the image
|
This function takes the YCoCg components of the image
|
||||||
and converts them into RGB. See above.
|
and converts them into RGB. See above.
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
convert_YCoCg_to_RGB
|
convert_YCoCg_to_RGB
|
||||||
(
|
(
|
||||||
unsigned char* orig,
|
unsigned char* orig,
|
||||||
int width, int height, int channels
|
int width, int height, int channels
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts an HDR image from an array
|
Converts an HDR image from an array
|
||||||
of unsigned chars (RGBE) to RGBdivA
|
of unsigned chars (RGBE) to RGBdivA
|
||||||
\return 0 if failed, otherwise returns 1
|
\return 0 if failed, otherwise returns 1
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
RGBE_to_RGBdivA
|
RGBE_to_RGBdivA
|
||||||
(
|
(
|
||||||
unsigned char *image,
|
unsigned char *image,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int rescale_to_max
|
int rescale_to_max
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts an HDR image from an array
|
Converts an HDR image from an array
|
||||||
of unsigned chars (RGBE) to RGBdivA2
|
of unsigned chars (RGBE) to RGBdivA2
|
||||||
\return 0 if failed, otherwise returns 1
|
\return 0 if failed, otherwise returns 1
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
RGBE_to_RGBdivA2
|
RGBE_to_RGBdivA2
|
||||||
(
|
(
|
||||||
unsigned char *image,
|
unsigned char *image,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int rescale_to_max
|
int rescale_to_max
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* HEADER_IMAGE_HELPER */
|
#endif /* HEADER_IMAGE_HELPER */
|
||||||
|
|
|
@ -1,354 +1,354 @@
|
||||||
/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
|
/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
|
||||||
when you control the images you're loading
|
when you control the images you're loading
|
||||||
|
|
||||||
QUICK NOTES:
|
QUICK NOTES:
|
||||||
Primarily of interest to game developers and other people who can
|
Primarily of interest to game developers and other people who can
|
||||||
avoid problematic images and only need the trivial interface
|
avoid problematic images and only need the trivial interface
|
||||||
|
|
||||||
JPEG baseline (no JPEG progressive, no oddball channel decimations)
|
JPEG baseline (no JPEG progressive, no oddball channel decimations)
|
||||||
PNG non-interlaced
|
PNG non-interlaced
|
||||||
BMP non-1bpp, non-RLE
|
BMP non-1bpp, non-RLE
|
||||||
TGA (not sure what subset, if a subset)
|
TGA (not sure what subset, if a subset)
|
||||||
PSD (composited view only, no extra channels)
|
PSD (composited view only, no extra channels)
|
||||||
HDR (radiance rgbE format)
|
HDR (radiance rgbE format)
|
||||||
writes BMP,TGA (define STBI_NO_WRITE to remove code)
|
writes BMP,TGA (define STBI_NO_WRITE to remove code)
|
||||||
decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
|
decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)
|
||||||
supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
|
supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
stbi_info_*
|
stbi_info_*
|
||||||
|
|
||||||
history:
|
history:
|
||||||
1.16 major bugfix - convert_format converted one too many pixels
|
1.16 major bugfix - convert_format converted one too many pixels
|
||||||
1.15 initialize some fields for thread safety
|
1.15 initialize some fields for thread safety
|
||||||
1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
|
1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
|
||||||
1.13 threadsafe
|
1.13 threadsafe
|
||||||
1.12 const qualifiers in the API
|
1.12 const qualifiers in the API
|
||||||
1.11 Support installable IDCT, colorspace conversion routines
|
1.11 Support installable IDCT, colorspace conversion routines
|
||||||
1.10 Fixes for 64-bit (don't use "unsigned long")
|
1.10 Fixes for 64-bit (don't use "unsigned long")
|
||||||
optimized upsampling by Fabian "ryg" Giesen
|
optimized upsampling by Fabian "ryg" Giesen
|
||||||
1.09 Fix format-conversion for PSD code (bad global variables!)
|
1.09 Fix format-conversion for PSD code (bad global variables!)
|
||||||
1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
|
1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
|
||||||
1.07 attempt to fix C++ warning/errors again
|
1.07 attempt to fix C++ warning/errors again
|
||||||
1.06 attempt to fix C++ warning/errors again
|
1.06 attempt to fix C++ warning/errors again
|
||||||
1.05 fix TGA loading to return correct *comp and use good luminance calc
|
1.05 fix TGA loading to return correct *comp and use good luminance calc
|
||||||
1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
|
1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
|
||||||
1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
|
1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
|
||||||
1.02 support for (subset of) HDR files, float interface for preferred access to them
|
1.02 support for (subset of) HDR files, float interface for preferred access to them
|
||||||
1.01 fix bug: possible bug in handling right-side up bmps... not sure
|
1.01 fix bug: possible bug in handling right-side up bmps... not sure
|
||||||
fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
|
fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all
|
||||||
1.00 interface to zlib that skips zlib header
|
1.00 interface to zlib that skips zlib header
|
||||||
0.99 correct handling of alpha in palette
|
0.99 correct handling of alpha in palette
|
||||||
0.98 TGA loader by lonesock; dynamically add loaders (untested)
|
0.98 TGA loader by lonesock; dynamically add loaders (untested)
|
||||||
0.97 jpeg errors on too large a file; also catch another malloc failure
|
0.97 jpeg errors on too large a file; also catch another malloc failure
|
||||||
0.96 fix detection of invalid v value - particleman@mollyrocket forum
|
0.96 fix detection of invalid v value - particleman@mollyrocket forum
|
||||||
0.95 during header scan, seek to markers in case of padding
|
0.95 during header scan, seek to markers in case of padding
|
||||||
0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
|
0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
|
||||||
0.93 handle jpegtran output; verbose errors
|
0.93 handle jpegtran output; verbose errors
|
||||||
0.92 read 4,8,16,24,32-bit BMP files of several formats
|
0.92 read 4,8,16,24,32-bit BMP files of several formats
|
||||||
0.91 output 24-bit Windows 3.0 BMP files
|
0.91 output 24-bit Windows 3.0 BMP files
|
||||||
0.90 fix a few more warnings; bump version number to approach 1.0
|
0.90 fix a few more warnings; bump version number to approach 1.0
|
||||||
0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
|
0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
|
||||||
0.60 fix compiling as c++
|
0.60 fix compiling as c++
|
||||||
0.59 fix warnings: merge Dave Moore's -Wall fixes
|
0.59 fix warnings: merge Dave Moore's -Wall fixes
|
||||||
0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
|
0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
|
||||||
0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
|
0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less
|
||||||
than 16 available
|
than 16 available
|
||||||
0.56 fix bug: zlib uncompressed mode len vs. nlen
|
0.56 fix bug: zlib uncompressed mode len vs. nlen
|
||||||
0.55 fix bug: restart_interval not initialized to 0
|
0.55 fix bug: restart_interval not initialized to 0
|
||||||
0.54 allow NULL for 'int *comp'
|
0.54 allow NULL for 'int *comp'
|
||||||
0.53 fix bug in png 3->4; speedup png decoding
|
0.53 fix bug in png 3->4; speedup png decoding
|
||||||
0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
|
0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
|
||||||
0.51 obey req_comp requests, 1-component jpegs return as 1-component,
|
0.51 obey req_comp requests, 1-component jpegs return as 1-component,
|
||||||
on 'test' only check type, not whether we support this variant
|
on 'test' only check type, not whether we support this variant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_STB_IMAGE_AUGMENTED
|
#ifndef HEADER_STB_IMAGE_AUGMENTED
|
||||||
#define HEADER_STB_IMAGE_AUGMENTED
|
#define HEADER_STB_IMAGE_AUGMENTED
|
||||||
|
|
||||||
//// begin header file ////////////////////////////////////////////////////
|
//// begin header file ////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Limitations:
|
// Limitations:
|
||||||
// - no progressive/interlaced support (jpeg, png)
|
// - no progressive/interlaced support (jpeg, png)
|
||||||
// - 8-bit samples only (jpeg, png)
|
// - 8-bit samples only (jpeg, png)
|
||||||
// - not threadsafe
|
// - not threadsafe
|
||||||
// - channel subsampling of at most 2 in each dimension (jpeg)
|
// - channel subsampling of at most 2 in each dimension (jpeg)
|
||||||
// - no delayed line count (jpeg) -- IJG doesn't support either
|
// - no delayed line count (jpeg) -- IJG doesn't support either
|
||||||
//
|
//
|
||||||
// Basic usage (see HDR discussion below):
|
// Basic usage (see HDR discussion below):
|
||||||
// int x,y,n;
|
// int x,y,n;
|
||||||
// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
|
// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
|
||||||
// // ... process data if not NULL ...
|
// // ... process data if not NULL ...
|
||||||
// // ... x = width, y = height, n = # 8-bit components per pixel ...
|
// // ... x = width, y = height, n = # 8-bit components per pixel ...
|
||||||
// // ... replace '0' with '1'..'4' to force that many components per pixel
|
// // ... replace '0' with '1'..'4' to force that many components per pixel
|
||||||
// stbi_image_free(data)
|
// stbi_image_free(data)
|
||||||
//
|
//
|
||||||
// Standard parameters:
|
// Standard parameters:
|
||||||
// int *x -- outputs image width in pixels
|
// int *x -- outputs image width in pixels
|
||||||
// int *y -- outputs image height in pixels
|
// int *y -- outputs image height in pixels
|
||||||
// int *comp -- outputs # of image components in image file
|
// int *comp -- outputs # of image components in image file
|
||||||
// int req_comp -- if non-zero, # of image components requested in result
|
// int req_comp -- if non-zero, # of image components requested in result
|
||||||
//
|
//
|
||||||
// The return value from an image loader is an 'unsigned char *' which points
|
// The return value from an image loader is an 'unsigned char *' which points
|
||||||
// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
|
// to the pixel data. The pixel data consists of *y scanlines of *x pixels,
|
||||||
// with each pixel consisting of N interleaved 8-bit components; the first
|
// with each pixel consisting of N interleaved 8-bit components; the first
|
||||||
// pixel pointed to is top-left-most in the image. There is no padding between
|
// pixel pointed to is top-left-most in the image. There is no padding between
|
||||||
// image scanlines or between pixels, regardless of format. The number of
|
// image scanlines or between pixels, regardless of format. The number of
|
||||||
// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
|
// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
|
||||||
// If req_comp is non-zero, *comp has the number of components that _would_
|
// If req_comp is non-zero, *comp has the number of components that _would_
|
||||||
// have been output otherwise. E.g. if you set req_comp to 4, you will always
|
// have been output otherwise. E.g. if you set req_comp to 4, you will always
|
||||||
// get RGBA output, but you can check *comp to easily see if it's opaque.
|
// get RGBA output, but you can check *comp to easily see if it's opaque.
|
||||||
//
|
//
|
||||||
// An output image with N components has the following components interleaved
|
// An output image with N components has the following components interleaved
|
||||||
// in this order in each pixel:
|
// in this order in each pixel:
|
||||||
//
|
//
|
||||||
// N=#comp components
|
// N=#comp components
|
||||||
// 1 grey
|
// 1 grey
|
||||||
// 2 grey, alpha
|
// 2 grey, alpha
|
||||||
// 3 red, green, blue
|
// 3 red, green, blue
|
||||||
// 4 red, green, blue, alpha
|
// 4 red, green, blue, alpha
|
||||||
//
|
//
|
||||||
// If image loading fails for any reason, the return value will be NULL,
|
// If image loading fails for any reason, the return value will be NULL,
|
||||||
// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
|
// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
|
||||||
// can be queried for an extremely brief, end-user unfriendly explanation
|
// can be queried for an extremely brief, end-user unfriendly explanation
|
||||||
// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
|
// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
|
||||||
// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
|
// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
|
||||||
// more user-friendly ones.
|
// more user-friendly ones.
|
||||||
//
|
//
|
||||||
// Paletted PNG and BMP images are automatically depalettized.
|
// Paletted PNG and BMP images are automatically depalettized.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
//
|
//
|
||||||
// HDR image support (disable by defining STBI_NO_HDR)
|
// HDR image support (disable by defining STBI_NO_HDR)
|
||||||
//
|
//
|
||||||
// stb_image now supports loading HDR images in general, and currently
|
// stb_image now supports loading HDR images in general, and currently
|
||||||
// the Radiance .HDR file format, although the support is provided
|
// the Radiance .HDR file format, although the support is provided
|
||||||
// generically. You can still load any file through the existing interface;
|
// generically. You can still load any file through the existing interface;
|
||||||
// if you attempt to load an HDR file, it will be automatically remapped to
|
// if you attempt to load an HDR file, it will be automatically remapped to
|
||||||
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
|
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
|
||||||
// both of these constants can be reconfigured through this interface:
|
// both of these constants can be reconfigured through this interface:
|
||||||
//
|
//
|
||||||
// stbi_hdr_to_ldr_gamma(2.2f);
|
// stbi_hdr_to_ldr_gamma(2.2f);
|
||||||
// stbi_hdr_to_ldr_scale(1.0f);
|
// stbi_hdr_to_ldr_scale(1.0f);
|
||||||
//
|
//
|
||||||
// (note, do not use _inverse_ constants; stbi_image will invert them
|
// (note, do not use _inverse_ constants; stbi_image will invert them
|
||||||
// appropriately).
|
// appropriately).
|
||||||
//
|
//
|
||||||
// Additionally, there is a new, parallel interface for loading files as
|
// Additionally, there is a new, parallel interface for loading files as
|
||||||
// (linear) floats to preserve the full dynamic range:
|
// (linear) floats to preserve the full dynamic range:
|
||||||
//
|
//
|
||||||
// float *data = stbi_loadf(filename, &x, &y, &n, 0);
|
// float *data = stbi_loadf(filename, &x, &y, &n, 0);
|
||||||
//
|
//
|
||||||
// If you load LDR images through this interface, those images will
|
// If you load LDR images through this interface, those images will
|
||||||
// be promoted to floating point values, run through the inverse of
|
// be promoted to floating point values, run through the inverse of
|
||||||
// constants corresponding to the above:
|
// constants corresponding to the above:
|
||||||
//
|
//
|
||||||
// stbi_ldr_to_hdr_scale(1.0f);
|
// stbi_ldr_to_hdr_scale(1.0f);
|
||||||
// stbi_ldr_to_hdr_gamma(2.2f);
|
// stbi_ldr_to_hdr_gamma(2.2f);
|
||||||
//
|
//
|
||||||
// Finally, given a filename (or an open file or memory block--see header
|
// Finally, given a filename (or an open file or memory block--see header
|
||||||
// file for details) containing image data, you can query for the "most
|
// file for details) containing image data, you can query for the "most
|
||||||
// appropriate" interface to use (that is, whether the image is HDR or
|
// appropriate" interface to use (that is, whether the image is HDR or
|
||||||
// not), using:
|
// not), using:
|
||||||
//
|
//
|
||||||
// stbi_is_hdr(char *filename);
|
// stbi_is_hdr(char *filename);
|
||||||
|
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STBI_VERSION 1
|
#define STBI_VERSION 1
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
STBI_default = 0, // only used for req_comp
|
STBI_default = 0, // only used for req_comp
|
||||||
|
|
||||||
STBI_grey = 1,
|
STBI_grey = 1,
|
||||||
STBI_grey_alpha = 2,
|
STBI_grey_alpha = 2,
|
||||||
STBI_rgb = 3,
|
STBI_rgb = 3,
|
||||||
STBI_rgb_alpha = 4,
|
STBI_rgb_alpha = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned char stbi_uc;
|
typedef unsigned char stbi_uc;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// WRITING API
|
// WRITING API
|
||||||
|
|
||||||
#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)
|
#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)
|
||||||
// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)
|
// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)
|
||||||
// (you must include the appropriate extension in the filename).
|
// (you must include the appropriate extension in the filename).
|
||||||
// returns TRUE on success, FALSE if couldn't open file, error writing file
|
// returns TRUE on success, FALSE if couldn't open file, error writing file
|
||||||
extern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data);
|
extern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data);
|
||||||
extern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data);
|
extern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PRIMARY API - works on images of any type
|
// PRIMARY API - works on images of any type
|
||||||
|
|
||||||
// load image by filename, open file, or memory buffer
|
// load image by filename, open file, or memory buffer
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
|
extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
|
||||||
#endif
|
#endif
|
||||||
extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||||
|
|
||||||
#ifndef STBI_NO_HDR
|
#ifndef STBI_NO_HDR
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
|
|
||||||
extern void stbi_hdr_to_ldr_gamma(float gammafactor);
|
extern void stbi_hdr_to_ldr_gamma(float gammafactor);
|
||||||
extern void stbi_hdr_to_ldr_scale(float scale);
|
extern void stbi_hdr_to_ldr_scale(float scale);
|
||||||
|
|
||||||
extern void stbi_ldr_to_hdr_gamma(float gammafactor);
|
extern void stbi_ldr_to_hdr_gamma(float gammafactor);
|
||||||
extern void stbi_ldr_to_hdr_scale(float scale);
|
extern void stbi_ldr_to_hdr_scale(float scale);
|
||||||
|
|
||||||
#endif // STBI_NO_HDR
|
#endif // STBI_NO_HDR
|
||||||
|
|
||||||
// get a VERY brief reason for failure
|
// get a VERY brief reason for failure
|
||||||
// NOT THREADSAFE
|
// NOT THREADSAFE
|
||||||
extern const char *stbi_failure_reason (void);
|
extern const char *stbi_failure_reason (void);
|
||||||
|
|
||||||
// free the loaded image -- this is just free()
|
// free the loaded image -- this is just free()
|
||||||
extern void stbi_image_free (void *retval_from_stbi_load);
|
extern void stbi_image_free (void *retval_from_stbi_load);
|
||||||
|
|
||||||
// get image dimensions & components without fully decoding
|
// get image dimensions & components without fully decoding
|
||||||
extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
||||||
extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
|
extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_info (char const *filename, int *x, int *y, int *comp);
|
extern int stbi_info (char const *filename, int *x, int *y, int *comp);
|
||||||
extern int stbi_is_hdr (char const *filename);
|
extern int stbi_is_hdr (char const *filename);
|
||||||
extern int stbi_is_hdr_from_file(FILE *f);
|
extern int stbi_is_hdr_from_file(FILE *f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ZLIB client - used by PNG, available for other purposes
|
// ZLIB client - used by PNG, available for other purposes
|
||||||
|
|
||||||
extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
|
extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
|
||||||
extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
|
extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
|
||||||
extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
||||||
|
|
||||||
extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
|
extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
|
||||||
extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
||||||
|
|
||||||
// TYPE-SPECIFIC ACCESS
|
// TYPE-SPECIFIC ACCESS
|
||||||
|
|
||||||
// is it a jpeg?
|
// is it a jpeg?
|
||||||
extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);
|
||||||
extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
||||||
|
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_jpeg_test_file (FILE *f);
|
extern int stbi_jpeg_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
|
|
||||||
extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
|
extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);
|
||||||
extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
|
extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is it a png?
|
// is it a png?
|
||||||
extern int stbi_png_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_png_test_memory (stbi_uc const *buffer, int len);
|
||||||
extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
||||||
|
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_png_info (char const *filename, int *x, int *y, int *comp);
|
extern int stbi_png_info (char const *filename, int *x, int *y, int *comp);
|
||||||
extern int stbi_png_test_file (FILE *f);
|
extern int stbi_png_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
|
extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is it a bmp?
|
// is it a bmp?
|
||||||
extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);
|
||||||
|
|
||||||
extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_bmp_test_file (FILE *f);
|
extern int stbi_bmp_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is it a tga?
|
// is it a tga?
|
||||||
extern int stbi_tga_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_tga_test_memory (stbi_uc const *buffer, int len);
|
||||||
|
|
||||||
extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_tga_test_file (FILE *f);
|
extern int stbi_tga_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is it a psd?
|
// is it a psd?
|
||||||
extern int stbi_psd_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_psd_test_memory (stbi_uc const *buffer, int len);
|
||||||
|
|
||||||
extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_psd_test_file (FILE *f);
|
extern int stbi_psd_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// is it an hdr?
|
// is it an hdr?
|
||||||
extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);
|
||||||
|
|
||||||
extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_hdr_test_file (FILE *f);
|
extern int stbi_hdr_test_file (FILE *f);
|
||||||
extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_hdr_load_rgbe_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_hdr_load_rgbe_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// define new loaders
|
// define new loaders
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int (*test_memory)(stbi_uc const *buffer, int len);
|
int (*test_memory)(stbi_uc const *buffer, int len);
|
||||||
stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
int (*test_file)(FILE *f);
|
int (*test_file)(FILE *f);
|
||||||
stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);
|
stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
} stbi_loader;
|
} stbi_loader;
|
||||||
|
|
||||||
// register a loader by filling out the above structure (you must defined ALL functions)
|
// register a loader by filling out the above structure (you must defined ALL functions)
|
||||||
// returns 1 if added or already added, 0 if not added (too many loaders)
|
// returns 1 if added or already added, 0 if not added (too many loaders)
|
||||||
// NOT THREADSAFE
|
// NOT THREADSAFE
|
||||||
extern int stbi_register_loader(stbi_loader *loader);
|
extern int stbi_register_loader(stbi_loader *loader);
|
||||||
|
|
||||||
// define faster low-level operations (typically SIMD support)
|
// define faster low-level operations (typically SIMD support)
|
||||||
#if STBI_SIMD
|
#if STBI_SIMD
|
||||||
typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);
|
typedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);
|
||||||
// compute an integer IDCT on "input"
|
// compute an integer IDCT on "input"
|
||||||
// input[x] = data[x] * dequantize[x]
|
// input[x] = data[x] * dequantize[x]
|
||||||
// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
|
// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'
|
||||||
// CLAMP results to 0..255
|
// CLAMP results to 0..255
|
||||||
typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);
|
typedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);
|
||||||
// compute a conversion from YCbCr to RGB
|
// compute a conversion from YCbCr to RGB
|
||||||
// 'count' pixels
|
// 'count' pixels
|
||||||
// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
|
// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B
|
||||||
// y: Y input channel
|
// y: Y input channel
|
||||||
// cb: Cb input channel; scale/biased to be 0..255
|
// cb: Cb input channel; scale/biased to be 0..255
|
||||||
// cr: Cr input channel; scale/biased to be 0..255
|
// cr: Cr input channel; scale/biased to be 0..255
|
||||||
|
|
||||||
extern void stbi_install_idct(stbi_idct_8x8 func);
|
extern void stbi_install_idct(stbi_idct_8x8 func);
|
||||||
extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
|
extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);
|
||||||
#endif // STBI_SIMD
|
#endif // STBI_SIMD
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//// end header file /////////////////////////////////////////////////////
|
//// end header file /////////////////////////////////////////////////////
|
||||||
#endif // STBI_INCLUDE_STB_IMAGE_H
|
#endif // STBI_INCLUDE_STB_IMAGE_H
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
/*
|
/*
|
||||||
adding DDS loading support to stbi
|
adding DDS loading support to stbi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_STB_IMAGE_DDS_AUGMENTATION
|
#ifndef HEADER_STB_IMAGE_DDS_AUGMENTATION
|
||||||
#define HEADER_STB_IMAGE_DDS_AUGMENTATION
|
#define HEADER_STB_IMAGE_DDS_AUGMENTATION
|
||||||
|
|
||||||
// is it a DDS file?
|
// is it a DDS file?
|
||||||
extern int stbi_dds_test_memory (stbi_uc const *buffer, int len);
|
extern int stbi_dds_test_memory (stbi_uc const *buffer, int len);
|
||||||
|
|
||||||
extern stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp);
|
||||||
extern stbi_uc *stbi_dds_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_dds_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
extern int stbi_dds_test_file (FILE *f);
|
extern int stbi_dds_test_file (FILE *f);
|
||||||
extern stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
extern stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//// end header file /////////////////////////////////////////////////////
|
//// end header file /////////////////////////////////////////////////////
|
||||||
#endif // HEADER_STB_IMAGE_DDS_AUGMENTATION
|
#endif // HEADER_STB_IMAGE_DDS_AUGMENTATION
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,26 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual Studio 2008
|
# Visual Studio 2008
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wiiuse", "wiiuse.vcproj", "{944EF6DE-471D-447E-A2FD-D37D58805169}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wiiuse", "wiiuse.vcproj", "{944EF6DE-471D-447E-A2FD-D37D58805169}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.ActiveCfg = Debug|Win32
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.Build.0 = Debug|Win32
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.ActiveCfg = Debug|x64
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.Build.0 = Debug|x64
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.Build.0 = Debug|x64
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.ActiveCfg = Release|Win32
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.Build.0 = Release|Win32
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.Build.0 = Release|Win32
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.ActiveCfg = Release|x64
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.ActiveCfg = Release|x64
|
||||||
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.Build.0 = Release|x64
|
{944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
||||||
OutFile "GetSVNRev.exe"
|
OutFile "GetSVNRev.exe"
|
||||||
SilentInstall silent
|
SilentInstall silent
|
||||||
|
|
||||||
Section
|
Section
|
||||||
; Create template for SubWCRev
|
; Create template for SubWCRev
|
||||||
FileOpen $R0 "svnrev_template.txt" w
|
FileOpen $R0 "svnrev_template.txt" w
|
||||||
FileWrite $R0 '!define PRODUCT_VERSION "$$WCREV$$"'
|
FileWrite $R0 '!define PRODUCT_VERSION "$$WCREV$$"'
|
||||||
FileClose $R0
|
FileClose $R0
|
||||||
; Make a file with only rev # in it
|
; Make a file with only rev # in it
|
||||||
Exec "..\Source\Core\Common\SubWCRev.exe ..\ svnrev_template.txt svnrev.txt"
|
Exec "..\Source\Core\Common\SubWCRev.exe ..\ svnrev_template.txt svnrev.txt"
|
||||||
SectionEnd
|
SectionEnd
|
|
@ -29,7 +29,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -318,7 +318,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -388,7 +388,7 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
CommandLine=""$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\src\svnrev_template.h" "$(ProjectDir)\src\svnrev.h""
|
CommandLine="set outfile="$(ProjectDir)\Src\svnrev.h"
"$(ProjectDir)SubWCRev.exe" "$(SolutionDir)\." "$(ProjectDir)\Src\svnrev_template.h" %outfile%
if errorlevel 1 (goto checkhg) else (goto VCEnd)
:checkhg
for /f "usebackq tokens=1,* skip=3" %%i in (`hg svn info`) do (
echo Hg: Working copy at SVN revision %%j
echo #define SVN_REV %%j > %outfile%
echo #define SVN_REV_STR "%%j" >> %outfile%
goto VCEnd
)
"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
|
|
@ -1,130 +1,130 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "../Core.h"
|
#include "../Core.h"
|
||||||
|
|
||||||
#include "EXI_Device.h"
|
#include "EXI_Device.h"
|
||||||
#include "EXI_DeviceAMBaseboard.h"
|
#include "EXI_DeviceAMBaseboard.h"
|
||||||
|
|
||||||
CEXIAMBaseboard::CEXIAMBaseboard()
|
CEXIAMBaseboard::CEXIAMBaseboard()
|
||||||
: m_position(0)
|
: m_position(0)
|
||||||
, m_have_irq(false)
|
, m_have_irq(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIAMBaseboard::SetCS(int cs)
|
void CEXIAMBaseboard::SetCS(int cs)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "AM-BB ChipSelect=%d", cs);
|
ERROR_LOG(SP1, "AM-BB ChipSelect=%d", cs);
|
||||||
if (cs)
|
if (cs)
|
||||||
m_position = 0;
|
m_position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEXIAMBaseboard::IsPresent()
|
bool CEXIAMBaseboard::IsPresent()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIAMBaseboard::TransferByte(u8& _byte)
|
void CEXIAMBaseboard::TransferByte(u8& _byte)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
ID:
|
ID:
|
||||||
00 00 xx xx xx xx
|
00 00 xx xx xx xx
|
||||||
xx xx 06 04 10 00
|
xx xx 06 04 10 00
|
||||||
CMD:
|
CMD:
|
||||||
01 00 00 b3 xx
|
01 00 00 b3 xx
|
||||||
xx xx xx xx 04
|
xx xx xx xx 04
|
||||||
exi_lanctl_write:
|
exi_lanctl_write:
|
||||||
ff 02 01 63 xx
|
ff 02 01 63 xx
|
||||||
xx xx xx xx 04
|
xx xx xx xx 04
|
||||||
exi_imr_read:
|
exi_imr_read:
|
||||||
86 00 00 f5 xx xx xx
|
86 00 00 f5 xx xx xx
|
||||||
xx xx xx xx 04 rr rr
|
xx xx xx xx 04 rr rr
|
||||||
exi_imr_write:
|
exi_imr_write:
|
||||||
87 80 5c 17 xx
|
87 80 5c 17 xx
|
||||||
xx xx xx xx 04
|
xx xx xx xx 04
|
||||||
|
|
||||||
exi_isr_read:
|
exi_isr_read:
|
||||||
82 .. .. .. xx xx xx
|
82 .. .. .. xx xx xx
|
||||||
xx xx xx xx 04 rr rr
|
xx xx xx xx 04 rr rr
|
||||||
3 byte command, 1 byte checksum
|
3 byte command, 1 byte checksum
|
||||||
*/
|
*/
|
||||||
DEBUG_LOG(SP1, "AM-BB > %02x", _byte);
|
DEBUG_LOG(SP1, "AM-BB > %02x", _byte);
|
||||||
if (m_position < 4)
|
if (m_position < 4)
|
||||||
{
|
{
|
||||||
m_command[m_position] = _byte;
|
m_command[m_position] = _byte;
|
||||||
_byte = 0xFF;
|
_byte = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_position >= 2) && (m_command[0] == 0 && m_command[1] == 0))
|
if ((m_position >= 2) && (m_command[0] == 0 && m_command[1] == 0))
|
||||||
_byte = "\x06\x04\x10\x00"[(m_position-2)&3];
|
_byte = "\x06\x04\x10\x00"[(m_position-2)&3];
|
||||||
else if (m_position == 3)
|
else if (m_position == 3)
|
||||||
{
|
{
|
||||||
unsigned int checksum = (m_command[0] << 24) | (m_command[1] << 16) | (m_command[2] << 8);
|
unsigned int checksum = (m_command[0] << 24) | (m_command[1] << 16) | (m_command[2] << 8);
|
||||||
unsigned int bit = 0x80000000UL;
|
unsigned int bit = 0x80000000UL;
|
||||||
unsigned int check = 0x8D800000UL;
|
unsigned int check = 0x8D800000UL;
|
||||||
while (bit >= 0x100)
|
while (bit >= 0x100)
|
||||||
{
|
{
|
||||||
if (checksum & bit)
|
if (checksum & bit)
|
||||||
checksum ^= check;
|
checksum ^= check;
|
||||||
check >>= 1;
|
check >>= 1;
|
||||||
bit >>= 1;
|
bit >>= 1;
|
||||||
}
|
}
|
||||||
if (m_command[3] != (checksum & 0xFF))
|
if (m_command[3] != (checksum & 0xFF))
|
||||||
ERROR_LOG(SP1, "AM-BB cs: %02x, w: %02x", m_command[3], checksum & 0xFF);
|
ERROR_LOG(SP1, "AM-BB cs: %02x, w: %02x", m_command[3], checksum & 0xFF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_position == 4)
|
if (m_position == 4)
|
||||||
{
|
{
|
||||||
_byte = 4;
|
_byte = 4;
|
||||||
ERROR_LOG(SP1, "AM-BB COMMAND: %02x %02x %02x", m_command[0], m_command[1], m_command[2]);
|
ERROR_LOG(SP1, "AM-BB COMMAND: %02x %02x %02x", m_command[0], m_command[1], m_command[2]);
|
||||||
if ((m_command[0] == 0xFF) && (m_command[1] == 0) && (m_command[2] == 0))
|
if ((m_command[0] == 0xFF) && (m_command[1] == 0) && (m_command[2] == 0))
|
||||||
m_have_irq = true;
|
m_have_irq = true;
|
||||||
else if (m_command[0] == 0x82)
|
else if (m_command[0] == 0x82)
|
||||||
m_have_irq = false;
|
m_have_irq = false;
|
||||||
}
|
}
|
||||||
else if (m_position > 4)
|
else if (m_position > 4)
|
||||||
{
|
{
|
||||||
switch (m_command[0])
|
switch (m_command[0])
|
||||||
{
|
{
|
||||||
case 0xFF: // lan
|
case 0xFF: // lan
|
||||||
_byte = 0xFF;
|
_byte = 0xFF;
|
||||||
break;
|
break;
|
||||||
case 0x86: // imr
|
case 0x86: // imr
|
||||||
_byte = 0x00;
|
_byte = 0x00;
|
||||||
break;
|
break;
|
||||||
case 0x82: // isr
|
case 0x82: // isr
|
||||||
_byte = m_have_irq ? 0xFF : 0;
|
_byte = m_have_irq ? 0xFF : 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_dbg_assert_msg_(SP1, 0, "Unknown AM-BB cmd");
|
_dbg_assert_msg_(SP1, 0, "Unknown AM-BB cmd");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_byte = 0xFF;
|
_byte = 0xFF;
|
||||||
}
|
}
|
||||||
DEBUG_LOG(SP1, "AM-BB < %02x", _byte);
|
DEBUG_LOG(SP1, "AM-BB < %02x", _byte);
|
||||||
m_position++;
|
m_position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEXIAMBaseboard::IsInterruptSet()
|
bool CEXIAMBaseboard::IsInterruptSet()
|
||||||
{
|
{
|
||||||
if (m_have_irq)
|
if (m_have_irq)
|
||||||
ERROR_LOG(SP1, "AM-BB IRQ");
|
ERROR_LOG(SP1, "AM-BB IRQ");
|
||||||
return m_have_irq;
|
return m_have_irq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _EXIDEVICE_AMBASEBOARD_H
|
#ifndef _EXIDEVICE_AMBASEBOARD_H
|
||||||
#define _EXIDEVICE_AMBASEBOARD_H
|
#define _EXIDEVICE_AMBASEBOARD_H
|
||||||
|
|
||||||
class CEXIAMBaseboard : public IEXIDevice
|
class CEXIAMBaseboard : public IEXIDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CEXIAMBaseboard();
|
CEXIAMBaseboard();
|
||||||
|
|
||||||
virtual void SetCS(int _iCS);
|
virtual void SetCS(int _iCS);
|
||||||
virtual bool IsPresent();
|
virtual bool IsPresent();
|
||||||
virtual bool IsInterruptSet();
|
virtual bool IsInterruptSet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void TransferByte(u8& _uByte);
|
virtual void TransferByte(u8& _uByte);
|
||||||
int m_position;
|
int m_position;
|
||||||
bool m_have_irq;
|
bool m_have_irq;
|
||||||
unsigned char m_command[4];
|
unsigned char m_command[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,470 +1,470 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "SI.h"
|
#include "SI.h"
|
||||||
#include "SI_Device.h"
|
#include "SI_Device.h"
|
||||||
#include "SI_DeviceAMBaseboard.h"
|
#include "SI_DeviceAMBaseboard.h"
|
||||||
|
|
||||||
#include "../PluginManager.h" // for pad state
|
#include "../PluginManager.h" // for pad state
|
||||||
|
|
||||||
// where to put baseboard debug
|
// where to put baseboard debug
|
||||||
#define AMBASEBOARDDEBUG OSREPORT
|
#define AMBASEBOARDDEBUG OSREPORT
|
||||||
|
|
||||||
// "JAMMA Video Standard" I/O
|
// "JAMMA Video Standard" I/O
|
||||||
class JVSIOMessage
|
class JVSIOMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_ptr, m_last_start, m_csum;
|
int m_ptr, m_last_start, m_csum;
|
||||||
unsigned char m_msg[0x80];
|
unsigned char m_msg[0x80];
|
||||||
|
|
||||||
JVSIOMessage()
|
JVSIOMessage()
|
||||||
{
|
{
|
||||||
m_ptr = 0;
|
m_ptr = 0;
|
||||||
m_last_start = 0;
|
m_last_start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void start(int node)
|
void start(int node)
|
||||||
{
|
{
|
||||||
m_last_start = m_ptr;
|
m_last_start = m_ptr;
|
||||||
unsigned char hdr[3] = {0xe0, node, 0};
|
unsigned char hdr[3] = {0xe0, node, 0};
|
||||||
m_csum = 0;
|
m_csum = 0;
|
||||||
addData(hdr, 3, 1);
|
addData(hdr, 3, 1);
|
||||||
}
|
}
|
||||||
void addData(const void *data, size_t len)
|
void addData(const void *data, size_t len)
|
||||||
{
|
{
|
||||||
addData((const unsigned char*)data, len);
|
addData((const unsigned char*)data, len);
|
||||||
}
|
}
|
||||||
void addData(const char *data)
|
void addData(const char *data)
|
||||||
{
|
{
|
||||||
addData(data, strlen(data));
|
addData(data, strlen(data));
|
||||||
}
|
}
|
||||||
void addData(int n)
|
void addData(int n)
|
||||||
{
|
{
|
||||||
unsigned char cs = n;
|
unsigned char cs = n;
|
||||||
addData(&cs, 1);
|
addData(&cs, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void end()
|
void end()
|
||||||
{
|
{
|
||||||
int len = m_ptr - m_last_start;
|
int len = m_ptr - m_last_start;
|
||||||
m_msg[m_last_start + 2] = len - 2; // assuming len <0xD0
|
m_msg[m_last_start + 2] = len - 2; // assuming len <0xD0
|
||||||
addData(m_csum + len - 2);
|
addData(m_csum + len - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addData(const unsigned char *dst, size_t len, int sync = 0)
|
void addData(const unsigned char *dst, size_t len, int sync = 0)
|
||||||
{
|
{
|
||||||
while (len--)
|
while (len--)
|
||||||
{
|
{
|
||||||
int c = *dst++;
|
int c = *dst++;
|
||||||
if (!sync && ((c == 0xE0) || (c == 0xD0)))
|
if (!sync && ((c == 0xE0) || (c == 0xD0)))
|
||||||
{
|
{
|
||||||
m_msg[m_ptr++] = 0xD0;
|
m_msg[m_ptr++] = 0xD0;
|
||||||
m_msg[m_ptr++] = c - 1;
|
m_msg[m_ptr++] = c - 1;
|
||||||
} else
|
} else
|
||||||
m_msg[m_ptr++] = c;
|
m_msg[m_ptr++] = c;
|
||||||
if (!sync)
|
if (!sync)
|
||||||
m_csum += c;
|
m_csum += c;
|
||||||
sync = 0;
|
sync = 0;
|
||||||
if (m_ptr >= 0x80)
|
if (m_ptr >= 0x80)
|
||||||
PanicAlert("JVSIOMessage overrun!");
|
PanicAlert("JVSIOMessage overrun!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; // end class JVSIOMessage
|
}; // end class JVSIOMessage
|
||||||
|
|
||||||
|
|
||||||
// AM-Baseboard device on SI
|
// AM-Baseboard device on SI
|
||||||
CSIDevice_AMBaseboard::CSIDevice_AMBaseboard(int _iDeviceNumber)
|
CSIDevice_AMBaseboard::CSIDevice_AMBaseboard(int _iDeviceNumber)
|
||||||
: ISIDevice(_iDeviceNumber)
|
: ISIDevice(_iDeviceNumber)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
|
int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
|
||||||
{
|
{
|
||||||
// for debug logging only
|
// for debug logging only
|
||||||
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
ISIDevice::RunBuffer(_pBuffer, _iLength);
|
||||||
|
|
||||||
int iPosition = 0;
|
int iPosition = 0;
|
||||||
while(iPosition < _iLength)
|
while(iPosition < _iLength)
|
||||||
{
|
{
|
||||||
// read the command
|
// read the command
|
||||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
|
||||||
iPosition ++;
|
iPosition ++;
|
||||||
|
|
||||||
// handle it
|
// handle it
|
||||||
switch(command)
|
switch(command)
|
||||||
{
|
{
|
||||||
case CMD_RESET: // returns ID and dip switches
|
case CMD_RESET: // returns ID and dip switches
|
||||||
{
|
{
|
||||||
*(u32*)&_pBuffer[0] = SI_AM_BASEBOARD|0x100; // 0x100 is progressive flag according to dip switch
|
*(u32*)&_pBuffer[0] = SI_AM_BASEBOARD|0x100; // 0x100 is progressive flag according to dip switch
|
||||||
iPosition = _iLength; // break the while loop
|
iPosition = _iLength; // break the while loop
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_GCAM:
|
case CMD_GCAM:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// calculate checksum over buffer
|
// calculate checksum over buffer
|
||||||
int csum = 0;
|
int csum = 0;
|
||||||
for (i=0; i<_iLength; ++i)
|
for (i=0; i<_iLength; ++i)
|
||||||
csum += _pBuffer[i];
|
csum += _pBuffer[i];
|
||||||
|
|
||||||
unsigned char res[0x80];
|
unsigned char res[0x80];
|
||||||
int resp = 0;
|
int resp = 0;
|
||||||
|
|
||||||
int real_len = _pBuffer[1^3];
|
int real_len = _pBuffer[1^3];
|
||||||
int p = 2;
|
int p = 2;
|
||||||
|
|
||||||
static int d10_1 = 0xfe;
|
static int d10_1 = 0xfe;
|
||||||
|
|
||||||
memset(res, 0, 0x80);
|
memset(res, 0, 0x80);
|
||||||
res[resp++] = 1;
|
res[resp++] = 1;
|
||||||
res[resp++] = 1;
|
res[resp++] = 1;
|
||||||
|
|
||||||
#define ptr(x) _pBuffer[(p + x)^3]
|
#define ptr(x) _pBuffer[(p + x)^3]
|
||||||
while (p < real_len+2)
|
while (p < real_len+2)
|
||||||
{
|
{
|
||||||
switch (ptr(0))
|
switch (ptr(0))
|
||||||
{
|
{
|
||||||
case 0x10:
|
case 0x10:
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 10, %02x (READ STATUS&SWITCHES)", ptr(1));
|
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 10, %02x (READ STATUS&SWITCHES)", ptr(1));
|
||||||
SPADStatus PadStatus;
|
SPADStatus PadStatus;
|
||||||
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
||||||
CPluginManager::GetInstance().GetPad(0)
|
CPluginManager::GetInstance().GetPad(0)
|
||||||
->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||||
res[resp++] = 0x10;
|
res[resp++] = 0x10;
|
||||||
res[resp++] = 0x2;
|
res[resp++] = 0x2;
|
||||||
int d10_0 = 0xdf;
|
int d10_0 = 0xdf;
|
||||||
|
|
||||||
if (PadStatus.triggerLeft)
|
if (PadStatus.triggerLeft)
|
||||||
d10_0 &= ~0x80;
|
d10_0 &= ~0x80;
|
||||||
if (PadStatus.triggerRight)
|
if (PadStatus.triggerRight)
|
||||||
d10_0 &= ~0x40;
|
d10_0 &= ~0x40;
|
||||||
|
|
||||||
res[resp++] = d10_0;
|
res[resp++] = d10_0;
|
||||||
res[resp++] = d10_1;
|
res[resp++] = d10_1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x12:
|
case 0x12:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 12, %02x %02x", ptr(1), ptr(2));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 12, %02x %02x", ptr(1), ptr(2));
|
||||||
res[resp++] = 0x12;
|
res[resp++] = 0x12;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
break;
|
break;
|
||||||
case 0x11:
|
case 0x11:
|
||||||
{
|
{
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 11, %02x (READ SERIAL NR)", ptr(1));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 11, %02x (READ SERIAL NR)", ptr(1));
|
||||||
char string[] = "AADE-01A14964511";
|
char string[] = "AADE-01A14964511";
|
||||||
res[resp++] = 0x11;
|
res[resp++] = 0x11;
|
||||||
res[resp++] = 0x10;
|
res[resp++] = 0x10;
|
||||||
memcpy(res + resp, string, 0x10);
|
memcpy(res + resp, string, 0x10);
|
||||||
resp += 0x10;
|
resp += 0x10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x15:
|
case 0x15:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 15, %02x (READ FIRM VERSION)", ptr(1));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 15, %02x (READ FIRM VERSION)", ptr(1));
|
||||||
res[resp++] = 0x15;
|
res[resp++] = 0x15;
|
||||||
res[resp++] = 0x02;
|
res[resp++] = 0x02;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
res[resp++] = 0x29; // FIRM VERSION
|
res[resp++] = 0x29; // FIRM VERSION
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 16, %02x (READ FPGA VERSION)", ptr(1));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 16, %02x (READ FPGA VERSION)", ptr(1));
|
||||||
res[resp++] = 0x16;
|
res[resp++] = 0x16;
|
||||||
res[resp++] = 0x02;
|
res[resp++] = 0x02;
|
||||||
res[resp++] = 0x07;
|
res[resp++] = 0x07;
|
||||||
res[resp++] = 0x06; // FPGAVERSION
|
res[resp++] = 0x06; // FPGAVERSION
|
||||||
/*
|
/*
|
||||||
res[resp++] = 0x16;
|
res[resp++] = 0x16;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
p += 2;
|
p += 2;
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case 0x1f:
|
case 0x1f:
|
||||||
{
|
{
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 1f, %02x %02x %02x %02x %02x (REGION)", ptr(1), ptr(2), ptr(3), ptr(4), ptr(5));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 1f, %02x %02x %02x %02x %02x (REGION)", ptr(1), ptr(2), ptr(3), ptr(4), ptr(5));
|
||||||
unsigned char string[] =
|
unsigned char string[] =
|
||||||
"\x00\x00\x30\x00"
|
"\x00\x00\x30\x00"
|
||||||
//"\x01\xfe\x00\x00" // JAPAN
|
//"\x01\xfe\x00\x00" // JAPAN
|
||||||
"\x02\xfd\x00\x00" // USA
|
"\x02\xfd\x00\x00" // USA
|
||||||
//"\x03\xfc\x00\x00" // export
|
//"\x03\xfc\x00\x00" // export
|
||||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
|
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
|
||||||
res[resp++] = 0x1f;
|
res[resp++] = 0x1f;
|
||||||
res[resp++] = 0x14;
|
res[resp++] = 0x14;
|
||||||
|
|
||||||
for (i=0; i<0x14; ++i)
|
for (i=0; i<0x14; ++i)
|
||||||
res[resp++] = string[i];
|
res[resp++] = string[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x31:
|
case 0x31:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 31 (UNKNOWN)");
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 31 (UNKNOWN)");
|
||||||
res[resp++] = 0x31;
|
res[resp++] = 0x31;
|
||||||
res[resp++] = 0x02;
|
res[resp++] = 0x02;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
break;
|
break;
|
||||||
case 0x32:
|
case 0x32:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 32 (UNKNOWN)");
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 32 (UNKNOWN)");
|
||||||
res[resp++] = 0x32;
|
res[resp++] = 0x32;
|
||||||
res[resp++] = 0x02;
|
res[resp++] = 0x02;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
res[resp++] = 0x00;
|
res[resp++] = 0x00;
|
||||||
break;
|
break;
|
||||||
case 0x40:
|
case 0x40:
|
||||||
case 0x41:
|
case 0x41:
|
||||||
case 0x42:
|
case 0x42:
|
||||||
case 0x43:
|
case 0x43:
|
||||||
case 0x44:
|
case 0x44:
|
||||||
case 0x45:
|
case 0x45:
|
||||||
case 0x46:
|
case 0x46:
|
||||||
case 0x47:
|
case 0x47:
|
||||||
case 0x48:
|
case 0x48:
|
||||||
case 0x49:
|
case 0x49:
|
||||||
case 0x4a:
|
case 0x4a:
|
||||||
case 0x4b:
|
case 0x4b:
|
||||||
case 0x4c:
|
case 0x4c:
|
||||||
case 0x4d:
|
case 0x4d:
|
||||||
case 0x4e:
|
case 0x4e:
|
||||||
case 0x4f:
|
case 0x4f:
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD %02x, %02x %02x %02x %02x %02x %02x %02x (JVS IO)",
|
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD %02x, %02x %02x %02x %02x %02x %02x %02x (JVS IO)",
|
||||||
ptr(0), ptr(1), ptr(2), ptr(3), ptr(4), ptr(5), ptr(6), ptr(7));
|
ptr(0), ptr(1), ptr(2), ptr(3), ptr(4), ptr(5), ptr(6), ptr(7));
|
||||||
int pptr = 2;
|
int pptr = 2;
|
||||||
JVSIOMessage msg;
|
JVSIOMessage msg;
|
||||||
|
|
||||||
msg.start(0);
|
msg.start(0);
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
|
|
||||||
unsigned char jvs_io_buffer[0x80];
|
unsigned char jvs_io_buffer[0x80];
|
||||||
int nr_bytes = ptr(pptr + 2); // byte after e0 xx
|
int nr_bytes = ptr(pptr + 2); // byte after e0 xx
|
||||||
int jvs_io_length = 0;
|
int jvs_io_length = 0;
|
||||||
for (i=0; i<nr_bytes + 3; ++i)
|
for (i=0; i<nr_bytes + 3; ++i)
|
||||||
jvs_io_buffer[jvs_io_length++] = ptr(pptr + i);
|
jvs_io_buffer[jvs_io_length++] = ptr(pptr + i);
|
||||||
int node = jvs_io_buffer[1];
|
int node = jvs_io_buffer[1];
|
||||||
|
|
||||||
unsigned char *jvs_io = jvs_io_buffer + 3;
|
unsigned char *jvs_io = jvs_io_buffer + 3;
|
||||||
jvs_io_length--; // checksum
|
jvs_io_length--; // checksum
|
||||||
while (jvs_io < (jvs_io_buffer + jvs_io_length))
|
while (jvs_io < (jvs_io_buffer + jvs_io_length))
|
||||||
{
|
{
|
||||||
|
|
||||||
int cmd = *jvs_io++;
|
int cmd = *jvs_io++;
|
||||||
int unknown = 0;
|
int unknown = 0;
|
||||||
DEBUG_LOG(AMBASEBOARDDEBUG, "JVS IO, node=%d, cmd=%02x", node, cmd);
|
DEBUG_LOG(AMBASEBOARDDEBUG, "JVS IO, node=%d, cmd=%02x", node, cmd);
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case 0x10: // get ID
|
case 0x10: // get ID
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
{
|
{
|
||||||
char buffer[12];
|
char buffer[12];
|
||||||
sprintf(buffer, "JVS-node %02x", node);
|
sprintf(buffer, "JVS-node %02x", node);
|
||||||
//msg.addData(buffer);
|
//msg.addData(buffer);
|
||||||
msg.addData("JAMMA I/O CONTROLLER");
|
msg.addData("JAMMA I/O CONTROLLER");
|
||||||
}
|
}
|
||||||
msg.addData(0);
|
msg.addData(0);
|
||||||
break;
|
break;
|
||||||
case 0x11: // cmd revision
|
case 0x11: // cmd revision
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
msg.addData(0x11);
|
msg.addData(0x11);
|
||||||
break;
|
break;
|
||||||
case 0x12: // jvs revision
|
case 0x12: // jvs revision
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
msg.addData(0x12);
|
msg.addData(0x12);
|
||||||
break;
|
break;
|
||||||
case 0x13: // com revision
|
case 0x13: // com revision
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
msg.addData(0x13);
|
msg.addData(0x13);
|
||||||
break;
|
break;
|
||||||
case 0x14: // get features
|
case 0x14: // get features
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
msg.addData((void *)"\x01\x02\x0a\x00", 4); // 2 player, 10 bit
|
msg.addData((void *)"\x01\x02\x0a\x00", 4); // 2 player, 10 bit
|
||||||
msg.addData((void *)"\x02\x02\x00\x00", 4); // 2 coin slots
|
msg.addData((void *)"\x02\x02\x00\x00", 4); // 2 coin slots
|
||||||
//msg.addData((void *)"\x03\x02\x08\x00", 4);
|
//msg.addData((void *)"\x03\x02\x08\x00", 4);
|
||||||
msg.addData((void *)"\x00\x00\x00\x00", 4);
|
msg.addData((void *)"\x00\x00\x00\x00", 4);
|
||||||
break;
|
break;
|
||||||
case 0x15:
|
case 0x15:
|
||||||
while (*jvs_io++);
|
while (*jvs_io++);
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
break;
|
break;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
{
|
{
|
||||||
int nr_players = *jvs_io++;
|
int nr_players = *jvs_io++;
|
||||||
int bytes_per_player = *jvs_io++; /* ??? */
|
int bytes_per_player = *jvs_io++; /* ??? */
|
||||||
int j;
|
int j;
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
|
|
||||||
msg.addData(0); // tilt
|
msg.addData(0); // tilt
|
||||||
for (i=0; i<nr_players; ++i)
|
for (i=0; i<nr_players; ++i)
|
||||||
{
|
{
|
||||||
SPADStatus PadStatus;
|
SPADStatus PadStatus;
|
||||||
CPluginManager::GetInstance().GetPad(0)
|
CPluginManager::GetInstance().GetPad(0)
|
||||||
->PAD_GetStatus(i, &PadStatus);
|
->PAD_GetStatus(i, &PadStatus);
|
||||||
unsigned char player_data[2] = {0,0};
|
unsigned char player_data[2] = {0,0};
|
||||||
if (PadStatus.button & PAD_BUTTON_START)
|
if (PadStatus.button & PAD_BUTTON_START)
|
||||||
player_data[0] |= 0x80;
|
player_data[0] |= 0x80;
|
||||||
if (PadStatus.button & PAD_BUTTON_UP)
|
if (PadStatus.button & PAD_BUTTON_UP)
|
||||||
player_data[0] |= 0x20;
|
player_data[0] |= 0x20;
|
||||||
if (PadStatus.button & PAD_BUTTON_DOWN)
|
if (PadStatus.button & PAD_BUTTON_DOWN)
|
||||||
player_data[0] |= 0x10;
|
player_data[0] |= 0x10;
|
||||||
if (PadStatus.button & PAD_BUTTON_LEFT)
|
if (PadStatus.button & PAD_BUTTON_LEFT)
|
||||||
player_data[0] |= 0x08;
|
player_data[0] |= 0x08;
|
||||||
if (PadStatus.button & PAD_BUTTON_RIGHT)
|
if (PadStatus.button & PAD_BUTTON_RIGHT)
|
||||||
player_data[0] |= 0x04;
|
player_data[0] |= 0x04;
|
||||||
|
|
||||||
if (PadStatus.button & PAD_BUTTON_A)
|
if (PadStatus.button & PAD_BUTTON_A)
|
||||||
player_data[0] |= 0x02;
|
player_data[0] |= 0x02;
|
||||||
if (PadStatus.button & PAD_BUTTON_B)
|
if (PadStatus.button & PAD_BUTTON_B)
|
||||||
player_data[0] |= 0x01;
|
player_data[0] |= 0x01;
|
||||||
|
|
||||||
if (PadStatus.button & PAD_BUTTON_X)
|
if (PadStatus.button & PAD_BUTTON_X)
|
||||||
player_data[1] |= 0x80;
|
player_data[1] |= 0x80;
|
||||||
if (PadStatus.button & PAD_BUTTON_Y)
|
if (PadStatus.button & PAD_BUTTON_Y)
|
||||||
player_data[1] |= 0x40;
|
player_data[1] |= 0x40;
|
||||||
if (PadStatus.button & PAD_TRIGGER_L)
|
if (PadStatus.button & PAD_TRIGGER_L)
|
||||||
player_data[1] |= 0x20;
|
player_data[1] |= 0x20;
|
||||||
if (PadStatus.button & PAD_TRIGGER_R)
|
if (PadStatus.button & PAD_TRIGGER_R)
|
||||||
player_data[1] |= 0x10;
|
player_data[1] |= 0x10;
|
||||||
|
|
||||||
for (j=0; j<bytes_per_player; ++j)
|
for (j=0; j<bytes_per_player; ++j)
|
||||||
msg.addData(player_data[j&1]);
|
msg.addData(player_data[j&1]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x21: // coin
|
case 0x21: // coin
|
||||||
{
|
{
|
||||||
int slots = *jvs_io++;
|
int slots = *jvs_io++;
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
SPADStatus PadStatus;
|
SPADStatus PadStatus;
|
||||||
CPluginManager::GetInstance().GetPad(0)
|
CPluginManager::GetInstance().GetPad(0)
|
||||||
->PAD_GetStatus(0, &PadStatus);
|
->PAD_GetStatus(0, &PadStatus);
|
||||||
while (slots--)
|
while (slots--)
|
||||||
{
|
{
|
||||||
msg.addData(0);
|
msg.addData(0);
|
||||||
msg.addData((PadStatus.button & PAD_BUTTON_START) ? 1 : 0);
|
msg.addData((PadStatus.button & PAD_BUTTON_START) ? 1 : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x22: // analog
|
case 0x22: // analog
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xf0:
|
case 0xf0:
|
||||||
if (*jvs_io++ == 0xD9)
|
if (*jvs_io++ == 0xD9)
|
||||||
{
|
{
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "JVS RESET");
|
ERROR_LOG(AMBASEBOARDDEBUG, "JVS RESET");
|
||||||
} else
|
} else
|
||||||
unknown = 1;
|
unknown = 1;
|
||||||
msg.addData(1);
|
msg.addData(1);
|
||||||
|
|
||||||
d10_1 |= 1;
|
d10_1 |= 1;
|
||||||
break;
|
break;
|
||||||
case 0xf1:
|
case 0xf1:
|
||||||
node = *jvs_io++;
|
node = *jvs_io++;
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "JVS SET ADDRESS, node=%d", node);
|
ERROR_LOG(AMBASEBOARDDEBUG, "JVS SET ADDRESS, node=%d", node);
|
||||||
msg.addData(node == 1);
|
msg.addData(node == 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pptr += jvs_io_length;
|
pptr += jvs_io_length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.end();
|
msg.end();
|
||||||
|
|
||||||
res[resp++] = ptr(0);
|
res[resp++] = ptr(0);
|
||||||
|
|
||||||
unsigned char *buf = msg.m_msg;
|
unsigned char *buf = msg.m_msg;
|
||||||
int len = msg.m_ptr;
|
int len = msg.m_ptr;
|
||||||
res[resp++] = len;
|
res[resp++] = len;
|
||||||
for (i=0; i<len; ++i)
|
for (i=0; i<len; ++i)
|
||||||
res[resp++] = buf[i];
|
res[resp++] = buf[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x60:
|
case 0x60:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 60, %02x %02x %02x", ptr(1), ptr(2), ptr(3));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 60, %02x %02x %02x", ptr(1), ptr(2), ptr(3));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD %02x (unknown) %02x %02x %02x %02x %02x", ptr(0), ptr(1), ptr(2), ptr(3), ptr(4), ptr(5));
|
ERROR_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD %02x (unknown) %02x %02x %02x %02x %02x", ptr(0), ptr(1), ptr(2), ptr(3), ptr(4), ptr(5));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p += ptr(1) + 2;
|
p += ptr(1) + 2;
|
||||||
}
|
}
|
||||||
memset(_pBuffer, 0, _iLength);
|
memset(_pBuffer, 0, _iLength);
|
||||||
|
|
||||||
int len = resp - 2;
|
int len = resp - 2;
|
||||||
|
|
||||||
p = 0;
|
p = 0;
|
||||||
res[1] = len;
|
res[1] = len;
|
||||||
csum = 0;
|
csum = 0;
|
||||||
char logptr[1024];
|
char logptr[1024];
|
||||||
char *log = logptr;
|
char *log = logptr;
|
||||||
for (i=0; i<0x7F; ++i)
|
for (i=0; i<0x7F; ++i)
|
||||||
{
|
{
|
||||||
csum += ptr(i) = res[i];
|
csum += ptr(i) = res[i];
|
||||||
log += sprintf(log, "%02x ", ptr(i));
|
log += sprintf(log, "%02x ", ptr(i));
|
||||||
}
|
}
|
||||||
ptr(0x7f) = ~csum;
|
ptr(0x7f) = ~csum;
|
||||||
DEBUG_LOG(AMBASEBOARDDEBUG, "command send back: %s", logptr);
|
DEBUG_LOG(AMBASEBOARDDEBUG, "command send back: %s", logptr);
|
||||||
#undef ptr
|
#undef ptr
|
||||||
|
|
||||||
|
|
||||||
// (tmbinc) hotfix: delay output by one command to work around their broken parser. this took me a month to find. ARG!
|
// (tmbinc) hotfix: delay output by one command to work around their broken parser. this took me a month to find. ARG!
|
||||||
static unsigned char last[2][0x80];
|
static unsigned char last[2][0x80];
|
||||||
static int lastptr[2];
|
static int lastptr[2];
|
||||||
|
|
||||||
{
|
{
|
||||||
memcpy(last + 1, _pBuffer, 0x80);
|
memcpy(last + 1, _pBuffer, 0x80);
|
||||||
memcpy(_pBuffer, last, 0x80);
|
memcpy(_pBuffer, last, 0x80);
|
||||||
memcpy(last, last + 1, 0x80);
|
memcpy(last, last + 1, 0x80);
|
||||||
|
|
||||||
lastptr[1] = _iLength;
|
lastptr[1] = _iLength;
|
||||||
_iLength = lastptr[0];
|
_iLength = lastptr[0];
|
||||||
lastptr[0] = lastptr[1];
|
lastptr[0] = lastptr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
iPosition = _iLength;
|
iPosition = _iLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// DEFAULT
|
// DEFAULT
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ERROR_LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command);
|
ERROR_LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command);
|
||||||
PanicAlert("SI: Unknown command");
|
PanicAlert("SI: Unknown command");
|
||||||
iPosition = _iLength;
|
iPosition = _iLength;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iPosition;
|
return iPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not really used on GC-AM
|
// Not really used on GC-AM
|
||||||
bool CSIDevice_AMBaseboard::GetData(u32& _Hi, u32& _Low)
|
bool CSIDevice_AMBaseboard::GetData(u32& _Hi, u32& _Low)
|
||||||
{
|
{
|
||||||
_Low = 0;
|
_Low = 0;
|
||||||
_Hi = 0x00800000;
|
_Hi = 0x00800000;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSIDevice_AMBaseboard::SendCommand(u32 _Cmd, u8 _Poll)
|
void CSIDevice_AMBaseboard::SendCommand(u32 _Cmd, u8 _Poll)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SERIALINTERFACE, "unknown direct command (0x%x)", _Cmd);
|
ERROR_LOG(SERIALINTERFACE, "unknown direct command (0x%x)", _Cmd);
|
||||||
PanicAlert("SI: (GCAM) Unknown direct command");
|
PanicAlert("SI: (GCAM) Unknown direct command");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _SIDEVICE_AMBASEBOARD_H
|
#ifndef _SIDEVICE_AMBASEBOARD_H
|
||||||
#define _SIDEVICE_AMBASEBOARD_H
|
#define _SIDEVICE_AMBASEBOARD_H
|
||||||
|
|
||||||
// triforce (GC-AM) baseboard
|
// triforce (GC-AM) baseboard
|
||||||
class CSIDevice_AMBaseboard : public ISIDevice
|
class CSIDevice_AMBaseboard : public ISIDevice
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum EBufferCommands
|
enum EBufferCommands
|
||||||
{
|
{
|
||||||
CMD_RESET = 0x00,
|
CMD_RESET = 0x00,
|
||||||
CMD_GCAM = 0x70,
|
CMD_GCAM = 0x70,
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
CSIDevice_AMBaseboard(int _iDeviceNumber);
|
CSIDevice_AMBaseboard(int _iDeviceNumber);
|
||||||
|
|
||||||
// run the SI Buffer
|
// run the SI Buffer
|
||||||
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
virtual int RunBuffer(u8* _pBuffer, int _iLength);
|
||||||
|
|
||||||
// return true on new data
|
// return true on new data
|
||||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||||
|
|
||||||
// send a command directly
|
// send a command directly
|
||||||
virtual void SendCommand(u32 _Cmd, u8 _Poll);
|
virtual void SendCommand(u32 _Cmd, u8 _Poll);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SIDEVICE_AMBASEBOARD_H
|
#endif // _SIDEVICE_AMBASEBOARD_H
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
// Adapted from in_cube by hcs & destop
|
// Adapted from in_cube by hcs & destop
|
||||||
|
|
||||||
#ifndef _STREAMADPCM_H
|
#ifndef _STREAMADPCM_H
|
||||||
#define _STREAMADPCM_H
|
#define _STREAMADPCM_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
class NGCADPCM
|
class NGCADPCM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitFilter();
|
static void InitFilter();
|
||||||
static void DecodeBlock(short *pcm, const u8 *adpcm);
|
static void DecodeBlock(short *pcm, const u8 *adpcm);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
#ifndef _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
#ifndef _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
||||||
#define _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
#define _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_usb_kbd : public IWII_IPC_HLE_Device
|
class CWII_IPC_HLE_Device_usb_kbd : public IWII_IPC_HLE_Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID, const std::string& _rDeviceName);
|
CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID, const std::string& _rDeviceName);
|
||||||
virtual ~CWII_IPC_HLE_Device_usb_kbd();
|
virtual ~CWII_IPC_HLE_Device_usb_kbd();
|
||||||
|
|
||||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||||
virtual bool Close(u32 _CommandAddress, bool _bForce);
|
virtual bool Close(u32 _CommandAddress, bool _bForce);
|
||||||
virtual bool Write(u32 _CommandAddress);
|
virtual bool Write(u32 _CommandAddress);
|
||||||
virtual bool IOCtl(u32 _CommandAddress);
|
virtual bool IOCtl(u32 _CommandAddress);
|
||||||
virtual u32 Update();
|
virtual u32 Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MSG_KBD_CONNECT = 0,
|
MSG_KBD_CONNECT = 0,
|
||||||
MSG_KBD_DISCONNECT,
|
MSG_KBD_DISCONNECT,
|
||||||
MSG_EVENT
|
MSG_EVENT
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct SMessageData
|
struct SMessageData
|
||||||
{
|
{
|
||||||
u32 MsgType;
|
u32 MsgType;
|
||||||
u32 Unk1;
|
u32 Unk1;
|
||||||
u8 Modifiers;
|
u8 Modifiers;
|
||||||
u8 Unk2;
|
u8 Unk2;
|
||||||
u8 PressedKeys[6];
|
u8 PressedKeys[6];
|
||||||
|
|
||||||
SMessageData(u32 _MsgType, u8 _Modifiers, u8 *_PressedKeys) {
|
SMessageData(u32 _MsgType, u8 _Modifiers, u8 *_PressedKeys) {
|
||||||
MsgType = Common::swap32(_MsgType);
|
MsgType = Common::swap32(_MsgType);
|
||||||
Unk1 = 0; // swapped
|
Unk1 = 0; // swapped
|
||||||
Modifiers = _Modifiers;
|
Modifiers = _Modifiers;
|
||||||
Unk2 = 0;
|
Unk2 = 0;
|
||||||
|
|
||||||
if (_PressedKeys) // Doesn't need to be in a specific order
|
if (_PressedKeys) // Doesn't need to be in a specific order
|
||||||
memcpy(PressedKeys, _PressedKeys, sizeof(PressedKeys));
|
memcpy(PressedKeys, _PressedKeys, sizeof(PressedKeys));
|
||||||
else
|
else
|
||||||
memset(PressedKeys, 0, sizeof(PressedKeys));
|
memset(PressedKeys, 0, sizeof(PressedKeys));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
std::queue<SMessageData> m_MessageQueue;
|
std::queue<SMessageData> m_MessageQueue;
|
||||||
|
|
||||||
bool m_OldKeyBuffer[256];
|
bool m_OldKeyBuffer[256];
|
||||||
u8 m_OldModifiers;
|
u8 m_OldModifiers;
|
||||||
|
|
||||||
virtual bool IsKeyPressed(int _Key);
|
virtual bool IsKeyPressed(int _Key);
|
||||||
|
|
||||||
// This stuff should probably die
|
// This stuff should probably die
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
KBD_LAYOUT_QWERTY = 0,
|
KBD_LAYOUT_QWERTY = 0,
|
||||||
KBD_LAYOUT_AZERTY
|
KBD_LAYOUT_AZERTY
|
||||||
};
|
};
|
||||||
int m_KeyboardLayout;
|
int m_KeyboardLayout;
|
||||||
static u8 m_KeyCodesQWERTY[256];
|
static u8 m_KeyCodesQWERTY[256];
|
||||||
static u8 m_KeyCodesAZERTY[256];
|
static u8 m_KeyCodesAZERTY[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
#endif // _WII_IPC_HLE_DEVICE_USB_KBD_H_
|
||||||
|
|
|
@ -1,114 +1,114 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef __LUA_INTERFACE_H
|
#ifndef __LUA_INTERFACE_H
|
||||||
#define __LUA_INTERFACE_H
|
#define __LUA_INTERFACE_H
|
||||||
|
|
||||||
namespace Lua {
|
namespace Lua {
|
||||||
|
|
||||||
void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0);
|
void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0);
|
||||||
void RunLuaScriptFile(int uid, const char* filename);
|
void RunLuaScriptFile(int uid, const char* filename);
|
||||||
void StopLuaScript(int uid);
|
void StopLuaScript(int uid);
|
||||||
void RequestAbortLuaScript(int uid, const char* message = 0);
|
void RequestAbortLuaScript(int uid, const char* message = 0);
|
||||||
void CloseLuaContext(int uid);
|
void CloseLuaContext(int uid);
|
||||||
|
|
||||||
enum LuaCallID
|
enum LuaCallID
|
||||||
{
|
{
|
||||||
LUACALL_BEFOREEMULATION,
|
LUACALL_BEFOREEMULATION,
|
||||||
LUACALL_AFTEREMULATION,
|
LUACALL_AFTEREMULATION,
|
||||||
LUACALL_AFTEREMULATIONGUI,
|
LUACALL_AFTEREMULATIONGUI,
|
||||||
LUACALL_BEFOREEXIT,
|
LUACALL_BEFOREEXIT,
|
||||||
LUACALL_BEFORESAVE,
|
LUACALL_BEFORESAVE,
|
||||||
LUACALL_AFTERLOAD,
|
LUACALL_AFTERLOAD,
|
||||||
LUACALL_ONSTART,
|
LUACALL_ONSTART,
|
||||||
|
|
||||||
LUACALL_SCRIPT_HOTKEY_1,
|
LUACALL_SCRIPT_HOTKEY_1,
|
||||||
LUACALL_SCRIPT_HOTKEY_2,
|
LUACALL_SCRIPT_HOTKEY_2,
|
||||||
LUACALL_SCRIPT_HOTKEY_3,
|
LUACALL_SCRIPT_HOTKEY_3,
|
||||||
LUACALL_SCRIPT_HOTKEY_4,
|
LUACALL_SCRIPT_HOTKEY_4,
|
||||||
LUACALL_SCRIPT_HOTKEY_5,
|
LUACALL_SCRIPT_HOTKEY_5,
|
||||||
LUACALL_SCRIPT_HOTKEY_6,
|
LUACALL_SCRIPT_HOTKEY_6,
|
||||||
LUACALL_SCRIPT_HOTKEY_7,
|
LUACALL_SCRIPT_HOTKEY_7,
|
||||||
LUACALL_SCRIPT_HOTKEY_8,
|
LUACALL_SCRIPT_HOTKEY_8,
|
||||||
LUACALL_SCRIPT_HOTKEY_9,
|
LUACALL_SCRIPT_HOTKEY_9,
|
||||||
LUACALL_SCRIPT_HOTKEY_10,
|
LUACALL_SCRIPT_HOTKEY_10,
|
||||||
LUACALL_SCRIPT_HOTKEY_11,
|
LUACALL_SCRIPT_HOTKEY_11,
|
||||||
LUACALL_SCRIPT_HOTKEY_12,
|
LUACALL_SCRIPT_HOTKEY_12,
|
||||||
LUACALL_SCRIPT_HOTKEY_13,
|
LUACALL_SCRIPT_HOTKEY_13,
|
||||||
LUACALL_SCRIPT_HOTKEY_14,
|
LUACALL_SCRIPT_HOTKEY_14,
|
||||||
LUACALL_SCRIPT_HOTKEY_15,
|
LUACALL_SCRIPT_HOTKEY_15,
|
||||||
LUACALL_SCRIPT_HOTKEY_16,
|
LUACALL_SCRIPT_HOTKEY_16,
|
||||||
|
|
||||||
LUACALL_COUNT
|
LUACALL_COUNT
|
||||||
};
|
};
|
||||||
void CallRegisteredLuaFunctions(LuaCallID calltype);
|
void CallRegisteredLuaFunctions(LuaCallID calltype);
|
||||||
|
|
||||||
enum LuaMemHookType
|
enum LuaMemHookType
|
||||||
{
|
{
|
||||||
LUAMEMHOOK_WRITE,
|
LUAMEMHOOK_WRITE,
|
||||||
LUAMEMHOOK_READ,
|
LUAMEMHOOK_READ,
|
||||||
LUAMEMHOOK_EXEC,
|
LUAMEMHOOK_EXEC,
|
||||||
LUAMEMHOOK_WRITE_SUB,
|
LUAMEMHOOK_WRITE_SUB,
|
||||||
LUAMEMHOOK_READ_SUB,
|
LUAMEMHOOK_READ_SUB,
|
||||||
LUAMEMHOOK_EXEC_SUB,
|
LUAMEMHOOK_EXEC_SUB,
|
||||||
|
|
||||||
LUAMEMHOOK_COUNT
|
LUAMEMHOOK_COUNT
|
||||||
};
|
};
|
||||||
void CallRegisteredLuaMemHook(unsigned int address, int size, unsigned int value, LuaMemHookType hookType);
|
void CallRegisteredLuaMemHook(unsigned int address, int size, unsigned int value, LuaMemHookType hookType);
|
||||||
|
|
||||||
struct LuaSaveData
|
struct LuaSaveData
|
||||||
{
|
{
|
||||||
LuaSaveData() { recordList = 0; }
|
LuaSaveData() { recordList = 0; }
|
||||||
~LuaSaveData() { ClearRecords(); }
|
~LuaSaveData() { ClearRecords(); }
|
||||||
|
|
||||||
struct Record
|
struct Record
|
||||||
{
|
{
|
||||||
unsigned int key; // crc32
|
unsigned int key; // crc32
|
||||||
unsigned int size; // size of data
|
unsigned int size; // size of data
|
||||||
unsigned char* data;
|
unsigned char* data;
|
||||||
Record* next;
|
Record* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
Record* recordList;
|
Record* recordList;
|
||||||
|
|
||||||
void SaveRecord(int uid, unsigned int key); // saves Lua stack into a record and pops it
|
void SaveRecord(int uid, unsigned int key); // saves Lua stack into a record and pops it
|
||||||
void LoadRecord(int uid, unsigned int key, unsigned int itemsToLoad) const; // pushes a record's data onto the Lua stack
|
void LoadRecord(int uid, unsigned int key, unsigned int itemsToLoad) const; // pushes a record's data onto the Lua stack
|
||||||
void SaveRecordPartial(int uid, unsigned int key, int idx); // saves part of the Lua stack (at the given index) into a record and does NOT pop anything
|
void SaveRecordPartial(int uid, unsigned int key, int idx); // saves part of the Lua stack (at the given index) into a record and does NOT pop anything
|
||||||
|
|
||||||
void ExportRecords(void* file) const; // writes all records to an already-open file
|
void ExportRecords(void* file) const; // writes all records to an already-open file
|
||||||
void ImportRecords(void* file); // reads records from an already-open file
|
void ImportRecords(void* file); // reads records from an already-open file
|
||||||
void ClearRecords(); // deletes all record data
|
void ClearRecords(); // deletes all record data
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// disallowed, it's dangerous to call this
|
// disallowed, it's dangerous to call this
|
||||||
// (because the memory the destructor deletes isn't refcounted and shouldn't need to be copied)
|
// (because the memory the destructor deletes isn't refcounted and shouldn't need to be copied)
|
||||||
// so pass LuaSaveDatas by reference and this should never get called
|
// so pass LuaSaveDatas by reference and this should never get called
|
||||||
LuaSaveData(const LuaSaveData& ) {}
|
LuaSaveData(const LuaSaveData& ) {}
|
||||||
};
|
};
|
||||||
void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData);
|
void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData);
|
||||||
void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData);
|
void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData);
|
||||||
|
|
||||||
void StopAllLuaScripts();
|
void StopAllLuaScripts();
|
||||||
void RestartAllLuaScripts();
|
void RestartAllLuaScripts();
|
||||||
void EnableStopAllLuaScripts(bool enable);
|
void EnableStopAllLuaScripts(bool enable);
|
||||||
void DontWorryLua();
|
void DontWorryLua();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,405 +1,405 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "OnFrame.h"
|
#include "OnFrame.h"
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
#include "PowerPC/PowerPC.h"
|
#include "PowerPC/PowerPC.h"
|
||||||
|
|
||||||
Common::CriticalSection cs_frameSkip;
|
Common::CriticalSection cs_frameSkip;
|
||||||
|
|
||||||
namespace Frame {
|
namespace Frame {
|
||||||
|
|
||||||
bool g_bFrameStep = false;
|
bool g_bFrameStep = false;
|
||||||
bool g_bFrameStop = false;
|
bool g_bFrameStop = false;
|
||||||
bool g_bAutoFire = false;
|
bool g_bAutoFire = false;
|
||||||
u32 g_autoFirstKey = 0, g_autoSecondKey = 0;
|
u32 g_autoFirstKey = 0, g_autoSecondKey = 0;
|
||||||
bool g_bFirstKey = true;
|
bool g_bFirstKey = true;
|
||||||
PlayMode g_playMode = MODE_NONE;
|
PlayMode g_playMode = MODE_NONE;
|
||||||
|
|
||||||
unsigned int g_framesToSkip = 0, g_frameSkipCounter = 0;
|
unsigned int g_framesToSkip = 0, g_frameSkipCounter = 0;
|
||||||
|
|
||||||
int g_numPads = 0;
|
int g_numPads = 0;
|
||||||
ControllerState *g_padStates;
|
ControllerState *g_padStates;
|
||||||
FILE *g_recordfd = NULL;
|
FILE *g_recordfd = NULL;
|
||||||
|
|
||||||
u64 g_frameCounter = 0, g_lagCounter = 0;
|
u64 g_frameCounter = 0, g_lagCounter = 0;
|
||||||
bool g_bPolled = false;
|
bool g_bPolled = false;
|
||||||
|
|
||||||
int g_numRerecords = 0;
|
int g_numRerecords = 0;
|
||||||
std::string g_recordFile;
|
std::string g_recordFile;
|
||||||
|
|
||||||
void FrameUpdate()
|
void FrameUpdate()
|
||||||
{
|
{
|
||||||
g_frameCounter++;
|
g_frameCounter++;
|
||||||
|
|
||||||
if(!g_bPolled)
|
if(!g_bPolled)
|
||||||
g_lagCounter++;
|
g_lagCounter++;
|
||||||
|
|
||||||
if (g_bFrameStep)
|
if (g_bFrameStep)
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
|
|
||||||
// ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily.
|
// ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily.
|
||||||
// after that we set it back to CPU_RUNNING and continue as normal.
|
// after that we set it back to CPU_RUNNING and continue as normal.
|
||||||
if (g_bFrameStop)
|
if (g_bFrameStop)
|
||||||
*PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING;
|
*PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING;
|
||||||
|
|
||||||
if(g_framesToSkip)
|
if(g_framesToSkip)
|
||||||
FrameSkipping();
|
FrameSkipping();
|
||||||
|
|
||||||
if (g_bAutoFire)
|
if (g_bAutoFire)
|
||||||
g_bFirstKey = !g_bFirstKey;
|
g_bFirstKey = !g_bFirstKey;
|
||||||
|
|
||||||
// Dump/Read all controllers' states for this frame
|
// Dump/Read all controllers' states for this frame
|
||||||
if(IsRecordingInput())
|
if(IsRecordingInput())
|
||||||
fwrite(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd);
|
fwrite(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd);
|
||||||
else if(IsPlayingInput()) {
|
else if(IsPlayingInput()) {
|
||||||
fread(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd);
|
fread(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd);
|
||||||
|
|
||||||
// End of recording
|
// End of recording
|
||||||
if(feof(g_recordfd))
|
if(feof(g_recordfd))
|
||||||
EndPlayInput();
|
EndPlayInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bPolled = false;
|
g_bPolled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrameSkipping(unsigned int framesToSkip)
|
void SetFrameSkipping(unsigned int framesToSkip)
|
||||||
{
|
{
|
||||||
cs_frameSkip.Enter();
|
cs_frameSkip.Enter();
|
||||||
|
|
||||||
g_framesToSkip = framesToSkip;
|
g_framesToSkip = framesToSkip;
|
||||||
g_frameSkipCounter = 0;
|
g_frameSkipCounter = 0;
|
||||||
|
|
||||||
// Don't forget to re-enable rendering in case it wasn't...
|
// Don't forget to re-enable rendering in case it wasn't...
|
||||||
// as this won't be changed anymore when frameskip is turned off
|
// as this won't be changed anymore when frameskip is turned off
|
||||||
if (framesToSkip == 0)
|
if (framesToSkip == 0)
|
||||||
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true);
|
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true);
|
||||||
|
|
||||||
cs_frameSkip.Leave();
|
cs_frameSkip.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FrameSkippingFactor()
|
int FrameSkippingFactor()
|
||||||
{
|
{
|
||||||
return g_framesToSkip;
|
return g_framesToSkip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPolledDevice()
|
void SetPolledDevice()
|
||||||
{
|
{
|
||||||
g_bPolled = true;
|
g_bPolled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAutoHold(bool bEnabled, u32 keyToHold)
|
void SetAutoHold(bool bEnabled, u32 keyToHold)
|
||||||
{
|
{
|
||||||
g_bAutoFire = bEnabled;
|
g_bAutoFire = bEnabled;
|
||||||
if (bEnabled)
|
if (bEnabled)
|
||||||
g_autoFirstKey = g_autoSecondKey = keyToHold;
|
g_autoFirstKey = g_autoSecondKey = keyToHold;
|
||||||
else
|
else
|
||||||
g_autoFirstKey = g_autoSecondKey = 0;
|
g_autoFirstKey = g_autoSecondKey = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAutoFire(bool bEnabled, u32 keyOne, u32 keyTwo)
|
void SetAutoFire(bool bEnabled, u32 keyOne, u32 keyTwo)
|
||||||
{
|
{
|
||||||
g_bAutoFire = bEnabled;
|
g_bAutoFire = bEnabled;
|
||||||
if (bEnabled) {
|
if (bEnabled) {
|
||||||
g_autoFirstKey = keyOne;
|
g_autoFirstKey = keyOne;
|
||||||
g_autoSecondKey = keyTwo;
|
g_autoSecondKey = keyTwo;
|
||||||
} else
|
} else
|
||||||
g_autoFirstKey = g_autoSecondKey = 0;
|
g_autoFirstKey = g_autoSecondKey = 0;
|
||||||
|
|
||||||
g_bFirstKey = true;
|
g_bFirstKey = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAutoFiring()
|
bool IsAutoFiring()
|
||||||
{
|
{
|
||||||
return g_bAutoFire;
|
return g_bAutoFire;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrameStepping(bool bEnabled)
|
void SetFrameStepping(bool bEnabled)
|
||||||
{
|
{
|
||||||
g_bFrameStep = bEnabled;
|
g_bFrameStep = bEnabled;
|
||||||
}
|
}
|
||||||
void SetFrameStopping(bool bEnabled) {
|
void SetFrameStopping(bool bEnabled) {
|
||||||
g_bFrameStop = bEnabled;
|
g_bFrameStop = bEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModifyController(SPADStatus *PadStatus, int controllerID)
|
void ModifyController(SPADStatus *PadStatus, int controllerID)
|
||||||
{
|
{
|
||||||
if(controllerID < 0)
|
if(controllerID < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u32 keyToPress = (g_bFirstKey) ? g_autoFirstKey : g_autoSecondKey;
|
u32 keyToPress = (g_bFirstKey) ? g_autoFirstKey : g_autoSecondKey;
|
||||||
|
|
||||||
if (!keyToPress)
|
if (!keyToPress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PadStatus->button |= keyToPress;
|
PadStatus->button |= keyToPress;
|
||||||
|
|
||||||
switch(keyToPress) {
|
switch(keyToPress) {
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PAD_BUTTON_A:
|
case PAD_BUTTON_A:
|
||||||
PadStatus->analogA = 255;
|
PadStatus->analogA = 255;
|
||||||
break;
|
break;
|
||||||
case PAD_BUTTON_B:
|
case PAD_BUTTON_B:
|
||||||
PadStatus->analogB = 255;
|
PadStatus->analogB = 255;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_TRIGGER_L:
|
case PAD_TRIGGER_L:
|
||||||
PadStatus->triggerLeft = 255;
|
PadStatus->triggerLeft = 255;
|
||||||
break;
|
break;
|
||||||
case PAD_TRIGGER_R:
|
case PAD_TRIGGER_R:
|
||||||
PadStatus->triggerRight = 255;
|
PadStatus->triggerRight = 255;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameSkipping()
|
void FrameSkipping()
|
||||||
{
|
{
|
||||||
cs_frameSkip.Enter();
|
cs_frameSkip.Enter();
|
||||||
|
|
||||||
g_frameSkipCounter++;
|
g_frameSkipCounter++;
|
||||||
if (g_frameSkipCounter > g_framesToSkip || Core::report_slow(g_frameSkipCounter) == false)
|
if (g_frameSkipCounter > g_framesToSkip || Core::report_slow(g_frameSkipCounter) == false)
|
||||||
g_frameSkipCounter = 0;
|
g_frameSkipCounter = 0;
|
||||||
|
|
||||||
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(!g_frameSkipCounter);
|
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(!g_frameSkipCounter);
|
||||||
|
|
||||||
cs_frameSkip.Leave();
|
cs_frameSkip.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsRecordingInput()
|
bool IsRecordingInput()
|
||||||
{
|
{
|
||||||
return (g_playMode == MODE_RECORDING);
|
return (g_playMode == MODE_RECORDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPlayingInput()
|
bool IsPlayingInput()
|
||||||
{
|
{
|
||||||
return (g_playMode == MODE_PLAYING);
|
return (g_playMode == MODE_PLAYING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add BeginRecordingFromSavestate
|
// TODO: Add BeginRecordingFromSavestate
|
||||||
bool BeginRecordingInput(const char *filename, int controllers)
|
bool BeginRecordingInput(const char *filename, int controllers)
|
||||||
{
|
{
|
||||||
if(!filename || g_playMode != MODE_NONE || g_recordfd)
|
if(!filename || g_playMode != MODE_NONE || g_recordfd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(File::Exists(filename))
|
if(File::Exists(filename))
|
||||||
File::Delete(filename);
|
File::Delete(filename);
|
||||||
|
|
||||||
g_recordfd = fopen(filename, "wb");
|
g_recordfd = fopen(filename, "wb");
|
||||||
if(!g_recordfd) {
|
if(!g_recordfd) {
|
||||||
PanicAlert("Error opening file %s for recording", filename);
|
PanicAlert("Error opening file %s for recording", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write initial empty header
|
// Write initial empty header
|
||||||
DTMHeader dummy;
|
DTMHeader dummy;
|
||||||
fwrite(&dummy, sizeof(DTMHeader), 1, g_recordfd);
|
fwrite(&dummy, sizeof(DTMHeader), 1, g_recordfd);
|
||||||
|
|
||||||
g_numPads = controllers;
|
g_numPads = controllers;
|
||||||
g_padStates = new ControllerState[controllers];
|
g_padStates = new ControllerState[controllers];
|
||||||
|
|
||||||
g_frameCounter = 0;
|
g_frameCounter = 0;
|
||||||
g_lagCounter = 0;
|
g_lagCounter = 0;
|
||||||
|
|
||||||
g_playMode = MODE_RECORDING;
|
g_playMode = MODE_RECORDING;
|
||||||
|
|
||||||
g_recordFile = filename;
|
g_recordFile = filename;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndRecordingInput()
|
void EndRecordingInput()
|
||||||
{
|
{
|
||||||
rewind(g_recordfd);
|
rewind(g_recordfd);
|
||||||
|
|
||||||
// Create the real header now and write it
|
// Create the real header now and write it
|
||||||
DTMHeader header;
|
DTMHeader header;
|
||||||
memset(&header, 0, sizeof(DTMHeader));
|
memset(&header, 0, sizeof(DTMHeader));
|
||||||
|
|
||||||
header.filetype[0] = 'D'; header.filetype[1] = 'T'; header.filetype[2] = 'M'; header.filetype[3] = 0x1A;
|
header.filetype[0] = 'D'; header.filetype[1] = 'T'; header.filetype[2] = 'M'; header.filetype[3] = 0x1A;
|
||||||
strncpy((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6);
|
strncpy((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6);
|
||||||
header.bWii = Core::g_CoreStartupParameter.bWii;
|
header.bWii = Core::g_CoreStartupParameter.bWii;
|
||||||
header.numControllers = g_numPads;
|
header.numControllers = g_numPads;
|
||||||
|
|
||||||
header.bFromSaveState = false; // TODO: add the case where it's true
|
header.bFromSaveState = false; // TODO: add the case where it's true
|
||||||
header.frameCount = g_frameCounter;
|
header.frameCount = g_frameCounter;
|
||||||
header.lagCount = g_lagCounter;
|
header.lagCount = g_lagCounter;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
header.uniqueID = 0;
|
header.uniqueID = 0;
|
||||||
header.numRerecords = 0;
|
header.numRerecords = 0;
|
||||||
// header.author;
|
// header.author;
|
||||||
// header.videoPlugin;
|
// header.videoPlugin;
|
||||||
// header.audioPlugin;
|
// header.audioPlugin;
|
||||||
// header.padPlugin;
|
// header.padPlugin;
|
||||||
|
|
||||||
fwrite(&header, sizeof(DTMHeader), 1, g_recordfd);
|
fwrite(&header, sizeof(DTMHeader), 1, g_recordfd);
|
||||||
|
|
||||||
fclose(g_recordfd);
|
fclose(g_recordfd);
|
||||||
g_recordfd = NULL;
|
g_recordfd = NULL;
|
||||||
|
|
||||||
delete[] g_padStates;
|
delete[] g_padStates;
|
||||||
|
|
||||||
g_playMode = MODE_NONE;
|
g_playMode = MODE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordInput(SPADStatus *PadStatus, int controllerID)
|
void RecordInput(SPADStatus *PadStatus, int controllerID)
|
||||||
{
|
{
|
||||||
if(!IsRecordingInput() || controllerID >= g_numPads || controllerID < 0)
|
if(!IsRecordingInput() || controllerID >= g_numPads || controllerID < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_padStates[controllerID].A = ((PadStatus->button & PAD_BUTTON_A) != 0);
|
g_padStates[controllerID].A = ((PadStatus->button & PAD_BUTTON_A) != 0);
|
||||||
g_padStates[controllerID].B = ((PadStatus->button & PAD_BUTTON_B) != 0);
|
g_padStates[controllerID].B = ((PadStatus->button & PAD_BUTTON_B) != 0);
|
||||||
g_padStates[controllerID].X = ((PadStatus->button & PAD_BUTTON_X) != 0);
|
g_padStates[controllerID].X = ((PadStatus->button & PAD_BUTTON_X) != 0);
|
||||||
g_padStates[controllerID].Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
|
g_padStates[controllerID].Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
|
||||||
g_padStates[controllerID].Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
|
g_padStates[controllerID].Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
|
||||||
g_padStates[controllerID].Start = ((PadStatus->button & PAD_BUTTON_START) != 0);
|
g_padStates[controllerID].Start = ((PadStatus->button & PAD_BUTTON_START) != 0);
|
||||||
|
|
||||||
g_padStates[controllerID].DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
|
g_padStates[controllerID].DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
|
||||||
g_padStates[controllerID].DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0);
|
g_padStates[controllerID].DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0);
|
||||||
g_padStates[controllerID].DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
|
g_padStates[controllerID].DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
|
||||||
g_padStates[controllerID].DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);
|
g_padStates[controllerID].DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);
|
||||||
|
|
||||||
g_padStates[controllerID].L = PadStatus->triggerLeft;
|
g_padStates[controllerID].L = PadStatus->triggerLeft;
|
||||||
g_padStates[controllerID].R = PadStatus->triggerRight;
|
g_padStates[controllerID].R = PadStatus->triggerRight;
|
||||||
|
|
||||||
g_padStates[controllerID].AnalogStickX = PadStatus->stickX;
|
g_padStates[controllerID].AnalogStickX = PadStatus->stickX;
|
||||||
g_padStates[controllerID].AnalogStickY = PadStatus->stickY;
|
g_padStates[controllerID].AnalogStickY = PadStatus->stickY;
|
||||||
|
|
||||||
g_padStates[controllerID].CStickX = PadStatus->substickX;
|
g_padStates[controllerID].CStickX = PadStatus->substickX;
|
||||||
g_padStates[controllerID].CStickY = PadStatus->substickY;
|
g_padStates[controllerID].CStickY = PadStatus->substickY;
|
||||||
|
|
||||||
PlayController(PadStatus, controllerID);
|
PlayController(PadStatus, controllerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayInput(const char *filename)
|
bool PlayInput(const char *filename)
|
||||||
{
|
{
|
||||||
if(!filename || g_playMode != MODE_NONE || g_recordfd)
|
if(!filename || g_playMode != MODE_NONE || g_recordfd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!File::Exists(filename))
|
if(!File::Exists(filename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DTMHeader header;
|
DTMHeader header;
|
||||||
|
|
||||||
g_recordfd = fopen(filename, "rb");
|
g_recordfd = fopen(filename, "rb");
|
||||||
if(!g_recordfd)
|
if(!g_recordfd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fread(&header, sizeof(DTMHeader), 1, g_recordfd);
|
fread(&header, sizeof(DTMHeader), 1, g_recordfd);
|
||||||
|
|
||||||
if(header.filetype[0] != 'D' || header.filetype[1] != 'T' || header.filetype[2] != 'M' || header.filetype[3] != 0x1A) {
|
if(header.filetype[0] != 'D' || header.filetype[1] != 'T' || header.filetype[2] != 'M' || header.filetype[3] != 0x1A) {
|
||||||
PanicAlert("Invalid recording file");
|
PanicAlert("Invalid recording file");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load savestate (and skip to frame data)
|
// Load savestate (and skip to frame data)
|
||||||
if(header.bFromSaveState) {
|
if(header.bFromSaveState) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Put this verification somewhere we have the gameID of the played game
|
/* TODO: Put this verification somewhere we have the gameID of the played game
|
||||||
// TODO: Replace with Unique ID
|
// TODO: Replace with Unique ID
|
||||||
if(header.uniqueID != 0) {
|
if(header.uniqueID != 0) {
|
||||||
PanicAlert("Recording Unique ID Verification Failed");
|
PanicAlert("Recording Unique ID Verification Failed");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strncmp((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)) {
|
if(strncmp((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)) {
|
||||||
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
|
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_numPads = header.numControllers;
|
g_numPads = header.numControllers;
|
||||||
g_padStates = new ControllerState[g_numPads];
|
g_padStates = new ControllerState[g_numPads];
|
||||||
g_numRerecords = header.numRerecords;
|
g_numRerecords = header.numRerecords;
|
||||||
g_recordFile = filename;
|
g_recordFile = filename;
|
||||||
|
|
||||||
g_playMode = MODE_PLAYING;
|
g_playMode = MODE_PLAYING;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
fclose(g_recordfd);
|
fclose(g_recordfd);
|
||||||
g_recordfd = NULL;
|
g_recordfd = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayController(SPADStatus *PadStatus, int controllerID)
|
void PlayController(SPADStatus *PadStatus, int controllerID)
|
||||||
{
|
{
|
||||||
if(!IsPlayingInput() || controllerID >= g_numPads || controllerID < 0)
|
if(!IsPlayingInput() || controllerID >= g_numPads || controllerID < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(PadStatus, 0, sizeof(SPADStatus));
|
memset(PadStatus, 0, sizeof(SPADStatus));
|
||||||
|
|
||||||
PadStatus->button |= PAD_USE_ORIGIN;
|
PadStatus->button |= PAD_USE_ORIGIN;
|
||||||
|
|
||||||
if(g_padStates[controllerID].A) {
|
if(g_padStates[controllerID].A) {
|
||||||
PadStatus->button |= PAD_BUTTON_A;
|
PadStatus->button |= PAD_BUTTON_A;
|
||||||
PadStatus->analogA = 0xFF;
|
PadStatus->analogA = 0xFF;
|
||||||
}
|
}
|
||||||
if(g_padStates[controllerID].B) {
|
if(g_padStates[controllerID].B) {
|
||||||
PadStatus->button |= PAD_BUTTON_B;
|
PadStatus->button |= PAD_BUTTON_B;
|
||||||
PadStatus->analogB = 0xFF;
|
PadStatus->analogB = 0xFF;
|
||||||
}
|
}
|
||||||
if(g_padStates[controllerID].X)
|
if(g_padStates[controllerID].X)
|
||||||
PadStatus->button |= PAD_BUTTON_X;
|
PadStatus->button |= PAD_BUTTON_X;
|
||||||
if(g_padStates[controllerID].Y)
|
if(g_padStates[controllerID].Y)
|
||||||
PadStatus->button |= PAD_BUTTON_Y;
|
PadStatus->button |= PAD_BUTTON_Y;
|
||||||
if(g_padStates[controllerID].Z)
|
if(g_padStates[controllerID].Z)
|
||||||
PadStatus->button |= PAD_TRIGGER_Z;
|
PadStatus->button |= PAD_TRIGGER_Z;
|
||||||
if(g_padStates[controllerID].Start)
|
if(g_padStates[controllerID].Start)
|
||||||
PadStatus->button |= PAD_BUTTON_START;
|
PadStatus->button |= PAD_BUTTON_START;
|
||||||
|
|
||||||
if(g_padStates[controllerID].DPadUp)
|
if(g_padStates[controllerID].DPadUp)
|
||||||
PadStatus->button |= PAD_BUTTON_UP;
|
PadStatus->button |= PAD_BUTTON_UP;
|
||||||
if(g_padStates[controllerID].DPadDown)
|
if(g_padStates[controllerID].DPadDown)
|
||||||
PadStatus->button |= PAD_BUTTON_DOWN;
|
PadStatus->button |= PAD_BUTTON_DOWN;
|
||||||
if(g_padStates[controllerID].DPadLeft)
|
if(g_padStates[controllerID].DPadLeft)
|
||||||
PadStatus->button |= PAD_BUTTON_LEFT;
|
PadStatus->button |= PAD_BUTTON_LEFT;
|
||||||
if(g_padStates[controllerID].DPadRight)
|
if(g_padStates[controllerID].DPadRight)
|
||||||
PadStatus->button |= PAD_BUTTON_RIGHT;
|
PadStatus->button |= PAD_BUTTON_RIGHT;
|
||||||
|
|
||||||
PadStatus->triggerLeft = g_padStates[controllerID].L;
|
PadStatus->triggerLeft = g_padStates[controllerID].L;
|
||||||
if(PadStatus->triggerLeft > 230)
|
if(PadStatus->triggerLeft > 230)
|
||||||
PadStatus->button |= PAD_TRIGGER_L;
|
PadStatus->button |= PAD_TRIGGER_L;
|
||||||
PadStatus->triggerRight = g_padStates[controllerID].R;
|
PadStatus->triggerRight = g_padStates[controllerID].R;
|
||||||
if(PadStatus->triggerRight > 230)
|
if(PadStatus->triggerRight > 230)
|
||||||
PadStatus->button |= PAD_TRIGGER_R;
|
PadStatus->button |= PAD_TRIGGER_R;
|
||||||
|
|
||||||
PadStatus->stickX = g_padStates[controllerID].AnalogStickX;
|
PadStatus->stickX = g_padStates[controllerID].AnalogStickX;
|
||||||
PadStatus->stickY = g_padStates[controllerID].AnalogStickY;
|
PadStatus->stickY = g_padStates[controllerID].AnalogStickY;
|
||||||
|
|
||||||
PadStatus->substickX = g_padStates[controllerID].CStickX;
|
PadStatus->substickX = g_padStates[controllerID].CStickX;
|
||||||
PadStatus->substickY = g_padStates[controllerID].CStickY;
|
PadStatus->substickY = g_padStates[controllerID].CStickY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndPlayInput() {
|
void EndPlayInput() {
|
||||||
fclose(g_recordfd);
|
fclose(g_recordfd);
|
||||||
g_recordfd = NULL;
|
g_recordfd = NULL;
|
||||||
g_numPads = 0;
|
g_numPads = 0;
|
||||||
delete[] g_padStates;
|
delete[] g_padStates;
|
||||||
g_playMode = MODE_NONE;
|
g_playMode = MODE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,121 +1,121 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef __FRAME_H
|
#ifndef __FRAME_H
|
||||||
#define __FRAME_H
|
#define __FRAME_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "pluginspecs_pad.h"
|
#include "pluginspecs_pad.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Per-(video )Frame actions
|
// Per-(video )Frame actions
|
||||||
|
|
||||||
namespace Frame {
|
namespace Frame {
|
||||||
|
|
||||||
// Enumerations and structs
|
// Enumerations and structs
|
||||||
enum PlayMode {
|
enum PlayMode {
|
||||||
MODE_NONE = 0,
|
MODE_NONE = 0,
|
||||||
MODE_RECORDING,
|
MODE_RECORDING,
|
||||||
MODE_PLAYING
|
MODE_PLAYING
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gamecube Controller State
|
// Gamecube Controller State
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool Start, A, B, X, Y, Z; // Binary buttons, 6 bits
|
bool Start, A, B, X, Y, Z; // Binary buttons, 6 bits
|
||||||
bool DPadUp, DPadDown, DPadLeft, DPadRight; // Binary D-Pad buttons, 4 bits
|
bool DPadUp, DPadDown, DPadLeft, DPadRight; // Binary D-Pad buttons, 4 bits
|
||||||
u8 L, R; // Triggers, 16 bits
|
u8 L, R; // Triggers, 16 bits
|
||||||
u8 AnalogStickX, AnalogStickY; // Main Stick, 16 bits
|
u8 AnalogStickX, AnalogStickY; // Main Stick, 16 bits
|
||||||
u8 CStickX, CStickY; // Sub-Stick, 16 bits
|
u8 CStickX, CStickY; // Sub-Stick, 16 bits
|
||||||
|
|
||||||
bool reserved[6]; // Reserved bits, 6 bits
|
bool reserved[6]; // Reserved bits, 6 bits
|
||||||
} ControllerState; // Total: 58 + 6 = 64 bits per frame
|
} ControllerState; // Total: 58 + 6 = 64 bits per frame
|
||||||
|
|
||||||
|
|
||||||
// Global declarations
|
// Global declarations
|
||||||
extern bool g_bFrameStep, g_bAutoFire, g_bFirstKey, g_bPolled;
|
extern bool g_bFrameStep, g_bAutoFire, g_bFirstKey, g_bPolled;
|
||||||
extern u32 g_autoFirstKey, g_autoSecondKey;
|
extern u32 g_autoFirstKey, g_autoSecondKey;
|
||||||
extern PlayMode g_playMode;
|
extern PlayMode g_playMode;
|
||||||
|
|
||||||
extern unsigned int g_framesToSkip, g_frameSkipCounter;
|
extern unsigned int g_framesToSkip, g_frameSkipCounter;
|
||||||
|
|
||||||
extern int g_numPads;
|
extern int g_numPads;
|
||||||
extern ControllerState *g_padStates;
|
extern ControllerState *g_padStates;
|
||||||
extern FILE *g_recordfd;
|
extern FILE *g_recordfd;
|
||||||
extern std::string g_recordFile;
|
extern std::string g_recordFile;
|
||||||
|
|
||||||
extern u64 g_frameCounter, g_lagCounter;
|
extern u64 g_frameCounter, g_lagCounter;
|
||||||
|
|
||||||
extern int g_numRerecords;
|
extern int g_numRerecords;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
|
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
|
||||||
|
|
||||||
u8 gameID[6]; // The Game ID
|
u8 gameID[6]; // The Game ID
|
||||||
bool bWii; // Wii game
|
bool bWii; // Wii game
|
||||||
|
|
||||||
u8 numControllers; // The number of connected controllers (1-4)
|
u8 numControllers; // The number of connected controllers (1-4)
|
||||||
|
|
||||||
bool bFromSaveState; // false indicates that the recording started from bootup, true for savestate
|
bool bFromSaveState; // false indicates that the recording started from bootup, true for savestate
|
||||||
u64 frameCount; // Number of frames in the recording
|
u64 frameCount; // Number of frames in the recording
|
||||||
u64 lagCount; // Number of lag frames in the recording
|
u64 lagCount; // Number of lag frames in the recording
|
||||||
u64 uniqueID; // A Unique ID comprised of: md5(time + Game ID)
|
u64 uniqueID; // A Unique ID comprised of: md5(time + Game ID)
|
||||||
u32 numRerecords; // Number of rerecords/'cuts' of this TAS
|
u32 numRerecords; // Number of rerecords/'cuts' of this TAS
|
||||||
u8 author[32]; // Author's name (encoded in UTF-8)
|
u8 author[32]; // Author's name (encoded in UTF-8)
|
||||||
|
|
||||||
u8 videoPlugin[16]; // UTF-8 representation of the video plugin
|
u8 videoPlugin[16]; // UTF-8 representation of the video plugin
|
||||||
u8 audioPlugin[16]; // UTF-8 representation of the audio plugin
|
u8 audioPlugin[16]; // UTF-8 representation of the audio plugin
|
||||||
u8 padPlugin[16]; // UTF-8 representation of the input plugin
|
u8 padPlugin[16]; // UTF-8 representation of the input plugin
|
||||||
|
|
||||||
|
|
||||||
bool padding[102]; // Padding to align the header to 1024 bits
|
bool padding[102]; // Padding to align the header to 1024 bits
|
||||||
|
|
||||||
u8 reserved[128]; // Increasing size from 128 bytes to 256 bytes, just because we can
|
u8 reserved[128]; // Increasing size from 128 bytes to 256 bytes, just because we can
|
||||||
} DTMHeader;
|
} DTMHeader;
|
||||||
|
|
||||||
|
|
||||||
void FrameUpdate();
|
void FrameUpdate();
|
||||||
|
|
||||||
void SetPolledDevice();
|
void SetPolledDevice();
|
||||||
|
|
||||||
bool IsAutoFiring();
|
bool IsAutoFiring();
|
||||||
bool IsRecordingInput();
|
bool IsRecordingInput();
|
||||||
bool IsPlayingInput();
|
bool IsPlayingInput();
|
||||||
|
|
||||||
void SetAutoHold(bool bEnabled, u32 keyToHold = 0);
|
void SetAutoHold(bool bEnabled, u32 keyToHold = 0);
|
||||||
void SetAutoFire(bool bEnabled, u32 keyOne = 0, u32 keyTwo = 0);
|
void SetAutoFire(bool bEnabled, u32 keyOne = 0, u32 keyTwo = 0);
|
||||||
|
|
||||||
void SetFrameStepping(bool bEnabled);
|
void SetFrameStepping(bool bEnabled);
|
||||||
void SetFrameStopping(bool bEnabled);
|
void SetFrameStopping(bool bEnabled);
|
||||||
|
|
||||||
void SetFrameSkipping(unsigned int framesToSkip);
|
void SetFrameSkipping(unsigned int framesToSkip);
|
||||||
int FrameSkippingFactor();
|
int FrameSkippingFactor();
|
||||||
void FrameSkipping();
|
void FrameSkipping();
|
||||||
|
|
||||||
void ModifyController(SPADStatus *PadStatus, int controllerID);
|
void ModifyController(SPADStatus *PadStatus, int controllerID);
|
||||||
|
|
||||||
bool BeginRecordingInput(const char *filename, int controllers);
|
bool BeginRecordingInput(const char *filename, int controllers);
|
||||||
void RecordInput(SPADStatus *PadStatus, int controllerID);
|
void RecordInput(SPADStatus *PadStatus, int controllerID);
|
||||||
void EndRecordingInput();
|
void EndRecordingInput();
|
||||||
|
|
||||||
bool PlayInput(const char *filename);
|
bool PlayInput(const char *filename);
|
||||||
void PlayController(SPADStatus *PadStatus, int controllerID);
|
void PlayController(SPADStatus *PadStatus, int controllerID);
|
||||||
void EndPlayInput();
|
void EndPlayInput();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __FRAME_H
|
#endif // __FRAME_H
|
||||||
|
|
|
@ -1,255 +1,255 @@
|
||||||
// Copyright (C) 2009 Dolphin Project.
|
// Copyright (C) 2009 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _INTERPRETER_FPUTILS_H
|
#ifndef _INTERPRETER_FPUTILS_H
|
||||||
#define _INTERPRETER_FPUTILS_H
|
#define _INTERPRETER_FPUTILS_H
|
||||||
|
|
||||||
#include "../../Core.h"
|
#include "../../Core.h"
|
||||||
#include "Interpreter.h"
|
#include "Interpreter.h"
|
||||||
#include "MathUtil.h"
|
#include "MathUtil.h"
|
||||||
|
|
||||||
using namespace MathUtil;
|
using namespace MathUtil;
|
||||||
|
|
||||||
// warning! very slow! This setting fixes NAN
|
// warning! very slow! This setting fixes NAN
|
||||||
//#define VERY_ACCURATE_FP
|
//#define VERY_ACCURATE_FP
|
||||||
|
|
||||||
#define MIN_SINGLE 0xc7efffffe0000000ull
|
#define MIN_SINGLE 0xc7efffffe0000000ull
|
||||||
#define MAX_SINGLE 0x47efffffe0000000ull
|
#define MAX_SINGLE 0x47efffffe0000000ull
|
||||||
|
|
||||||
// FPSCR exception flags
|
// FPSCR exception flags
|
||||||
const u32 FPSCR_OX = (u32)1 << (31 - 3);
|
const u32 FPSCR_OX = (u32)1 << (31 - 3);
|
||||||
const u32 FPSCR_UX = (u32)1 << (31 - 4);
|
const u32 FPSCR_UX = (u32)1 << (31 - 4);
|
||||||
const u32 FPSCR_ZX = (u32)1 << (31 - 5);
|
const u32 FPSCR_ZX = (u32)1 << (31 - 5);
|
||||||
// ! XX shouldn't be accessed directly to set 1. Use SetFI() instead !
|
// ! XX shouldn't be accessed directly to set 1. Use SetFI() instead !
|
||||||
const u32 FPSCR_XX = (u32)1 << (31 - 6);
|
const u32 FPSCR_XX = (u32)1 << (31 - 6);
|
||||||
const u32 FPSCR_VXSNAN = (u32)1 << (31 - 7);
|
const u32 FPSCR_VXSNAN = (u32)1 << (31 - 7);
|
||||||
const u32 FPSCR_VXISI = (u32)1 << (31 - 8);
|
const u32 FPSCR_VXISI = (u32)1 << (31 - 8);
|
||||||
const u32 FPSCR_VXIDI = (u32)1 << (31 - 9);
|
const u32 FPSCR_VXIDI = (u32)1 << (31 - 9);
|
||||||
const u32 FPSCR_VXZDZ = (u32)1 << (31 - 10);
|
const u32 FPSCR_VXZDZ = (u32)1 << (31 - 10);
|
||||||
const u32 FPSCR_VXIMZ = (u32)1 << (31 - 11);
|
const u32 FPSCR_VXIMZ = (u32)1 << (31 - 11);
|
||||||
const u32 FPSCR_VXVC = (u32)1 << (31 - 12);
|
const u32 FPSCR_VXVC = (u32)1 << (31 - 12);
|
||||||
const u32 FPSCR_VXSOFT = (u32)1 << (31 - 21);
|
const u32 FPSCR_VXSOFT = (u32)1 << (31 - 21);
|
||||||
const u32 FPSCR_VXSQRT = (u32)1 << (31 - 22);
|
const u32 FPSCR_VXSQRT = (u32)1 << (31 - 22);
|
||||||
const u32 FPSCR_VXCVI = (u32)1 << (31 - 23);
|
const u32 FPSCR_VXCVI = (u32)1 << (31 - 23);
|
||||||
|
|
||||||
const u32 FPSCR_VX_ANY = FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI | FPSCR_VXZDZ |
|
const u32 FPSCR_VX_ANY = FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI | FPSCR_VXZDZ |
|
||||||
FPSCR_VXIMZ | FPSCR_VXVC | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI;
|
FPSCR_VXIMZ | FPSCR_VXVC | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI;
|
||||||
|
|
||||||
const u32 FPSCR_ANY_X = FPSCR_OX | FPSCR_UX | FPSCR_ZX | FPSCR_XX | FPSCR_VX_ANY;
|
const u32 FPSCR_ANY_X = FPSCR_OX | FPSCR_UX | FPSCR_ZX | FPSCR_XX | FPSCR_VX_ANY;
|
||||||
|
|
||||||
const u64 PPC_NAN_U64 = 0x7ff8000000000000ull;
|
const u64 PPC_NAN_U64 = 0x7ff8000000000000ull;
|
||||||
const double PPC_NAN = *(double* const)&PPC_NAN_U64;
|
const double PPC_NAN = *(double* const)&PPC_NAN_U64;
|
||||||
|
|
||||||
inline bool IsINF(double x)
|
inline bool IsINF(double x)
|
||||||
{
|
{
|
||||||
return ((*(u64*)&x) & ~DOUBLE_SIGN) == DOUBLE_EXP;
|
return ((*(u64*)&x) & ~DOUBLE_SIGN) == DOUBLE_EXP;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetFPException(u32 mask)
|
inline void SetFPException(u32 mask)
|
||||||
{
|
{
|
||||||
if ((FPSCR.Hex & mask) != mask)
|
if ((FPSCR.Hex & mask) != mask)
|
||||||
FPSCR.FX = 1;
|
FPSCR.FX = 1;
|
||||||
FPSCR.Hex |= mask;
|
FPSCR.Hex |= mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetFI(int FI)
|
inline void SetFI(int FI)
|
||||||
{
|
{
|
||||||
if (FI)
|
if (FI)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_XX);
|
SetFPException(FPSCR_XX);
|
||||||
}
|
}
|
||||||
FPSCR.FI = FI;
|
FPSCR.FI = FI;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void UpdateFPSCR()
|
inline void UpdateFPSCR()
|
||||||
{
|
{
|
||||||
FPSCR.VX = (FPSCR.Hex & FPSCR_VX_ANY) != 0;
|
FPSCR.VX = (FPSCR.Hex & FPSCR_VX_ANY) != 0;
|
||||||
FPSCR.FEX = 0; // we assume that "?E" bits are always 0
|
FPSCR.FEX = 0; // we assume that "?E" bits are always 0
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double ForceSingle(double _x)
|
inline double ForceSingle(double _x)
|
||||||
{
|
{
|
||||||
//if (FPSCR.RN != 0)
|
//if (FPSCR.RN != 0)
|
||||||
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
|
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
|
||||||
if (FPSCR.NI)
|
if (FPSCR.NI)
|
||||||
_x = FlushToZeroAsFloat(_x);
|
_x = FlushToZeroAsFloat(_x);
|
||||||
|
|
||||||
double x = static_cast<float>(_x);
|
double x = static_cast<float>(_x);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double ForceDouble(double d)
|
inline double ForceDouble(double d)
|
||||||
{
|
{
|
||||||
//if (FPSCR.RN != 0)
|
//if (FPSCR.RN != 0)
|
||||||
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
|
// PanicAlert("RN = %d at %x", (int)FPSCR.RN, PC);
|
||||||
|
|
||||||
//if (FPSCR.NI)
|
//if (FPSCR.NI)
|
||||||
//{
|
//{
|
||||||
// IntDouble x; x.d = d;
|
// IntDouble x; x.d = d;
|
||||||
//if ((x.i & DOUBLE_EXP) == 0)
|
//if ((x.i & DOUBLE_EXP) == 0)
|
||||||
// x.i &= DOUBLE_SIGN; // turn into signed zero
|
// x.i &= DOUBLE_SIGN; // turn into signed zero
|
||||||
// return x.d;
|
// return x.d;
|
||||||
//}
|
//}
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// these functions allow globally modify operations behaviour
|
// these functions allow globally modify operations behaviour
|
||||||
// also, these may be used to set flags like FR, FI, OX, UX
|
// also, these may be used to set flags like FR, FI, OX, UX
|
||||||
|
|
||||||
inline double NI_mul(const double a, const double b)
|
inline double NI_mul(const double a, const double b)
|
||||||
{
|
{
|
||||||
#ifdef VERY_ACCURATE_FP
|
#ifdef VERY_ACCURATE_FP
|
||||||
if (a != a) return a;
|
if (a != a) return a;
|
||||||
if (b != b) return b;
|
if (b != b) return b;
|
||||||
double t = a * b;
|
double t = a * b;
|
||||||
if (t != t)
|
if (t != t)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXIMZ);
|
SetFPException(FPSCR_VXIMZ);
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
#else
|
#else
|
||||||
return a * b;
|
return a * b;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double NI_add(const double a, const double b)
|
inline double NI_add(const double a, const double b)
|
||||||
{
|
{
|
||||||
#ifdef VERY_ACCURATE_FP
|
#ifdef VERY_ACCURATE_FP
|
||||||
if (a != a) return a;
|
if (a != a) return a;
|
||||||
if (b != b) return b;
|
if (b != b) return b;
|
||||||
double t = a + b;
|
double t = a + b;
|
||||||
if (t != t)
|
if (t != t)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXISI);
|
SetFPException(FPSCR_VXISI);
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
#else
|
#else
|
||||||
return a + b;
|
return a + b;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double NI_sub(const double a, const double b)
|
inline double NI_sub(const double a, const double b)
|
||||||
{
|
{
|
||||||
#ifdef VERY_ACCURATE_FP
|
#ifdef VERY_ACCURATE_FP
|
||||||
if (a != a) return a;
|
if (a != a) return a;
|
||||||
if (b != b) return b;
|
if (b != b) return b;
|
||||||
double t = a - b;
|
double t = a - b;
|
||||||
if (t != t)
|
if (t != t)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXISI);
|
SetFPException(FPSCR_VXISI);
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
#else
|
#else
|
||||||
return a - b;
|
return a - b;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double NI_madd(const double a, const double b, const double c)
|
inline double NI_madd(const double a, const double b, const double c)
|
||||||
{
|
{
|
||||||
#ifdef VERY_ACCURATE_FP
|
#ifdef VERY_ACCURATE_FP
|
||||||
if (a != a) return a;
|
if (a != a) return a;
|
||||||
if (c != c) return c;
|
if (c != c) return c;
|
||||||
if (b != b) return b;
|
if (b != b) return b;
|
||||||
double t = a * b;
|
double t = a * b;
|
||||||
if (t != t)
|
if (t != t)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXIMZ);
|
SetFPException(FPSCR_VXIMZ);
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
t = t + c;
|
t = t + c;
|
||||||
if (t != t)
|
if (t != t)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXISI);
|
SetFPException(FPSCR_VXISI);
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
#else
|
#else
|
||||||
return NI_add(NI_mul(a, b), c);
|
return NI_add(NI_mul(a, b), c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double NI_msub(const double a, const double b, const double c)
|
inline double NI_msub(const double a, const double b, const double c)
|
||||||
{
|
{
|
||||||
//#ifdef VERY_ACCURATE_FP
|
//#ifdef VERY_ACCURATE_FP
|
||||||
// This code does not produce accurate fp! NAN's are not calculated correctly, nor negative zero.
|
// This code does not produce accurate fp! NAN's are not calculated correctly, nor negative zero.
|
||||||
// The code is kept here for reference.
|
// The code is kept here for reference.
|
||||||
//
|
//
|
||||||
// if (a != a) return a;
|
// if (a != a) return a;
|
||||||
// if (c != c) return c;
|
// if (c != c) return c;
|
||||||
// if (b != b) return b;
|
// if (b != b) return b;
|
||||||
// double t = a * b;
|
// double t = a * b;
|
||||||
// if (t != t)
|
// if (t != t)
|
||||||
// {
|
// {
|
||||||
// SetFPException(FPSCR_VXIMZ);
|
// SetFPException(FPSCR_VXIMZ);
|
||||||
// return PPC_NAN;
|
// return PPC_NAN;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// t = t - c;
|
// t = t - c;
|
||||||
// if (t != t)
|
// if (t != t)
|
||||||
// {
|
// {
|
||||||
// SetFPException(FPSCR_VXISI);
|
// SetFPException(FPSCR_VXISI);
|
||||||
// return PPC_NAN;
|
// return PPC_NAN;
|
||||||
// }
|
// }
|
||||||
// return t;
|
// return t;
|
||||||
//#else
|
//#else
|
||||||
// This code does not calculate QNAN's correctly but calculates negative zero correctly.
|
// This code does not calculate QNAN's correctly but calculates negative zero correctly.
|
||||||
return NI_sub(NI_mul(a, b), c);
|
return NI_sub(NI_mul(a, b), c);
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// used by stfsXX instructions and ps_rsqrte
|
// used by stfsXX instructions and ps_rsqrte
|
||||||
inline u32 ConvertToSingle(u64 x)
|
inline u32 ConvertToSingle(u64 x)
|
||||||
{
|
{
|
||||||
u32 exp = (x >> 52) & 0x7ff;
|
u32 exp = (x >> 52) & 0x7ff;
|
||||||
if (exp > 896 || (x & ~DOUBLE_SIGN) == 0)
|
if (exp > 896 || (x & ~DOUBLE_SIGN) == 0)
|
||||||
{
|
{
|
||||||
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
||||||
}
|
}
|
||||||
else if (exp >= 874)
|
else if (exp >= 874)
|
||||||
{
|
{
|
||||||
u32 t = (u32)(0x80000000 | ((x & DOUBLE_FRAC) >> 21));
|
u32 t = (u32)(0x80000000 | ((x & DOUBLE_FRAC) >> 21));
|
||||||
t = t >> (905 - exp);
|
t = t >> (905 - exp);
|
||||||
t |= (x >> 32) & 0x80000000;
|
t |= (x >> 32) & 0x80000000;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This is said to be undefined.
|
// This is said to be undefined.
|
||||||
// The code is based on hardware tests.
|
// The code is based on hardware tests.
|
||||||
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used by psq_stXX operations.
|
// used by psq_stXX operations.
|
||||||
inline u32 ConvertToSingleFTZ(u64 x)
|
inline u32 ConvertToSingleFTZ(u64 x)
|
||||||
{
|
{
|
||||||
u32 exp = (x >> 52) & 0x7ff;
|
u32 exp = (x >> 52) & 0x7ff;
|
||||||
if (exp > 896 || (x & ~DOUBLE_SIGN) == 0)
|
if (exp > 896 || (x & ~DOUBLE_SIGN) == 0)
|
||||||
{
|
{
|
||||||
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
return ((x >> 32) & 0xc0000000) | ((x >> 29) & 0x3fffffff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (x >> 32) & 0x80000000;
|
return (x >> 32) & 0x80000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef INTERPRETER_TABLES_H
|
#ifndef INTERPRETER_TABLES_H
|
||||||
#define INTERPRETER_TABLES_H
|
#define INTERPRETER_TABLES_H
|
||||||
#include "../Gekko.h"
|
#include "../Gekko.h"
|
||||||
#include "../PPCTables.h"
|
#include "../PPCTables.h"
|
||||||
#include "Interpreter.h"
|
#include "Interpreter.h"
|
||||||
|
|
||||||
namespace InterpreterTables
|
namespace InterpreterTables
|
||||||
{
|
{
|
||||||
void InitTables();
|
void InitTables();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,489 +1,489 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "Jit.h"
|
#include "Jit.h"
|
||||||
#include "Jit64_Tables.h"
|
#include "Jit64_Tables.h"
|
||||||
|
|
||||||
// Should be moved in to the Jit class
|
// Should be moved in to the Jit class
|
||||||
typedef void (Jit64::*_Instruction) (UGeckoInstruction instCode);
|
typedef void (Jit64::*_Instruction) (UGeckoInstruction instCode);
|
||||||
|
|
||||||
static _Instruction dynaOpTable[64];
|
static _Instruction dynaOpTable[64];
|
||||||
static _Instruction dynaOpTable4[1024];
|
static _Instruction dynaOpTable4[1024];
|
||||||
static _Instruction dynaOpTable19[1024];
|
static _Instruction dynaOpTable19[1024];
|
||||||
static _Instruction dynaOpTable31[1024];
|
static _Instruction dynaOpTable31[1024];
|
||||||
static _Instruction dynaOpTable59[32];
|
static _Instruction dynaOpTable59[32];
|
||||||
static _Instruction dynaOpTable63[1024];
|
static _Instruction dynaOpTable63[1024];
|
||||||
void Jit64::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
|
void Jit64::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
|
||||||
void Jit64::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
|
void Jit64::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
|
||||||
void Jit64::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);}
|
void Jit64::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);}
|
||||||
void Jit64::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);}
|
void Jit64::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);}
|
||||||
void Jit64::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);}
|
void Jit64::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);}
|
||||||
|
|
||||||
struct GekkoOPTemplate
|
struct GekkoOPTemplate
|
||||||
{
|
{
|
||||||
int opcode;
|
int opcode;
|
||||||
_Instruction Inst;
|
_Instruction Inst;
|
||||||
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
|
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
|
||||||
int runCount;
|
int runCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate primarytable[] =
|
static GekkoOPTemplate primarytable[] =
|
||||||
{
|
{
|
||||||
{4, &Jit64::DynaRunTable4}, //"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}},
|
{4, &Jit64::DynaRunTable4}, //"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}},
|
||||||
{19, &Jit64::DynaRunTable19}, //"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}},
|
{19, &Jit64::DynaRunTable19}, //"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}},
|
||||||
{31, &Jit64::DynaRunTable31}, //"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}},
|
{31, &Jit64::DynaRunTable31}, //"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}},
|
||||||
{59, &Jit64::DynaRunTable59}, //"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}},
|
{59, &Jit64::DynaRunTable59}, //"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}},
|
||||||
{63, &Jit64::DynaRunTable63}, //"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}},
|
{63, &Jit64::DynaRunTable63}, //"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}},
|
||||||
|
|
||||||
{16, &Jit64::bcx}, //"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{16, &Jit64::bcx}, //"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{18, &Jit64::bx}, //"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{18, &Jit64::bx}, //"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
|
|
||||||
{1, &Jit64::HLEFunction}, //"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{1, &Jit64::HLEFunction}, //"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{2, &Jit64::Default}, //"DynaBlock", OPTYPE_SYSTEM, 0}},
|
{2, &Jit64::Default}, //"DynaBlock", OPTYPE_SYSTEM, 0}},
|
||||||
{3, &Jit64::Default}, //"twi", OPTYPE_SYSTEM, 0}},
|
{3, &Jit64::Default}, //"twi", OPTYPE_SYSTEM, 0}},
|
||||||
{17, &Jit64::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
|
{17, &Jit64::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
|
||||||
|
|
||||||
{7, &Jit64::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
|
{7, &Jit64::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
|
||||||
{8, &Jit64::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
{8, &Jit64::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
||||||
{10, &Jit64::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
{10, &Jit64::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
||||||
{11, &Jit64::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
{11, &Jit64::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
||||||
{12, &Jit64::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
{12, &Jit64::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
||||||
{13, &Jit64::reg_imm}, //"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}},
|
{13, &Jit64::reg_imm}, //"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}},
|
||||||
{14, &Jit64::reg_imm}, //"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
{14, &Jit64::reg_imm}, //"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
||||||
{15, &Jit64::reg_imm}, //"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
{15, &Jit64::reg_imm}, //"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
||||||
|
|
||||||
{20, &Jit64::rlwimix}, //"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}},
|
{20, &Jit64::rlwimix}, //"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{21, &Jit64::rlwinmx}, //"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{21, &Jit64::rlwinmx}, //"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{23, &Jit64::rlwnmx}, //"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}},
|
{23, &Jit64::rlwnmx}, //"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}},
|
||||||
|
|
||||||
{24, &Jit64::reg_imm}, //"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{24, &Jit64::reg_imm}, //"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{25, &Jit64::reg_imm}, //"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{25, &Jit64::reg_imm}, //"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{26, &Jit64::reg_imm}, //"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{26, &Jit64::reg_imm}, //"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{27, &Jit64::reg_imm}, //"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{27, &Jit64::reg_imm}, //"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{28, &Jit64::reg_imm}, //"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
{28, &Jit64::reg_imm}, //"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
||||||
{29, &Jit64::reg_imm}, //"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
{29, &Jit64::reg_imm}, //"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
||||||
|
|
||||||
{32, &Jit64::lXz}, //"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{32, &Jit64::lXz}, //"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{33, &Jit64::Default}, //"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{33, &Jit64::Default}, //"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{34, &Jit64::lXz}, //"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{34, &Jit64::lXz}, //"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{35, &Jit64::Default}, //"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{35, &Jit64::Default}, //"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{40, &Jit64::lXz}, //"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{40, &Jit64::lXz}, //"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{41, &Jit64::Default}, //"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{41, &Jit64::Default}, //"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{42, &Jit64::lha}, //"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{42, &Jit64::lha}, //"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{43, &Jit64::Default}, //"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{43, &Jit64::Default}, //"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{44, &Jit64::stX}, //"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{44, &Jit64::stX}, //"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{45, &Jit64::stX}, //"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{45, &Jit64::stX}, //"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
{36, &Jit64::stX}, //"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{36, &Jit64::stX}, //"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{37, &Jit64::stX}, //"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{37, &Jit64::stX}, //"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
{38, &Jit64::stX}, //"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{38, &Jit64::stX}, //"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{39, &Jit64::stX}, //"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{39, &Jit64::stX}, //"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
|
|
||||||
{46, &Jit64::lmw}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
{46, &Jit64::lmw}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
||||||
{47, &Jit64::stmw}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
{47, &Jit64::stmw}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
||||||
|
|
||||||
{48, &Jit64::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},
|
{48, &Jit64::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},
|
||||||
{49, &Jit64::Default}, //"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
{49, &Jit64::Default}, //"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
||||||
{50, &Jit64::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
|
{50, &Jit64::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
|
||||||
{51, &Jit64::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
{51, &Jit64::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{52, &Jit64::stfs}, //"stfs", OPTYPE_STOREFP, FL_IN_A}},
|
{52, &Jit64::stfs}, //"stfs", OPTYPE_STOREFP, FL_IN_A}},
|
||||||
{53, &Jit64::stfs}, //"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
{53, &Jit64::stfs}, //"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
||||||
{54, &Jit64::stfd}, //"stfd", OPTYPE_STOREFP, FL_IN_A}},
|
{54, &Jit64::stfd}, //"stfd", OPTYPE_STOREFP, FL_IN_A}},
|
||||||
{55, &Jit64::Default}, //"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
{55, &Jit64::Default}, //"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{56, &Jit64::psq_l}, //"psq_l", OPTYPE_PS, FL_IN_A}},
|
{56, &Jit64::psq_l}, //"psq_l", OPTYPE_PS, FL_IN_A}},
|
||||||
{57, &Jit64::psq_l}, //"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
{57, &Jit64::psq_l}, //"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
||||||
{60, &Jit64::psq_st}, //"psq_st", OPTYPE_PS, FL_IN_A}},
|
{60, &Jit64::psq_st}, //"psq_st", OPTYPE_PS, FL_IN_A}},
|
||||||
{61, &Jit64::psq_st}, //"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
{61, &Jit64::psq_st}, //"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
//missing: 0, 5, 6, 9, 22, 30, 62, 58
|
//missing: 0, 5, 6, 9, 22, 30, 62, 58
|
||||||
{0, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{0, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{5, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{5, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{6, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{6, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{9, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{9, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{22, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{22, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{30, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{30, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{62, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{62, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{58, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{58, &Jit64::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table4[] =
|
static GekkoOPTemplate table4[] =
|
||||||
{ //SUBOP10
|
{ //SUBOP10
|
||||||
{0, &Jit64::Default}, //"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}},
|
{0, &Jit64::Default}, //"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}},
|
||||||
{32, &Jit64::Default}, //"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}},
|
{32, &Jit64::Default}, //"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}},
|
||||||
{40, &Jit64::ps_sign}, //"ps_neg", OPTYPE_PS, FL_RC_BIT}},
|
{40, &Jit64::ps_sign}, //"ps_neg", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{136, &Jit64::ps_sign}, //"ps_nabs", OPTYPE_PS, FL_RC_BIT}},
|
{136, &Jit64::ps_sign}, //"ps_nabs", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{264, &Jit64::ps_sign}, //"ps_abs", OPTYPE_PS, FL_RC_BIT}},
|
{264, &Jit64::ps_sign}, //"ps_abs", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{64, &Jit64::Default}, //"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}},
|
{64, &Jit64::Default}, //"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{72, &Jit64::ps_mr}, //"ps_mr", OPTYPE_PS, FL_RC_BIT}},
|
{72, &Jit64::ps_mr}, //"ps_mr", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{96, &Jit64::Default}, //"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}},
|
{96, &Jit64::Default}, //"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{528, &Jit64::ps_mergeXX}, //"ps_merge00", OPTYPE_PS, FL_RC_BIT}},
|
{528, &Jit64::ps_mergeXX}, //"ps_merge00", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{560, &Jit64::ps_mergeXX}, //"ps_merge01", OPTYPE_PS, FL_RC_BIT}},
|
{560, &Jit64::ps_mergeXX}, //"ps_merge01", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{592, &Jit64::ps_mergeXX}, //"ps_merge10", OPTYPE_PS, FL_RC_BIT}},
|
{592, &Jit64::ps_mergeXX}, //"ps_merge10", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{624, &Jit64::ps_mergeXX}, //"ps_merge11", OPTYPE_PS, FL_RC_BIT}},
|
{624, &Jit64::ps_mergeXX}, //"ps_merge11", OPTYPE_PS, FL_RC_BIT}},
|
||||||
|
|
||||||
{1014, &Jit64::Default}, //"dcbz_l", OPTYPE_SYSTEM, 0}},
|
{1014, &Jit64::Default}, //"dcbz_l", OPTYPE_SYSTEM, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table4_2[] =
|
static GekkoOPTemplate table4_2[] =
|
||||||
{
|
{
|
||||||
{10, &Jit64::ps_sum}, //"ps_sum0", OPTYPE_PS, 0}},
|
{10, &Jit64::ps_sum}, //"ps_sum0", OPTYPE_PS, 0}},
|
||||||
{11, &Jit64::ps_sum}, //"ps_sum1", OPTYPE_PS, 0}},
|
{11, &Jit64::ps_sum}, //"ps_sum1", OPTYPE_PS, 0}},
|
||||||
{12, &Jit64::ps_muls}, //"ps_muls0", OPTYPE_PS, 0}},
|
{12, &Jit64::ps_muls}, //"ps_muls0", OPTYPE_PS, 0}},
|
||||||
{13, &Jit64::ps_muls}, //"ps_muls1", OPTYPE_PS, 0}},
|
{13, &Jit64::ps_muls}, //"ps_muls1", OPTYPE_PS, 0}},
|
||||||
{14, &Jit64::ps_maddXX}, //"ps_madds0", OPTYPE_PS, 0}},
|
{14, &Jit64::ps_maddXX}, //"ps_madds0", OPTYPE_PS, 0}},
|
||||||
{15, &Jit64::ps_maddXX}, //"ps_madds1", OPTYPE_PS, 0}},
|
{15, &Jit64::ps_maddXX}, //"ps_madds1", OPTYPE_PS, 0}},
|
||||||
{18, &Jit64::ps_arith}, //"ps_div", OPTYPE_PS, 0, 16}},
|
{18, &Jit64::ps_arith}, //"ps_div", OPTYPE_PS, 0, 16}},
|
||||||
{20, &Jit64::ps_arith}, //"ps_sub", OPTYPE_PS, 0}},
|
{20, &Jit64::ps_arith}, //"ps_sub", OPTYPE_PS, 0}},
|
||||||
{21, &Jit64::ps_arith}, //"ps_add", OPTYPE_PS, 0}},
|
{21, &Jit64::ps_arith}, //"ps_add", OPTYPE_PS, 0}},
|
||||||
{23, &Jit64::ps_sel}, //"ps_sel", OPTYPE_PS, 0}},
|
{23, &Jit64::ps_sel}, //"ps_sel", OPTYPE_PS, 0}},
|
||||||
{24, &Jit64::Default}, //"ps_res", OPTYPE_PS, 0}},
|
{24, &Jit64::Default}, //"ps_res", OPTYPE_PS, 0}},
|
||||||
{25, &Jit64::ps_arith}, //"ps_mul", OPTYPE_PS, 0}},
|
{25, &Jit64::ps_arith}, //"ps_mul", OPTYPE_PS, 0}},
|
||||||
{26, &Jit64::ps_rsqrte}, //"ps_rsqrte", OPTYPE_PS, 0, 1}},
|
{26, &Jit64::ps_rsqrte}, //"ps_rsqrte", OPTYPE_PS, 0, 1}},
|
||||||
{28, &Jit64::ps_maddXX}, //"ps_msub", OPTYPE_PS, 0}},
|
{28, &Jit64::ps_maddXX}, //"ps_msub", OPTYPE_PS, 0}},
|
||||||
{29, &Jit64::ps_maddXX}, //"ps_madd", OPTYPE_PS, 0}},
|
{29, &Jit64::ps_maddXX}, //"ps_madd", OPTYPE_PS, 0}},
|
||||||
{30, &Jit64::ps_maddXX}, //"ps_nmsub", OPTYPE_PS, 0}},
|
{30, &Jit64::ps_maddXX}, //"ps_nmsub", OPTYPE_PS, 0}},
|
||||||
{31, &Jit64::ps_maddXX}, //"ps_nmadd", OPTYPE_PS, 0}},
|
{31, &Jit64::ps_maddXX}, //"ps_nmadd", OPTYPE_PS, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static GekkoOPTemplate table4_3[] =
|
static GekkoOPTemplate table4_3[] =
|
||||||
{
|
{
|
||||||
{6, &Jit64::Default}, //"psq_lx", OPTYPE_PS, 0}},
|
{6, &Jit64::Default}, //"psq_lx", OPTYPE_PS, 0}},
|
||||||
{7, &Jit64::Default}, //"psq_stx", OPTYPE_PS, 0}},
|
{7, &Jit64::Default}, //"psq_stx", OPTYPE_PS, 0}},
|
||||||
{38, &Jit64::Default}, //"psq_lux", OPTYPE_PS, 0}},
|
{38, &Jit64::Default}, //"psq_lux", OPTYPE_PS, 0}},
|
||||||
{39, &Jit64::Default}, //"psq_stux", OPTYPE_PS, 0}},
|
{39, &Jit64::Default}, //"psq_stux", OPTYPE_PS, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table19[] =
|
static GekkoOPTemplate table19[] =
|
||||||
{
|
{
|
||||||
{528, &Jit64::bcctrx}, //"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
{528, &Jit64::bcctrx}, //"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
||||||
{16, &Jit64::bclrx}, //"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
{16, &Jit64::bclrx}, //"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
||||||
{257, &Jit64::Default}, //"crand", OPTYPE_CR, FL_EVIL}},
|
{257, &Jit64::Default}, //"crand", OPTYPE_CR, FL_EVIL}},
|
||||||
{129, &Jit64::Default}, //"crandc", OPTYPE_CR, FL_EVIL}},
|
{129, &Jit64::Default}, //"crandc", OPTYPE_CR, FL_EVIL}},
|
||||||
{289, &Jit64::Default}, //"creqv", OPTYPE_CR, FL_EVIL}},
|
{289, &Jit64::Default}, //"creqv", OPTYPE_CR, FL_EVIL}},
|
||||||
{225, &Jit64::Default}, //"crnand", OPTYPE_CR, FL_EVIL}},
|
{225, &Jit64::Default}, //"crnand", OPTYPE_CR, FL_EVIL}},
|
||||||
{33, &Jit64::Default}, //"crnor", OPTYPE_CR, FL_EVIL}},
|
{33, &Jit64::Default}, //"crnor", OPTYPE_CR, FL_EVIL}},
|
||||||
{449, &Jit64::Default}, //"cror", OPTYPE_CR, FL_EVIL}},
|
{449, &Jit64::Default}, //"cror", OPTYPE_CR, FL_EVIL}},
|
||||||
{417, &Jit64::Default}, //"crorc", OPTYPE_CR, FL_EVIL}},
|
{417, &Jit64::Default}, //"crorc", OPTYPE_CR, FL_EVIL}},
|
||||||
{193, &Jit64::Default}, //"crxor", OPTYPE_CR, FL_EVIL}},
|
{193, &Jit64::Default}, //"crxor", OPTYPE_CR, FL_EVIL}},
|
||||||
|
|
||||||
{150, &Jit64::DoNothing}, //"isync", OPTYPE_ICACHE, FL_EVIL}},
|
{150, &Jit64::DoNothing}, //"isync", OPTYPE_ICACHE, FL_EVIL}},
|
||||||
{0, &Jit64::Default}, //"mcrf", OPTYPE_SYSTEM, FL_EVIL}},
|
{0, &Jit64::Default}, //"mcrf", OPTYPE_SYSTEM, FL_EVIL}},
|
||||||
|
|
||||||
{50, &Jit64::rfi}, //"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}},
|
{50, &Jit64::rfi}, //"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}},
|
||||||
{18, &Jit64::Default}, //"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}}
|
{18, &Jit64::Default}, //"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static GekkoOPTemplate table31[] =
|
static GekkoOPTemplate table31[] =
|
||||||
{
|
{
|
||||||
{28, &Jit64::andx}, //"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{28, &Jit64::andx}, //"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{60, &Jit64::Default}, //"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{60, &Jit64::Default}, //"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{444, &Jit64::orx}, //"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{444, &Jit64::orx}, //"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{124, &Jit64::Default}, //"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{124, &Jit64::Default}, //"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{316, &Jit64::xorx}, //"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{316, &Jit64::xorx}, //"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{412, &Jit64::Default}, //"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{412, &Jit64::Default}, //"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{476, &Jit64::Default}, //"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{476, &Jit64::Default}, //"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{284, &Jit64::Default}, //"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{284, &Jit64::Default}, //"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{0, &Jit64::cmpXX}, //"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
{0, &Jit64::cmpXX}, //"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
||||||
{32, &Jit64::cmpXX}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
{32, &Jit64::cmpXX}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
||||||
{26, &Jit64::cntlzwx}, //"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{26, &Jit64::cntlzwx}, //"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{922, &Jit64::extshx}, //"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{922, &Jit64::extshx}, //"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{954, &Jit64::extsbx}, //"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{954, &Jit64::extsbx}, //"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{536, &Jit64::srwx}, //"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{536, &Jit64::srwx}, //"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{792, &Jit64::srawx}, //"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{792, &Jit64::srawx}, //"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{824, &Jit64::srawix}, //"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{824, &Jit64::srawix}, //"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{24, &Jit64::slwx}, //"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{24, &Jit64::slwx}, //"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
|
|
||||||
{54, &Jit64::Default}, //"dcbst", OPTYPE_DCACHE, 0, 4}},
|
{54, &Jit64::Default}, //"dcbst", OPTYPE_DCACHE, 0, 4}},
|
||||||
{86, &Jit64::DoNothing}, //"dcbf", OPTYPE_DCACHE, 0, 4}},
|
{86, &Jit64::DoNothing}, //"dcbf", OPTYPE_DCACHE, 0, 4}},
|
||||||
{246, &Jit64::Default}, //"dcbtst", OPTYPE_DCACHE, 0, 1}},
|
{246, &Jit64::Default}, //"dcbtst", OPTYPE_DCACHE, 0, 1}},
|
||||||
{278, &Jit64::Default}, //"dcbt", OPTYPE_DCACHE, 0, 1}},
|
{278, &Jit64::Default}, //"dcbt", OPTYPE_DCACHE, 0, 1}},
|
||||||
{470, &Jit64::Default}, //"dcbi", OPTYPE_DCACHE, 0, 4}},
|
{470, &Jit64::Default}, //"dcbi", OPTYPE_DCACHE, 0, 4}},
|
||||||
{758, &Jit64::Default}, //"dcba", OPTYPE_DCACHE, 0, 4}},
|
{758, &Jit64::Default}, //"dcba", OPTYPE_DCACHE, 0, 4}},
|
||||||
{1014, &Jit64::dcbz}, //"dcbz", OPTYPE_DCACHE, 0, 4}},
|
{1014, &Jit64::dcbz}, //"dcbz", OPTYPE_DCACHE, 0, 4}},
|
||||||
|
|
||||||
//load word
|
//load word
|
||||||
{23, &Jit64::lwzx}, //"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{23, &Jit64::lwzx}, //"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{55, &Jit64::lwzux}, //"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{55, &Jit64::lwzux}, //"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load halfword
|
//load halfword
|
||||||
{279, &Jit64::Default}, //"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{279, &Jit64::Default}, //"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{311, &Jit64::Default}, //"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{311, &Jit64::Default}, //"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load halfword signextend
|
//load halfword signextend
|
||||||
{343, &Jit64::lhax}, //"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{343, &Jit64::lhax}, //"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{375, &Jit64::Default}, //"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{375, &Jit64::Default}, //"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load byte
|
//load byte
|
||||||
{87, &Jit64::lbzx}, //"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{87, &Jit64::lbzx}, //"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{119, &Jit64::Default}, //"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{119, &Jit64::Default}, //"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load byte reverse
|
//load byte reverse
|
||||||
{534, &Jit64::Default}, //"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{534, &Jit64::Default}, //"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{790, &Jit64::Default}, //"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{790, &Jit64::Default}, //"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
|
|
||||||
// Conditional load/store (Wii SMP)
|
// Conditional load/store (Wii SMP)
|
||||||
{150, &Jit64::Default}, //"stwcxd", OPTYPE_STORE, FL_EVIL | FL_SET_CR0}},
|
{150, &Jit64::Default}, //"stwcxd", OPTYPE_STORE, FL_EVIL | FL_SET_CR0}},
|
||||||
{20, &Jit64::Default}, //"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B | FL_SET_CR0}},
|
{20, &Jit64::Default}, //"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B | FL_SET_CR0}},
|
||||||
|
|
||||||
//load string (interpret these)
|
//load string (interpret these)
|
||||||
{533, &Jit64::Default}, //"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}},
|
{533, &Jit64::Default}, //"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}},
|
||||||
{597, &Jit64::Default}, //"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}},
|
{597, &Jit64::Default}, //"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}},
|
||||||
|
|
||||||
//store word
|
//store word
|
||||||
{151, &Jit64::stXx}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{151, &Jit64::stXx}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{183, &Jit64::stXx}, //"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{183, &Jit64::stXx}, //"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store halfword
|
//store halfword
|
||||||
{407, &Jit64::stXx}, //"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{407, &Jit64::stXx}, //"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{439, &Jit64::stXx}, //"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{439, &Jit64::stXx}, //"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store byte
|
//store byte
|
||||||
{215, &Jit64::stXx}, //"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{215, &Jit64::stXx}, //"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{247, &Jit64::stXx}, //"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{247, &Jit64::stXx}, //"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store bytereverse
|
//store bytereverse
|
||||||
{662, &Jit64::Default}, //"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{662, &Jit64::Default}, //"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{918, &Jit64::Default}, //"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}},
|
{918, &Jit64::Default}, //"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
{661, &Jit64::Default}, //"stswx", OPTYPE_STORE, FL_EVIL}},
|
{661, &Jit64::Default}, //"stswx", OPTYPE_STORE, FL_EVIL}},
|
||||||
{725, &Jit64::Default}, //"stswi", OPTYPE_STORE, FL_EVIL}},
|
{725, &Jit64::Default}, //"stswi", OPTYPE_STORE, FL_EVIL}},
|
||||||
|
|
||||||
// fp load/store
|
// fp load/store
|
||||||
{535, &Jit64::lfsx}, //"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
{535, &Jit64::lfsx}, //"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{567, &Jit64::Default}, //"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
{567, &Jit64::Default}, //"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
||||||
{599, &Jit64::Default}, //"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
{599, &Jit64::Default}, //"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{631, &Jit64::Default}, //"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
{631, &Jit64::Default}, //"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
{663, &Jit64::stfsx}, //"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{663, &Jit64::stfsx}, //"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{695, &Jit64::Default}, //"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
{695, &Jit64::Default}, //"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
||||||
{727, &Jit64::Default}, //"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{727, &Jit64::Default}, //"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{759, &Jit64::Default}, //"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
{759, &Jit64::Default}, //"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
||||||
{983, &Jit64::Default}, //"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{983, &Jit64::Default}, //"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
|
|
||||||
{19, &Jit64::mfcr}, //"mfcr", OPTYPE_SYSTEM, FL_OUT_D}},
|
{19, &Jit64::mfcr}, //"mfcr", OPTYPE_SYSTEM, FL_OUT_D}},
|
||||||
{83, &Jit64::mfmsr}, //"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}},
|
{83, &Jit64::mfmsr}, //"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}},
|
||||||
{144, &Jit64::mtcrf}, //"mtcrf", OPTYPE_SYSTEM, 0}},
|
{144, &Jit64::mtcrf}, //"mtcrf", OPTYPE_SYSTEM, 0}},
|
||||||
{146, &Jit64::mtmsr}, //"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{146, &Jit64::mtmsr}, //"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{210, &Jit64::Default}, //"mtsr", OPTYPE_SYSTEM, 0}},
|
{210, &Jit64::Default}, //"mtsr", OPTYPE_SYSTEM, 0}},
|
||||||
{242, &Jit64::Default}, //"mtsrin", OPTYPE_SYSTEM, 0}},
|
{242, &Jit64::Default}, //"mtsrin", OPTYPE_SYSTEM, 0}},
|
||||||
{339, &Jit64::mfspr}, //"mfspr", OPTYPE_SPR, FL_OUT_D}},
|
{339, &Jit64::mfspr}, //"mfspr", OPTYPE_SPR, FL_OUT_D}},
|
||||||
{467, &Jit64::mtspr}, //"mtspr", OPTYPE_SPR, 0, 2}},
|
{467, &Jit64::mtspr}, //"mtspr", OPTYPE_SPR, 0, 2}},
|
||||||
{371, &Jit64::mftb}, //"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}},
|
{371, &Jit64::mftb}, //"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}},
|
||||||
{512, &Jit64::Default}, //"mcrxr", OPTYPE_SYSTEM, 0}},
|
{512, &Jit64::Default}, //"mcrxr", OPTYPE_SYSTEM, 0}},
|
||||||
{595, &Jit64::Default}, //"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
{595, &Jit64::Default}, //"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
||||||
{659, &Jit64::Default}, //"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
{659, &Jit64::Default}, //"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
||||||
|
|
||||||
{4, &Jit64::Default}, //"tw", OPTYPE_SYSTEM, 0, 1}},
|
{4, &Jit64::Default}, //"tw", OPTYPE_SYSTEM, 0, 1}},
|
||||||
{598, &Jit64::DoNothing}, //"sync", OPTYPE_SYSTEM, 0, 2}},
|
{598, &Jit64::DoNothing}, //"sync", OPTYPE_SYSTEM, 0, 2}},
|
||||||
{982, &Jit64::icbi}, //"icbi", OPTYPE_SYSTEM, FL_ENDBLOCK, 3}},
|
{982, &Jit64::icbi}, //"icbi", OPTYPE_SYSTEM, FL_ENDBLOCK, 3}},
|
||||||
|
|
||||||
// Unused instructions on GC
|
// Unused instructions on GC
|
||||||
{310, &Jit64::Default}, //"eciwx", OPTYPE_INTEGER, FL_RC_BIT}},
|
{310, &Jit64::Default}, //"eciwx", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{438, &Jit64::Default}, //"ecowx", OPTYPE_INTEGER, FL_RC_BIT}},
|
{438, &Jit64::Default}, //"ecowx", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{854, &Jit64::Default}, //"eieio", OPTYPE_INTEGER, FL_RC_BIT}},
|
{854, &Jit64::Default}, //"eieio", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{306, &Jit64::Default}, //"tlbie", OPTYPE_SYSTEM, 0}},
|
{306, &Jit64::Default}, //"tlbie", OPTYPE_SYSTEM, 0}},
|
||||||
{370, &Jit64::Default}, //"tlbia", OPTYPE_SYSTEM, 0}},
|
{370, &Jit64::Default}, //"tlbia", OPTYPE_SYSTEM, 0}},
|
||||||
{566, &Jit64::Default}, //"tlbsync", OPTYPE_SYSTEM, 0}},
|
{566, &Jit64::Default}, //"tlbsync", OPTYPE_SYSTEM, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table31_2[] =
|
static GekkoOPTemplate table31_2[] =
|
||||||
{
|
{
|
||||||
{266, &Jit64::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{266, &Jit64::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{10, &Jit64::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
{10, &Jit64::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
||||||
{138, &Jit64::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{138, &Jit64::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{234, &Jit64::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{234, &Jit64::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{202, &Jit64::Default}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{202, &Jit64::Default}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{491, &Jit64::Default}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
{491, &Jit64::Default}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
||||||
{459, &Jit64::divwux}, //"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
{459, &Jit64::divwux}, //"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
||||||
{75, &Jit64::Default}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{75, &Jit64::Default}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{11, &Jit64::mulhwux}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{11, &Jit64::mulhwux}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{235, &Jit64::mullwx}, //"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{235, &Jit64::mullwx}, //"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{104, &Jit64::negx}, //"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{104, &Jit64::negx}, //"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{40, &Jit64::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{40, &Jit64::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{8, &Jit64::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
{8, &Jit64::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
||||||
{136, &Jit64::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{136, &Jit64::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{232, &Jit64::Default}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{232, &Jit64::Default}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{200, &Jit64::Default}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{200, &Jit64::Default}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table59[] =
|
static GekkoOPTemplate table59[] =
|
||||||
{
|
{
|
||||||
{18, &Jit64::Default}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
|
{18, &Jit64::Default}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
|
||||||
{20, &Jit64::fp_arith_s}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{20, &Jit64::fp_arith_s}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{21, &Jit64::fp_arith_s}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{21, &Jit64::fp_arith_s}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
// {22, &Jit64::Default}, //"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko
|
// {22, &Jit64::Default}, //"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko
|
||||||
{24, &Jit64::Default}, //"fresx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{24, &Jit64::Default}, //"fresx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{25, &Jit64::fp_arith_s}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{25, &Jit64::fp_arith_s}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{28, &Jit64::fmaddXX}, //"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{28, &Jit64::fmaddXX}, //"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{29, &Jit64::fmaddXX}, //"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{29, &Jit64::fmaddXX}, //"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{30, &Jit64::fmaddXX}, //"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{30, &Jit64::fmaddXX}, //"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{31, &Jit64::fmaddXX}, //"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{31, &Jit64::fmaddXX}, //"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table63[] =
|
static GekkoOPTemplate table63[] =
|
||||||
{
|
{
|
||||||
{264, &Jit64::fsign}, //"fabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{264, &Jit64::fsign}, //"fabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{32, &Jit64::fcmpx}, //"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}},
|
{32, &Jit64::fcmpx}, //"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{0, &Jit64::fcmpx}, //"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}},
|
{0, &Jit64::fcmpx}, //"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{14, &Jit64::Default}, //"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{14, &Jit64::Default}, //"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{15, &Jit64::Default}, //"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{15, &Jit64::Default}, //"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{72, &Jit64::fmrx}, //"fmrx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{72, &Jit64::fmrx}, //"fmrx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{136, &Jit64::fsign}, //"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{136, &Jit64::fsign}, //"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{40, &Jit64::fsign}, //"fnegx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{40, &Jit64::fsign}, //"fnegx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{12, &Jit64::Default}, //"frspx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{12, &Jit64::Default}, //"frspx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
|
|
||||||
{64, &Jit64::Default}, //"mcrfs", OPTYPE_SYSTEMFP, 0}},
|
{64, &Jit64::Default}, //"mcrfs", OPTYPE_SYSTEMFP, 0}},
|
||||||
{583, &Jit64::Default}, //"mffsx", OPTYPE_SYSTEMFP, 0}},
|
{583, &Jit64::Default}, //"mffsx", OPTYPE_SYSTEMFP, 0}},
|
||||||
{70, &Jit64::Default}, //"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}},
|
{70, &Jit64::Default}, //"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{38, &Jit64::Default}, //"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}},
|
{38, &Jit64::Default}, //"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{134, &Jit64::Default}, //"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}},
|
{134, &Jit64::Default}, //"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{711, &Jit64::Default}, //"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}},
|
{711, &Jit64::Default}, //"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table63_2[] =
|
static GekkoOPTemplate table63_2[] =
|
||||||
{
|
{
|
||||||
{18, &Jit64::Default}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
|
{18, &Jit64::Default}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
|
||||||
{20, &Jit64::Default}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{20, &Jit64::Default}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{21, &Jit64::Default}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{21, &Jit64::Default}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{22, &Jit64::Default}, //"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{22, &Jit64::Default}, //"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{23, &Jit64::Default}, //"fselx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{23, &Jit64::Default}, //"fselx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{25, &Jit64::fp_arith_s}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{25, &Jit64::fp_arith_s}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{26, &Jit64::fp_arith_s}, //"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}},
|
{26, &Jit64::fp_arith_s}, //"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{28, &Jit64::fmaddXX}, //"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{28, &Jit64::fmaddXX}, //"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{29, &Jit64::fmaddXX}, //"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{29, &Jit64::fmaddXX}, //"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{30, &Jit64::fmaddXX}, //"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{30, &Jit64::fmaddXX}, //"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{31, &Jit64::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{31, &Jit64::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Jit64Tables
|
namespace Jit64Tables
|
||||||
{
|
{
|
||||||
|
|
||||||
void CompileInstruction(UGeckoInstruction _inst)
|
void CompileInstruction(UGeckoInstruction _inst)
|
||||||
{
|
{
|
||||||
Jit64 *jit64 = (Jit64 *)jit;
|
Jit64 *jit64 = (Jit64 *)jit;
|
||||||
(jit64->*dynaOpTable[_inst.OPCD])(_inst);
|
(jit64->*dynaOpTable[_inst.OPCD])(_inst);
|
||||||
GekkoOPInfo *info = GetOpInfo(_inst);
|
GekkoOPInfo *info = GetOpInfo(_inst);
|
||||||
if (info) {
|
if (info) {
|
||||||
#ifdef OPLOG
|
#ifdef OPLOG
|
||||||
if (!strcmp(info->opname, OP_TO_LOG)){ ///"mcrfs"
|
if (!strcmp(info->opname, OP_TO_LOG)){ ///"mcrfs"
|
||||||
rsplocations.push_back(jit.js.compilerPC);
|
rsplocations.push_back(jit.js.compilerPC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
info->compileCount++;
|
info->compileCount++;
|
||||||
info->lastUse = jit->js.compilerPC;
|
info->lastUse = jit->js.compilerPC;
|
||||||
} else {
|
} else {
|
||||||
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, jit->js.compilerPC);
|
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, jit->js.compilerPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitTables()
|
void InitTables()
|
||||||
{
|
{
|
||||||
//clear
|
//clear
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
dynaOpTable59[i] = &Jit64::unknown_instruction;
|
dynaOpTable59[i] = &Jit64::unknown_instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1024; i++)
|
for (int i = 0; i < 1024; i++)
|
||||||
{
|
{
|
||||||
dynaOpTable4 [i] = &Jit64::unknown_instruction;
|
dynaOpTable4 [i] = &Jit64::unknown_instruction;
|
||||||
dynaOpTable19[i] = &Jit64::unknown_instruction;
|
dynaOpTable19[i] = &Jit64::unknown_instruction;
|
||||||
dynaOpTable31[i] = &Jit64::unknown_instruction;
|
dynaOpTable31[i] = &Jit64::unknown_instruction;
|
||||||
dynaOpTable63[i] = &Jit64::unknown_instruction;
|
dynaOpTable63[i] = &Jit64::unknown_instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(primarytable) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(primarytable) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
dynaOpTable[primarytable[i].opcode] = primarytable[i].Inst;
|
dynaOpTable[primarytable[i].opcode] = primarytable[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 5;
|
int fill = i << 5;
|
||||||
for (int j = 0; j < (int)(sizeof(table4_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table4_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill+table4_2[j].opcode;
|
int op = fill+table4_2[j].opcode;
|
||||||
dynaOpTable4[op] = table4_2[j].Inst;
|
dynaOpTable4[op] = table4_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 6;
|
int fill = i << 6;
|
||||||
for (int j = 0; j < (int)(sizeof(table4_3) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table4_3) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill+table4_3[j].opcode;
|
int op = fill+table4_3[j].opcode;
|
||||||
dynaOpTable4[op] = table4_3[j].Inst;
|
dynaOpTable4[op] = table4_3[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table4) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table4) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table4[i].opcode;
|
int op = table4[i].opcode;
|
||||||
dynaOpTable4[op] = table4[i].Inst;
|
dynaOpTable4[op] = table4[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table31) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table31) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table31[i].opcode;
|
int op = table31[i].opcode;
|
||||||
dynaOpTable31[op] = table31[i].Inst;
|
dynaOpTable31[op] = table31[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1; i++)
|
for (int i = 0; i < 1; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 9;
|
int fill = i << 9;
|
||||||
for (int j = 0; j < (int)(sizeof(table31_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table31_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill + table31_2[j].opcode;
|
int op = fill + table31_2[j].opcode;
|
||||||
dynaOpTable31[op] = table31_2[j].Inst;
|
dynaOpTable31[op] = table31_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table19) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table19) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table19[i].opcode;
|
int op = table19[i].opcode;
|
||||||
dynaOpTable19[op] = table19[i].Inst;
|
dynaOpTable19[op] = table19[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table59) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table59) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table59[i].opcode;
|
int op = table59[i].opcode;
|
||||||
dynaOpTable59[op] = table59[i].Inst;
|
dynaOpTable59[op] = table59[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table63) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table63) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table63[i].opcode;
|
int op = table63[i].opcode;
|
||||||
dynaOpTable63[op] = table63[i].Inst;
|
dynaOpTable63[op] = table63[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 5;
|
int fill = i << 5;
|
||||||
for (int j = 0; j < (int)(sizeof(table63_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table63_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill + table63_2[j].opcode;
|
int op = fill + table63_2[j].opcode;
|
||||||
dynaOpTable63[op] = table63_2[j].Inst;
|
dynaOpTable63[op] = table63_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef JIT64_TABLES_H
|
#ifndef JIT64_TABLES_H
|
||||||
#define JIT64_TABLES_H
|
#define JIT64_TABLES_H
|
||||||
|
|
||||||
#include "../Gekko.h"
|
#include "../Gekko.h"
|
||||||
#include "../PPCTables.h"
|
#include "../PPCTables.h"
|
||||||
#include "../Jit64/Jit.h"
|
#include "../Jit64/Jit.h"
|
||||||
|
|
||||||
namespace Jit64Tables
|
namespace Jit64Tables
|
||||||
{
|
{
|
||||||
void CompileInstruction(UGeckoInstruction _inst);
|
void CompileInstruction(UGeckoInstruction _inst);
|
||||||
void InitTables();
|
void InitTables();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,487 +1,487 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "JitIL_Tables.h"
|
#include "JitIL_Tables.h"
|
||||||
|
|
||||||
// Should be moved in to the Jit class
|
// Should be moved in to the Jit class
|
||||||
typedef void (JitIL::*_Instruction) (UGeckoInstruction instCode);
|
typedef void (JitIL::*_Instruction) (UGeckoInstruction instCode);
|
||||||
|
|
||||||
static _Instruction dynaOpTable[64];
|
static _Instruction dynaOpTable[64];
|
||||||
static _Instruction dynaOpTable4[1024];
|
static _Instruction dynaOpTable4[1024];
|
||||||
static _Instruction dynaOpTable19[1024];
|
static _Instruction dynaOpTable19[1024];
|
||||||
static _Instruction dynaOpTable31[1024];
|
static _Instruction dynaOpTable31[1024];
|
||||||
static _Instruction dynaOpTable59[32];
|
static _Instruction dynaOpTable59[32];
|
||||||
static _Instruction dynaOpTable63[1024];
|
static _Instruction dynaOpTable63[1024];
|
||||||
|
|
||||||
void JitIL::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
|
void JitIL::DynaRunTable4(UGeckoInstruction _inst) {(this->*dynaOpTable4 [_inst.SUBOP10])(_inst);}
|
||||||
void JitIL::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
|
void JitIL::DynaRunTable19(UGeckoInstruction _inst) {(this->*dynaOpTable19[_inst.SUBOP10])(_inst);}
|
||||||
void JitIL::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);}
|
void JitIL::DynaRunTable31(UGeckoInstruction _inst) {(this->*dynaOpTable31[_inst.SUBOP10])(_inst);}
|
||||||
void JitIL::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);}
|
void JitIL::DynaRunTable59(UGeckoInstruction _inst) {(this->*dynaOpTable59[_inst.SUBOP5 ])(_inst);}
|
||||||
void JitIL::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);}
|
void JitIL::DynaRunTable63(UGeckoInstruction _inst) {(this->*dynaOpTable63[_inst.SUBOP10])(_inst);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct GekkoOPTemplate
|
struct GekkoOPTemplate
|
||||||
{
|
{
|
||||||
int opcode;
|
int opcode;
|
||||||
_Instruction Inst;
|
_Instruction Inst;
|
||||||
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
|
//GekkoOPInfo opinfo; // Doesn't need opinfo, Interpreter fills it out
|
||||||
int runCount;
|
int runCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate primarytable[] =
|
static GekkoOPTemplate primarytable[] =
|
||||||
{
|
{
|
||||||
{4, &JitIL::DynaRunTable4}, //"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}},
|
{4, &JitIL::DynaRunTable4}, //"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0}},
|
||||||
{19, &JitIL::DynaRunTable19}, //"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}},
|
{19, &JitIL::DynaRunTable19}, //"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0}},
|
||||||
{31, &JitIL::DynaRunTable31}, //"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}},
|
{31, &JitIL::DynaRunTable31}, //"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0}},
|
||||||
{59, &JitIL::DynaRunTable59}, //"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}},
|
{59, &JitIL::DynaRunTable59}, //"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0}},
|
||||||
{63, &JitIL::DynaRunTable63}, //"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}},
|
{63, &JitIL::DynaRunTable63}, //"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0}},
|
||||||
|
|
||||||
{16, &JitIL::bcx}, //"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{16, &JitIL::bcx}, //"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{18, &JitIL::bx}, //"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{18, &JitIL::bx}, //"bx", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
|
|
||||||
{1, &JitIL::HLEFunction}, //"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{1, &JitIL::HLEFunction}, //"HLEFunction", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{2, &JitIL::Default}, //"DynaBlock", OPTYPE_SYSTEM, 0}},
|
{2, &JitIL::Default}, //"DynaBlock", OPTYPE_SYSTEM, 0}},
|
||||||
{3, &JitIL::Default}, //"twi", OPTYPE_SYSTEM, 0}},
|
{3, &JitIL::Default}, //"twi", OPTYPE_SYSTEM, 0}},
|
||||||
{17, &JitIL::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
|
{17, &JitIL::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
|
||||||
|
|
||||||
{7, &JitIL::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
|
{7, &JitIL::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
|
||||||
{8, &JitIL::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
{8, &JitIL::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
||||||
{10, &JitIL::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
{10, &JitIL::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
||||||
{11, &JitIL::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
{11, &JitIL::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
|
||||||
{12, &JitIL::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
{12, &JitIL::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
|
||||||
{13, &JitIL::reg_imm}, //"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}},
|
{13, &JitIL::reg_imm}, //"addic_rc", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CR0}},
|
||||||
{14, &JitIL::reg_imm}, //"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
{14, &JitIL::reg_imm}, //"addi", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
||||||
{15, &JitIL::reg_imm}, //"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
{15, &JitIL::reg_imm}, //"addis", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A0}},
|
||||||
|
|
||||||
{20, &JitIL::rlwimix}, //"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}},
|
{20, &JitIL::rlwimix}, //"rlwimix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{21, &JitIL::rlwinmx}, //"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{21, &JitIL::rlwinmx}, //"rlwinmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{23, &JitIL::rlwnmx}, //"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}},
|
{23, &JitIL::rlwnmx}, //"rlwnmx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_IN_B | FL_RC_BIT}},
|
||||||
|
|
||||||
{24, &JitIL::reg_imm}, //"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{24, &JitIL::reg_imm}, //"ori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{25, &JitIL::reg_imm}, //"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{25, &JitIL::reg_imm}, //"oris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{26, &JitIL::reg_imm}, //"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{26, &JitIL::reg_imm}, //"xori", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{27, &JitIL::reg_imm}, //"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
{27, &JitIL::reg_imm}, //"xoris", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S}},
|
||||||
{28, &JitIL::reg_imm}, //"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
{28, &JitIL::reg_imm}, //"andi_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
||||||
{29, &JitIL::reg_imm}, //"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
{29, &JitIL::reg_imm}, //"andis_rc", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_SET_CR0}},
|
||||||
|
|
||||||
{32, &JitIL::lXz}, //"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{32, &JitIL::lXz}, //"lwz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{33, &JitIL::lXz}, //"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{33, &JitIL::lXz}, //"lwzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{34, &JitIL::lXz}, //"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{34, &JitIL::lXz}, //"lbz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{35, &JitIL::Default}, //"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{35, &JitIL::Default}, //"lbzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{40, &JitIL::lXz}, //"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{40, &JitIL::lXz}, //"lhz", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{41, &JitIL::lXz}, //"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{41, &JitIL::lXz}, //"lhzu", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
{42, &JitIL::lha}, //"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
{42, &JitIL::lha}, //"lha", OPTYPE_LOAD, FL_OUT_D | FL_IN_A}},
|
||||||
{43, &JitIL::Default}, //"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
{43, &JitIL::Default}, //"lhau", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{44, &JitIL::stX}, //"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{44, &JitIL::stX}, //"sth", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{45, &JitIL::stX}, //"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{45, &JitIL::stX}, //"sthu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
{36, &JitIL::stX}, //"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{36, &JitIL::stX}, //"stw", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{37, &JitIL::stX}, //"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{37, &JitIL::stX}, //"stwu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
{38, &JitIL::stX}, //"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
{38, &JitIL::stX}, //"stb", OPTYPE_STORE, FL_IN_A | FL_IN_S}},
|
||||||
{39, &JitIL::stX}, //"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
{39, &JitIL::stX}, //"stbu", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_S}},
|
||||||
|
|
||||||
{46, &JitIL::lmw}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
{46, &JitIL::lmw}, //"lmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
||||||
{47, &JitIL::stmw}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
{47, &JitIL::stmw}, //"stmw", OPTYPE_SYSTEM, FL_EVIL, 10}},
|
||||||
|
|
||||||
{48, &JitIL::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},
|
{48, &JitIL::lfs}, //"lfs", OPTYPE_LOADFP, FL_IN_A}},
|
||||||
{49, &JitIL::Default}, //"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
{49, &JitIL::Default}, //"lfsu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
||||||
{50, &JitIL::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
|
{50, &JitIL::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}},
|
||||||
{51, &JitIL::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
{51, &JitIL::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{52, &JitIL::stfs}, //"stfs", OPTYPE_STOREFP, FL_IN_A}},
|
{52, &JitIL::stfs}, //"stfs", OPTYPE_STOREFP, FL_IN_A}},
|
||||||
{53, &JitIL::stfs}, //"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
{53, &JitIL::stfs}, //"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
||||||
{54, &JitIL::stfd}, //"stfd", OPTYPE_STOREFP, FL_IN_A}},
|
{54, &JitIL::stfd}, //"stfd", OPTYPE_STOREFP, FL_IN_A}},
|
||||||
{55, &JitIL::Default}, //"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
{55, &JitIL::Default}, //"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
{56, &JitIL::psq_l}, //"psq_l", OPTYPE_PS, FL_IN_A}},
|
{56, &JitIL::psq_l}, //"psq_l", OPTYPE_PS, FL_IN_A}},
|
||||||
{57, &JitIL::psq_l}, //"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
{57, &JitIL::psq_l}, //"psq_lu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
||||||
{60, &JitIL::psq_st}, //"psq_st", OPTYPE_PS, FL_IN_A}},
|
{60, &JitIL::psq_st}, //"psq_st", OPTYPE_PS, FL_IN_A}},
|
||||||
{61, &JitIL::psq_st}, //"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
{61, &JitIL::psq_st}, //"psq_stu", OPTYPE_PS, FL_OUT_A | FL_IN_A}},
|
||||||
|
|
||||||
//missing: 0, 5, 6, 9, 22, 30, 62, 58
|
//missing: 0, 5, 6, 9, 22, 30, 62, 58
|
||||||
{0, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{0, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{5, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{5, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{6, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{6, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{9, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{9, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{22, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{22, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{30, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{30, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{62, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{62, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
{58, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
{58, &JitIL::Default}, //"unknown_instruction", OPTYPE_UNKNOWN, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table4[] =
|
static GekkoOPTemplate table4[] =
|
||||||
{ //SUBOP10
|
{ //SUBOP10
|
||||||
{0, &JitIL::Default}, //"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}},
|
{0, &JitIL::Default}, //"ps_cmpu0", OPTYPE_PS, FL_SET_CRn}},
|
||||||
{32, &JitIL::Default}, //"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}},
|
{32, &JitIL::Default}, //"ps_cmpo0", OPTYPE_PS, FL_SET_CRn}},
|
||||||
{40, &JitIL::ps_sign}, //"ps_neg", OPTYPE_PS, FL_RC_BIT}},
|
{40, &JitIL::ps_sign}, //"ps_neg", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{136, &JitIL::ps_sign}, //"ps_nabs", OPTYPE_PS, FL_RC_BIT}},
|
{136, &JitIL::ps_sign}, //"ps_nabs", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{264, &JitIL::ps_sign}, //"ps_abs", OPTYPE_PS, FL_RC_BIT}},
|
{264, &JitIL::ps_sign}, //"ps_abs", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{64, &JitIL::Default}, //"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}},
|
{64, &JitIL::Default}, //"ps_cmpu1", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{72, &JitIL::ps_mr}, //"ps_mr", OPTYPE_PS, FL_RC_BIT}},
|
{72, &JitIL::ps_mr}, //"ps_mr", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{96, &JitIL::Default}, //"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}},
|
{96, &JitIL::Default}, //"ps_cmpo1", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{528, &JitIL::ps_mergeXX}, //"ps_merge00", OPTYPE_PS, FL_RC_BIT}},
|
{528, &JitIL::ps_mergeXX}, //"ps_merge00", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{560, &JitIL::ps_mergeXX}, //"ps_merge01", OPTYPE_PS, FL_RC_BIT}},
|
{560, &JitIL::ps_mergeXX}, //"ps_merge01", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{592, &JitIL::ps_mergeXX}, //"ps_merge10", OPTYPE_PS, FL_RC_BIT}},
|
{592, &JitIL::ps_mergeXX}, //"ps_merge10", OPTYPE_PS, FL_RC_BIT}},
|
||||||
{624, &JitIL::ps_mergeXX}, //"ps_merge11", OPTYPE_PS, FL_RC_BIT}},
|
{624, &JitIL::ps_mergeXX}, //"ps_merge11", OPTYPE_PS, FL_RC_BIT}},
|
||||||
|
|
||||||
{1014, &JitIL::Default}, //"dcbz_l", OPTYPE_SYSTEM, 0}},
|
{1014, &JitIL::Default}, //"dcbz_l", OPTYPE_SYSTEM, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table4_2[] =
|
static GekkoOPTemplate table4_2[] =
|
||||||
{
|
{
|
||||||
{10, &JitIL::ps_sum}, //"ps_sum0", OPTYPE_PS, 0}},
|
{10, &JitIL::ps_sum}, //"ps_sum0", OPTYPE_PS, 0}},
|
||||||
{11, &JitIL::ps_sum}, //"ps_sum1", OPTYPE_PS, 0}},
|
{11, &JitIL::ps_sum}, //"ps_sum1", OPTYPE_PS, 0}},
|
||||||
{12, &JitIL::ps_muls}, //"ps_muls0", OPTYPE_PS, 0}},
|
{12, &JitIL::ps_muls}, //"ps_muls0", OPTYPE_PS, 0}},
|
||||||
{13, &JitIL::ps_muls}, //"ps_muls1", OPTYPE_PS, 0}},
|
{13, &JitIL::ps_muls}, //"ps_muls1", OPTYPE_PS, 0}},
|
||||||
{14, &JitIL::ps_maddXX}, //"ps_madds0", OPTYPE_PS, 0}},
|
{14, &JitIL::ps_maddXX}, //"ps_madds0", OPTYPE_PS, 0}},
|
||||||
{15, &JitIL::ps_maddXX}, //"ps_madds1", OPTYPE_PS, 0}},
|
{15, &JitIL::ps_maddXX}, //"ps_madds1", OPTYPE_PS, 0}},
|
||||||
{18, &JitIL::ps_arith}, //"ps_div", OPTYPE_PS, 0, 16}},
|
{18, &JitIL::ps_arith}, //"ps_div", OPTYPE_PS, 0, 16}},
|
||||||
{20, &JitIL::ps_arith}, //"ps_sub", OPTYPE_PS, 0}},
|
{20, &JitIL::ps_arith}, //"ps_sub", OPTYPE_PS, 0}},
|
||||||
{21, &JitIL::ps_arith}, //"ps_add", OPTYPE_PS, 0}},
|
{21, &JitIL::ps_arith}, //"ps_add", OPTYPE_PS, 0}},
|
||||||
{23, &JitIL::ps_sel}, //"ps_sel", OPTYPE_PS, 0}},
|
{23, &JitIL::ps_sel}, //"ps_sel", OPTYPE_PS, 0}},
|
||||||
{24, &JitIL::Default}, //"ps_res", OPTYPE_PS, 0}},
|
{24, &JitIL::Default}, //"ps_res", OPTYPE_PS, 0}},
|
||||||
{25, &JitIL::ps_arith}, //"ps_mul", OPTYPE_PS, 0}},
|
{25, &JitIL::ps_arith}, //"ps_mul", OPTYPE_PS, 0}},
|
||||||
{26, &JitIL::ps_rsqrte}, //"ps_rsqrte", OPTYPE_PS, 0, 1}},
|
{26, &JitIL::ps_rsqrte}, //"ps_rsqrte", OPTYPE_PS, 0, 1}},
|
||||||
{28, &JitIL::ps_maddXX}, //"ps_msub", OPTYPE_PS, 0}},
|
{28, &JitIL::ps_maddXX}, //"ps_msub", OPTYPE_PS, 0}},
|
||||||
{29, &JitIL::ps_maddXX}, //"ps_madd", OPTYPE_PS, 0}},
|
{29, &JitIL::ps_maddXX}, //"ps_madd", OPTYPE_PS, 0}},
|
||||||
{30, &JitIL::ps_maddXX}, //"ps_nmsub", OPTYPE_PS, 0}},
|
{30, &JitIL::ps_maddXX}, //"ps_nmsub", OPTYPE_PS, 0}},
|
||||||
{31, &JitIL::ps_maddXX}, //"ps_nmadd", OPTYPE_PS, 0}},
|
{31, &JitIL::ps_maddXX}, //"ps_nmadd", OPTYPE_PS, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static GekkoOPTemplate table4_3[] =
|
static GekkoOPTemplate table4_3[] =
|
||||||
{
|
{
|
||||||
{6, &JitIL::Default}, //"psq_lx", OPTYPE_PS, 0}},
|
{6, &JitIL::Default}, //"psq_lx", OPTYPE_PS, 0}},
|
||||||
{7, &JitIL::Default}, //"psq_stx", OPTYPE_PS, 0}},
|
{7, &JitIL::Default}, //"psq_stx", OPTYPE_PS, 0}},
|
||||||
{38, &JitIL::Default}, //"psq_lux", OPTYPE_PS, 0}},
|
{38, &JitIL::Default}, //"psq_lux", OPTYPE_PS, 0}},
|
||||||
{39, &JitIL::Default}, //"psq_stux", OPTYPE_PS, 0}},
|
{39, &JitIL::Default}, //"psq_stux", OPTYPE_PS, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table19[] =
|
static GekkoOPTemplate table19[] =
|
||||||
{
|
{
|
||||||
{528, &JitIL::bcctrx}, //"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
{528, &JitIL::bcctrx}, //"bcctrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
||||||
{16, &JitIL::bclrx}, //"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
{16, &JitIL::bclrx}, //"bclrx", OPTYPE_BRANCH, FL_ENDBLOCK}},
|
||||||
{257, &JitIL::Default}, //"crand", OPTYPE_CR, FL_EVIL}},
|
{257, &JitIL::Default}, //"crand", OPTYPE_CR, FL_EVIL}},
|
||||||
{129, &JitIL::Default}, //"crandc", OPTYPE_CR, FL_EVIL}},
|
{129, &JitIL::Default}, //"crandc", OPTYPE_CR, FL_EVIL}},
|
||||||
{289, &JitIL::Default}, //"creqv", OPTYPE_CR, FL_EVIL}},
|
{289, &JitIL::Default}, //"creqv", OPTYPE_CR, FL_EVIL}},
|
||||||
{225, &JitIL::Default}, //"crnand", OPTYPE_CR, FL_EVIL}},
|
{225, &JitIL::Default}, //"crnand", OPTYPE_CR, FL_EVIL}},
|
||||||
{33, &JitIL::Default}, //"crnor", OPTYPE_CR, FL_EVIL}},
|
{33, &JitIL::Default}, //"crnor", OPTYPE_CR, FL_EVIL}},
|
||||||
{449, &JitIL::Default}, //"cror", OPTYPE_CR, FL_EVIL}},
|
{449, &JitIL::Default}, //"cror", OPTYPE_CR, FL_EVIL}},
|
||||||
{417, &JitIL::Default}, //"crorc", OPTYPE_CR, FL_EVIL}},
|
{417, &JitIL::Default}, //"crorc", OPTYPE_CR, FL_EVIL}},
|
||||||
{193, &JitIL::Default}, //"crxor", OPTYPE_CR, FL_EVIL}},
|
{193, &JitIL::Default}, //"crxor", OPTYPE_CR, FL_EVIL}},
|
||||||
|
|
||||||
{150, &JitIL::DoNothing}, //"isync", OPTYPE_ICACHE, FL_EVIL}},
|
{150, &JitIL::DoNothing}, //"isync", OPTYPE_ICACHE, FL_EVIL}},
|
||||||
{0, &JitIL::Default}, //"mcrf", OPTYPE_SYSTEM, FL_EVIL}},
|
{0, &JitIL::Default}, //"mcrf", OPTYPE_SYSTEM, FL_EVIL}},
|
||||||
|
|
||||||
{50, &JitIL::rfi}, //"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}},
|
{50, &JitIL::rfi}, //"rfi", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS, 1}},
|
||||||
{18, &JitIL::Default}, //"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}}
|
{18, &JitIL::Default}, //"rfid", OPTYPE_SYSTEM, FL_ENDBLOCK | FL_CHECKEXCEPTIONS}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static GekkoOPTemplate table31[] =
|
static GekkoOPTemplate table31[] =
|
||||||
{
|
{
|
||||||
{28, &JitIL::andx}, //"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{28, &JitIL::andx}, //"andx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{60, &JitIL::Default}, //"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{60, &JitIL::Default}, //"andcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{444, &JitIL::orx}, //"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{444, &JitIL::orx}, //"orx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{124, &JitIL::Default}, //"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{124, &JitIL::Default}, //"norx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{316, &JitIL::xorx}, //"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{316, &JitIL::xorx}, //"xorx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{412, &JitIL::Default}, //"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{412, &JitIL::Default}, //"orcx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{476, &JitIL::Default}, //"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{476, &JitIL::Default}, //"nandx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{284, &JitIL::Default}, //"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
{284, &JitIL::Default}, //"eqvx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_SB | FL_RC_BIT}},
|
||||||
{0, &JitIL::cmpXX}, //"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
{0, &JitIL::cmpXX}, //"cmp", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
||||||
{32, &JitIL::cmpXX}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
{32, &JitIL::cmpXX}, //"cmpl", OPTYPE_INTEGER, FL_IN_AB | FL_SET_CRn}},
|
||||||
{26, &JitIL::cntlzwx}, //"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{26, &JitIL::cntlzwx}, //"cntlzwx",OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{922, &JitIL::extshx}, //"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{922, &JitIL::extshx}, //"extshx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{954, &JitIL::extsbx}, //"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
{954, &JitIL::extsbx}, //"extsbx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_S | FL_RC_BIT}},
|
||||||
{536, &JitIL::srwx}, //"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{536, &JitIL::srwx}, //"srwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{792, &JitIL::srawx}, //"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{792, &JitIL::srawx}, //"srawx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{824, &JitIL::srawix}, //"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{824, &JitIL::srawix}, //"srawix", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
{24, &JitIL::slwx}, //"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
{24, &JitIL::slwx}, //"slwx", OPTYPE_INTEGER, FL_OUT_A | FL_IN_B | FL_IN_S | FL_RC_BIT}},
|
||||||
|
|
||||||
{54, &JitIL::Default}, //"dcbst", OPTYPE_DCACHE, 0, 4}},
|
{54, &JitIL::Default}, //"dcbst", OPTYPE_DCACHE, 0, 4}},
|
||||||
{86, &JitIL::DoNothing}, //"dcbf", OPTYPE_DCACHE, 0, 4}},
|
{86, &JitIL::DoNothing}, //"dcbf", OPTYPE_DCACHE, 0, 4}},
|
||||||
{246, &JitIL::Default}, //"dcbtst", OPTYPE_DCACHE, 0, 1}},
|
{246, &JitIL::Default}, //"dcbtst", OPTYPE_DCACHE, 0, 1}},
|
||||||
{278, &JitIL::Default}, //"dcbt", OPTYPE_DCACHE, 0, 1}},
|
{278, &JitIL::Default}, //"dcbt", OPTYPE_DCACHE, 0, 1}},
|
||||||
{470, &JitIL::Default}, //"dcbi", OPTYPE_DCACHE, 0, 4}},
|
{470, &JitIL::Default}, //"dcbi", OPTYPE_DCACHE, 0, 4}},
|
||||||
{758, &JitIL::Default}, //"dcba", OPTYPE_DCACHE, 0, 4}},
|
{758, &JitIL::Default}, //"dcba", OPTYPE_DCACHE, 0, 4}},
|
||||||
{1014, &JitIL::dcbz}, //"dcbz", OPTYPE_DCACHE, 0, 4}},
|
{1014, &JitIL::dcbz}, //"dcbz", OPTYPE_DCACHE, 0, 4}},
|
||||||
//load word
|
//load word
|
||||||
{23, &JitIL::lXzx}, //"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{23, &JitIL::lXzx}, //"lwzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{55, &JitIL::lXzx}, //"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{55, &JitIL::lXzx}, //"lwzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load halfword
|
//load halfword
|
||||||
{279, &JitIL::lXzx}, //"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{279, &JitIL::lXzx}, //"lhzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{311, &JitIL::lXzx}, //"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{311, &JitIL::lXzx}, //"lhzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load halfword signextend
|
//load halfword signextend
|
||||||
{343, &JitIL::lhax}, //"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{343, &JitIL::lhax}, //"lhax", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{375, &JitIL::Default}, //"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{375, &JitIL::Default}, //"lhaux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load byte
|
//load byte
|
||||||
{87, &JitIL::lXzx}, //"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{87, &JitIL::lXzx}, //"lbzx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{119, &JitIL::lXzx}, //"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{119, &JitIL::lXzx}, //"lbzux", OPTYPE_LOAD, FL_OUT_D | FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//load byte reverse
|
//load byte reverse
|
||||||
{534, &JitIL::Default}, //"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{534, &JitIL::Default}, //"lwbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
{790, &JitIL::Default}, //"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
{790, &JitIL::Default}, //"lhbrx", OPTYPE_LOAD, FL_OUT_D | FL_IN_A0 | FL_IN_B}},
|
||||||
|
|
||||||
// Conditional load/store (Wii SMP)
|
// Conditional load/store (Wii SMP)
|
||||||
{150, &JitIL::Default}, //"stwcxd", OPTYPE_STORE, FL_EVIL | FL_SET_CR0}},
|
{150, &JitIL::Default}, //"stwcxd", OPTYPE_STORE, FL_EVIL | FL_SET_CR0}},
|
||||||
{20, &JitIL::Default}, //"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B | FL_SET_CR0}},
|
{20, &JitIL::Default}, //"lwarx", OPTYPE_LOAD, FL_EVIL | FL_OUT_D | FL_IN_A0B | FL_SET_CR0}},
|
||||||
|
|
||||||
//load string (interpret these)
|
//load string (interpret these)
|
||||||
{533, &JitIL::Default}, //"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}},
|
{533, &JitIL::Default}, //"lswx", OPTYPE_LOAD, FL_EVIL | FL_IN_A | FL_OUT_D}},
|
||||||
{597, &JitIL::Default}, //"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}},
|
{597, &JitIL::Default}, //"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}},
|
||||||
|
|
||||||
//store word
|
//store word
|
||||||
{151, &JitIL::stXx}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{151, &JitIL::stXx}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{183, &JitIL::stXx}, //"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{183, &JitIL::stXx}, //"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store halfword
|
//store halfword
|
||||||
{407, &JitIL::stXx}, //"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{407, &JitIL::stXx}, //"sthx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{439, &JitIL::stXx}, //"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{439, &JitIL::stXx}, //"sthux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store byte
|
//store byte
|
||||||
{215, &JitIL::stXx}, //"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{215, &JitIL::stXx}, //"stbx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{247, &JitIL::stXx}, //"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
{247, &JitIL::stXx}, //"stbux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
//store bytereverse
|
//store bytereverse
|
||||||
{662, &JitIL::Default}, //"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
{662, &JitIL::Default}, //"stwbrx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}},
|
||||||
{918, &JitIL::Default}, //"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}},
|
{918, &JitIL::Default}, //"sthbrx", OPTYPE_STORE, FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
{661, &JitIL::Default}, //"stswx", OPTYPE_STORE, FL_EVIL}},
|
{661, &JitIL::Default}, //"stswx", OPTYPE_STORE, FL_EVIL}},
|
||||||
{725, &JitIL::Default}, //"stswi", OPTYPE_STORE, FL_EVIL}},
|
{725, &JitIL::Default}, //"stswi", OPTYPE_STORE, FL_EVIL}},
|
||||||
|
|
||||||
// fp load/store
|
// fp load/store
|
||||||
{535, &JitIL::lfsx}, //"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
{535, &JitIL::lfsx}, //"lfsx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{567, &JitIL::Default}, //"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
{567, &JitIL::Default}, //"lfsux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
||||||
{599, &JitIL::Default}, //"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
{599, &JitIL::Default}, //"lfdx", OPTYPE_LOADFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{631, &JitIL::Default}, //"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
{631, &JitIL::Default}, //"lfdux", OPTYPE_LOADFP, FL_IN_A | FL_IN_B}},
|
||||||
|
|
||||||
{663, &JitIL::stfsx}, //"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{663, &JitIL::stfsx}, //"stfsx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{695, &JitIL::Default}, //"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
{695, &JitIL::Default}, //"stfsux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
||||||
{727, &JitIL::Default}, //"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{727, &JitIL::Default}, //"stfdx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
{759, &JitIL::Default}, //"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
{759, &JitIL::Default}, //"stfdux", OPTYPE_STOREFP, FL_IN_A | FL_IN_B}},
|
||||||
{983, &JitIL::Default}, //"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
{983, &JitIL::Default}, //"stfiwx", OPTYPE_STOREFP, FL_IN_A0 | FL_IN_B}},
|
||||||
|
|
||||||
{19, &JitIL::mfcr}, //"mfcr", OPTYPE_SYSTEM, FL_OUT_D}},
|
{19, &JitIL::mfcr}, //"mfcr", OPTYPE_SYSTEM, FL_OUT_D}},
|
||||||
{83, &JitIL::mfmsr}, //"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}},
|
{83, &JitIL::mfmsr}, //"mfmsr", OPTYPE_SYSTEM, FL_OUT_D}},
|
||||||
{144, &JitIL::mtcrf}, //"mtcrf", OPTYPE_SYSTEM, 0}},
|
{144, &JitIL::mtcrf}, //"mtcrf", OPTYPE_SYSTEM, 0}},
|
||||||
{146, &JitIL::mtmsr}, //"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
{146, &JitIL::mtmsr}, //"mtmsr", OPTYPE_SYSTEM, FL_ENDBLOCK}},
|
||||||
{210, &JitIL::Default}, //"mtsr", OPTYPE_SYSTEM, 0}},
|
{210, &JitIL::Default}, //"mtsr", OPTYPE_SYSTEM, 0}},
|
||||||
{242, &JitIL::Default}, //"mtsrin", OPTYPE_SYSTEM, 0}},
|
{242, &JitIL::Default}, //"mtsrin", OPTYPE_SYSTEM, 0}},
|
||||||
{339, &JitIL::mfspr}, //"mfspr", OPTYPE_SPR, FL_OUT_D}},
|
{339, &JitIL::mfspr}, //"mfspr", OPTYPE_SPR, FL_OUT_D}},
|
||||||
{467, &JitIL::mtspr}, //"mtspr", OPTYPE_SPR, 0, 2}},
|
{467, &JitIL::mtspr}, //"mtspr", OPTYPE_SPR, 0, 2}},
|
||||||
{371, &JitIL::mftb}, //"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}},
|
{371, &JitIL::mftb}, //"mftb", OPTYPE_SYSTEM, FL_OUT_D | FL_TIMER}},
|
||||||
{512, &JitIL::Default}, //"mcrxr", OPTYPE_SYSTEM, 0}},
|
{512, &JitIL::Default}, //"mcrxr", OPTYPE_SYSTEM, 0}},
|
||||||
{595, &JitIL::Default}, //"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
{595, &JitIL::Default}, //"mfsr", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
||||||
{659, &JitIL::Default}, //"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
{659, &JitIL::Default}, //"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}},
|
||||||
|
|
||||||
{4, &JitIL::Default}, //"tw", OPTYPE_SYSTEM, 0, 1}},
|
{4, &JitIL::Default}, //"tw", OPTYPE_SYSTEM, 0, 1}},
|
||||||
{598, &JitIL::DoNothing}, //"sync", OPTYPE_SYSTEM, 0, 2}},
|
{598, &JitIL::DoNothing}, //"sync", OPTYPE_SYSTEM, 0, 2}},
|
||||||
{982, &JitIL::icbi}, //"icbi", OPTYPE_SYSTEM, FL_ENDBLOCK, 3}},
|
{982, &JitIL::icbi}, //"icbi", OPTYPE_SYSTEM, FL_ENDBLOCK, 3}},
|
||||||
|
|
||||||
// Unused instructions on GC
|
// Unused instructions on GC
|
||||||
{310, &JitIL::Default}, //"eciwx", OPTYPE_INTEGER, FL_RC_BIT}},
|
{310, &JitIL::Default}, //"eciwx", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{438, &JitIL::Default}, //"ecowx", OPTYPE_INTEGER, FL_RC_BIT}},
|
{438, &JitIL::Default}, //"ecowx", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{854, &JitIL::Default}, //"eieio", OPTYPE_INTEGER, FL_RC_BIT}},
|
{854, &JitIL::Default}, //"eieio", OPTYPE_INTEGER, FL_RC_BIT}},
|
||||||
{306, &JitIL::Default}, //"tlbie", OPTYPE_SYSTEM, 0}},
|
{306, &JitIL::Default}, //"tlbie", OPTYPE_SYSTEM, 0}},
|
||||||
{370, &JitIL::Default}, //"tlbia", OPTYPE_SYSTEM, 0}},
|
{370, &JitIL::Default}, //"tlbia", OPTYPE_SYSTEM, 0}},
|
||||||
{566, &JitIL::Default}, //"tlbsync", OPTYPE_SYSTEM, 0}},
|
{566, &JitIL::Default}, //"tlbsync", OPTYPE_SYSTEM, 0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table31_2[] =
|
static GekkoOPTemplate table31_2[] =
|
||||||
{
|
{
|
||||||
{266, &JitIL::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{266, &JitIL::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{10, &JitIL::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
{10, &JitIL::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
||||||
{138, &JitIL::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{138, &JitIL::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{234, &JitIL::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{234, &JitIL::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{202, &JitIL::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{202, &JitIL::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{491, &JitIL::Default}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
{491, &JitIL::Default}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
||||||
{459, &JitIL::divwux}, //"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
{459, &JitIL::divwux}, //"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
|
||||||
{75, &JitIL::Default}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{75, &JitIL::Default}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{11, &JitIL::mulhwux}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{11, &JitIL::mulhwux}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{235, &JitIL::mullwx}, //"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
{235, &JitIL::mullwx}, //"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
|
||||||
{104, &JitIL::negx}, //"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{104, &JitIL::negx}, //"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{40, &JitIL::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
{40, &JitIL::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
|
||||||
{8, &JitIL::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
{8, &JitIL::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
|
||||||
{136, &JitIL::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{136, &JitIL::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{232, &JitIL::Default}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{232, &JitIL::Default}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
{200, &JitIL::Default}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
{200, &JitIL::Default}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table59[] =
|
static GekkoOPTemplate table59[] =
|
||||||
{
|
{
|
||||||
{18, &JitIL::Default}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
|
{18, &JitIL::Default}, //{"fdivsx", OPTYPE_FPU, FL_RC_BIT_F, 16}},
|
||||||
{20, &JitIL::fp_arith_s}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{20, &JitIL::fp_arith_s}, //"fsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{21, &JitIL::fp_arith_s}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{21, &JitIL::fp_arith_s}, //"faddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
// {22, &JitIL::Default}, //"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko
|
// {22, &JitIL::Default}, //"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F}}, // Not implemented on gekko
|
||||||
{24, &JitIL::Default}, //"fresx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{24, &JitIL::Default}, //"fresx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{25, &JitIL::fp_arith_s}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{25, &JitIL::fp_arith_s}, //"fmulsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{28, &JitIL::fmaddXX}, //"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{28, &JitIL::fmaddXX}, //"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{29, &JitIL::fmaddXX}, //"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{29, &JitIL::fmaddXX}, //"fmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{30, &JitIL::fmaddXX}, //"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{30, &JitIL::fmaddXX}, //"fnmsubsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{31, &JitIL::fmaddXX}, //"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{31, &JitIL::fmaddXX}, //"fnmaddsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table63[] =
|
static GekkoOPTemplate table63[] =
|
||||||
{
|
{
|
||||||
{264, &JitIL::fsign}, //"fabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{264, &JitIL::fsign}, //"fabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{32, &JitIL::fcmpx}, //"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}},
|
{32, &JitIL::fcmpx}, //"fcmpo", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{0, &JitIL::fcmpx}, //"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}},
|
{0, &JitIL::fcmpx}, //"fcmpu", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{14, &JitIL::Default}, //"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{14, &JitIL::Default}, //"fctiwx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{15, &JitIL::Default}, //"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{15, &JitIL::Default}, //"fctiwzx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{72, &JitIL::fmrx}, //"fmrx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{72, &JitIL::fmrx}, //"fmrx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{136, &JitIL::fsign}, //"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{136, &JitIL::fsign}, //"fnabsx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{40, &JitIL::fsign}, //"fnegx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{40, &JitIL::fsign}, //"fnegx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{12, &JitIL::Default}, //"frspx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{12, &JitIL::Default}, //"frspx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
|
|
||||||
{64, &JitIL::Default}, //"mcrfs", OPTYPE_SYSTEMFP, 0}},
|
{64, &JitIL::Default}, //"mcrfs", OPTYPE_SYSTEMFP, 0}},
|
||||||
{583, &JitIL::Default}, //"mffsx", OPTYPE_SYSTEMFP, 0}},
|
{583, &JitIL::Default}, //"mffsx", OPTYPE_SYSTEMFP, 0}},
|
||||||
{70, &JitIL::Default}, //"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}},
|
{70, &JitIL::Default}, //"mtfsb0x", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{38, &JitIL::Default}, //"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}},
|
{38, &JitIL::Default}, //"mtfsb1x", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{134, &JitIL::Default}, //"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}},
|
{134, &JitIL::Default}, //"mtfsfix", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
{711, &JitIL::Default}, //"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}},
|
{711, &JitIL::Default}, //"mtfsfx", OPTYPE_SYSTEMFP, 0, 2}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static GekkoOPTemplate table63_2[] =
|
static GekkoOPTemplate table63_2[] =
|
||||||
{
|
{
|
||||||
{18, &JitIL::Default}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
|
{18, &JitIL::Default}, //"fdivx", OPTYPE_FPU, FL_RC_BIT_F, 30}},
|
||||||
{20, &JitIL::Default}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{20, &JitIL::Default}, //"fsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{21, &JitIL::Default}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{21, &JitIL::Default}, //"faddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{22, &JitIL::Default}, //"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{22, &JitIL::Default}, //"fsqrtx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{23, &JitIL::Default}, //"fselx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{23, &JitIL::Default}, //"fselx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{25, &JitIL::fp_arith_s}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{25, &JitIL::fp_arith_s}, //"fmulx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{26, &JitIL::fp_arith_s}, //"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}},
|
{26, &JitIL::fp_arith_s}, //"frsqrtex", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{28, &JitIL::fmaddXX}, //"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{28, &JitIL::fmaddXX}, //"fmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{29, &JitIL::fmaddXX}, //"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{29, &JitIL::fmaddXX}, //"fmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{30, &JitIL::fmaddXX}, //"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{30, &JitIL::fmaddXX}, //"fnmsubx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
{31, &JitIL::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
{31, &JitIL::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace JitILTables
|
namespace JitILTables
|
||||||
{
|
{
|
||||||
void CompileInstruction(UGeckoInstruction _inst)
|
void CompileInstruction(UGeckoInstruction _inst)
|
||||||
{
|
{
|
||||||
JitIL *jitil = (JitIL *)jit;
|
JitIL *jitil = (JitIL *)jit;
|
||||||
(jitil->*dynaOpTable[_inst.OPCD])(_inst);
|
(jitil->*dynaOpTable[_inst.OPCD])(_inst);
|
||||||
GekkoOPInfo *info = GetOpInfo(_inst);
|
GekkoOPInfo *info = GetOpInfo(_inst);
|
||||||
if (info) {
|
if (info) {
|
||||||
#ifdef OPLOG
|
#ifdef OPLOG
|
||||||
if (!strcmp(info->opname, OP_TO_LOG)){ ///"mcrfs"
|
if (!strcmp(info->opname, OP_TO_LOG)){ ///"mcrfs"
|
||||||
rsplocations.push_back(jit.js.compilerPC);
|
rsplocations.push_back(jit.js.compilerPC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
info->compileCount++;
|
info->compileCount++;
|
||||||
info->lastUse = jit->js.compilerPC;
|
info->lastUse = jit->js.compilerPC;
|
||||||
} else {
|
} else {
|
||||||
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, jit->js.compilerPC);
|
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, jit->js.compilerPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InitTables()
|
void InitTables()
|
||||||
{
|
{
|
||||||
//clear
|
//clear
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
dynaOpTable59[i] = &JitIL::unknown_instruction;
|
dynaOpTable59[i] = &JitIL::unknown_instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1024; i++)
|
for (int i = 0; i < 1024; i++)
|
||||||
{
|
{
|
||||||
dynaOpTable4 [i] = &JitIL::unknown_instruction;
|
dynaOpTable4 [i] = &JitIL::unknown_instruction;
|
||||||
dynaOpTable19[i] = &JitIL::unknown_instruction;
|
dynaOpTable19[i] = &JitIL::unknown_instruction;
|
||||||
dynaOpTable31[i] = &JitIL::unknown_instruction;
|
dynaOpTable31[i] = &JitIL::unknown_instruction;
|
||||||
dynaOpTable63[i] = &JitIL::unknown_instruction;
|
dynaOpTable63[i] = &JitIL::unknown_instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(primarytable) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(primarytable) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
dynaOpTable[primarytable[i].opcode] = primarytable[i].Inst;
|
dynaOpTable[primarytable[i].opcode] = primarytable[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 5;
|
int fill = i << 5;
|
||||||
for (int j = 0; j < (int)(sizeof(table4_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table4_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill+table4_2[j].opcode;
|
int op = fill+table4_2[j].opcode;
|
||||||
dynaOpTable4[op] = table4_2[j].Inst;
|
dynaOpTable4[op] = table4_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 6;
|
int fill = i << 6;
|
||||||
for (int j = 0; j < (int)(sizeof(table4_3) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table4_3) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill+table4_3[j].opcode;
|
int op = fill+table4_3[j].opcode;
|
||||||
dynaOpTable4[op] = table4_3[j].Inst;
|
dynaOpTable4[op] = table4_3[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table4) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table4) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table4[i].opcode;
|
int op = table4[i].opcode;
|
||||||
dynaOpTable4[op] = table4[i].Inst;
|
dynaOpTable4[op] = table4[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table31) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table31) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table31[i].opcode;
|
int op = table31[i].opcode;
|
||||||
dynaOpTable31[op] = table31[i].Inst;
|
dynaOpTable31[op] = table31[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1; i++)
|
for (int i = 0; i < 1; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 9;
|
int fill = i << 9;
|
||||||
for (int j = 0; j < (int)(sizeof(table31_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table31_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill + table31_2[j].opcode;
|
int op = fill + table31_2[j].opcode;
|
||||||
dynaOpTable31[op] = table31_2[j].Inst;
|
dynaOpTable31[op] = table31_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table19) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table19) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table19[i].opcode;
|
int op = table19[i].opcode;
|
||||||
dynaOpTable19[op] = table19[i].Inst;
|
dynaOpTable19[op] = table19[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table59) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table59) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table59[i].opcode;
|
int op = table59[i].opcode;
|
||||||
dynaOpTable59[op] = table59[i].Inst;
|
dynaOpTable59[op] = table59[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(table63) / sizeof(GekkoOPTemplate)); i++)
|
for (int i = 0; i < (int)(sizeof(table63) / sizeof(GekkoOPTemplate)); i++)
|
||||||
{
|
{
|
||||||
int op = table63[i].opcode;
|
int op = table63[i].opcode;
|
||||||
dynaOpTable63[op] = table63[i].Inst;
|
dynaOpTable63[op] = table63[i].Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
int fill = i << 5;
|
int fill = i << 5;
|
||||||
for (int j = 0; j < (int)(sizeof(table63_2) / sizeof(GekkoOPTemplate)); j++)
|
for (int j = 0; j < (int)(sizeof(table63_2) / sizeof(GekkoOPTemplate)); j++)
|
||||||
{
|
{
|
||||||
int op = fill + table63_2[j].opcode;
|
int op = fill + table63_2[j].opcode;
|
||||||
dynaOpTable63[op] = table63_2[j].Inst;
|
dynaOpTable63[op] = table63_2[j].Inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef JITIL_TABLES_H
|
#ifndef JITIL_TABLES_H
|
||||||
#define JITIL_TABLES_H
|
#define JITIL_TABLES_H
|
||||||
|
|
||||||
#include "../Gekko.h"
|
#include "../Gekko.h"
|
||||||
#include "../PPCTables.h"
|
#include "../PPCTables.h"
|
||||||
#include "../Jit64IL/JitIL.h"
|
#include "../Jit64IL/JitIL.h"
|
||||||
|
|
||||||
namespace JitILTables
|
namespace JitILTables
|
||||||
{
|
{
|
||||||
void CompileInstruction(UGeckoInstruction _inst);
|
void CompileInstruction(UGeckoInstruction _inst);
|
||||||
void InitTables();
|
void InitTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,78 +1,78 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _JITASMCOMMON_H
|
#ifndef _JITASMCOMMON_H
|
||||||
#define _JITASMCOMMON_H
|
#define _JITASMCOMMON_H
|
||||||
|
|
||||||
#include "../JitCommon/Jit_Util.h"
|
#include "../JitCommon/Jit_Util.h"
|
||||||
#include "Thunk.h"
|
#include "Thunk.h"
|
||||||
|
|
||||||
class CommonAsmRoutines : public EmuCodeBlock {
|
class CommonAsmRoutines : public EmuCodeBlock {
|
||||||
protected:
|
protected:
|
||||||
void GenQuantizedLoads();
|
void GenQuantizedLoads();
|
||||||
void GenQuantizedStores();
|
void GenQuantizedStores();
|
||||||
void GenQuantizedSingleStores();
|
void GenQuantizedSingleStores();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void GenFifoWrite(int size);
|
void GenFifoWrite(int size);
|
||||||
void GenFifoXmm64Write();
|
void GenFifoXmm64Write();
|
||||||
void GenFifoFloatWrite();
|
void GenFifoFloatWrite();
|
||||||
|
|
||||||
const u8 *fifoDirectWrite8;
|
const u8 *fifoDirectWrite8;
|
||||||
const u8 *fifoDirectWrite16;
|
const u8 *fifoDirectWrite16;
|
||||||
const u8 *fifoDirectWrite32;
|
const u8 *fifoDirectWrite32;
|
||||||
const u8 *fifoDirectWriteFloat;
|
const u8 *fifoDirectWriteFloat;
|
||||||
const u8 *fifoDirectWriteXmm64;
|
const u8 *fifoDirectWriteXmm64;
|
||||||
|
|
||||||
const u8 *enterCode;
|
const u8 *enterCode;
|
||||||
|
|
||||||
const u8 *dispatcher;
|
const u8 *dispatcher;
|
||||||
const u8 *dispatcherNoCheck;
|
const u8 *dispatcherNoCheck;
|
||||||
const u8 *dispatcherPcInEAX;
|
const u8 *dispatcherPcInEAX;
|
||||||
|
|
||||||
const u8 *fpException;
|
const u8 *fpException;
|
||||||
const u8 *computeRc;
|
const u8 *computeRc;
|
||||||
const u8 *testExceptions;
|
const u8 *testExceptions;
|
||||||
const u8 *dispatchPcInEAX;
|
const u8 *dispatchPcInEAX;
|
||||||
const u8 *doTiming;
|
const u8 *doTiming;
|
||||||
|
|
||||||
const u8 *breakpointBailout;
|
const u8 *breakpointBailout;
|
||||||
|
|
||||||
// In: array index: GQR to use.
|
// In: array index: GQR to use.
|
||||||
// In: ECX: Address to read from.
|
// In: ECX: Address to read from.
|
||||||
// Out: XMM0: Bottom two 32-bit slots hold the read value,
|
// Out: XMM0: Bottom two 32-bit slots hold the read value,
|
||||||
// converted to a pair of floats.
|
// converted to a pair of floats.
|
||||||
// Trashes: EAX ECX EDX
|
// Trashes: EAX ECX EDX
|
||||||
const u8 GC_ALIGNED16(*pairedLoadQuantized[8]);
|
const u8 GC_ALIGNED16(*pairedLoadQuantized[8]);
|
||||||
|
|
||||||
// In: array index: GQR to use.
|
// In: array index: GQR to use.
|
||||||
// In: ECX: Address to write to.
|
// In: ECX: Address to write to.
|
||||||
// In: XMM0: Bottom two 32-bit slots hold the pair of floats to be written.
|
// In: XMM0: Bottom two 32-bit slots hold the pair of floats to be written.
|
||||||
// Out: Nothing.
|
// Out: Nothing.
|
||||||
// Trashes: EAX ECX EDX
|
// Trashes: EAX ECX EDX
|
||||||
const u8 GC_ALIGNED16(*pairedStoreQuantized[8]);
|
const u8 GC_ALIGNED16(*pairedStoreQuantized[8]);
|
||||||
|
|
||||||
// In: array index: GQR to use.
|
// In: array index: GQR to use.
|
||||||
// In: ECX: Address to write to.
|
// In: ECX: Address to write to.
|
||||||
// In: XMM0: Bottom 32-bit slot holds the float to be written.
|
// In: XMM0: Bottom 32-bit slot holds the float to be written.
|
||||||
const u8 GC_ALIGNED16(*singleStoreQuantized[8]);
|
const u8 GC_ALIGNED16(*singleStoreQuantized[8]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThunkManager thunks;
|
ThunkManager thunks;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _JITBACKPATCH_H
|
#ifndef _JITBACKPATCH_H
|
||||||
#define _JITBACKPATCH_H
|
#define _JITBACKPATCH_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "x64Emitter.h"
|
#include "x64Emitter.h"
|
||||||
#include "x64Analyzer.h"
|
#include "x64Analyzer.h"
|
||||||
#include "Thunk.h"
|
#include "Thunk.h"
|
||||||
|
|
||||||
// Declarations and definitions
|
// Declarations and definitions
|
||||||
// ----------
|
// ----------
|
||||||
|
|
||||||
// void Jit(u32 em_address);
|
// void Jit(u32 em_address);
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
// A bit of a hack to get things building under linux. We manually fill in this structure as needed
|
// A bit of a hack to get things building under linux. We manually fill in this structure as needed
|
||||||
// from the real context.
|
// from the real context.
|
||||||
struct CONTEXT
|
struct CONTEXT
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
u64 Rip;
|
u64 Rip;
|
||||||
u64 Rax;
|
u64 Rax;
|
||||||
#else
|
#else
|
||||||
u32 Eip;
|
u32 Eip;
|
||||||
u32 Eax;
|
u32 Eax;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class TrampolineCache : public Gen::XCodeBlock
|
class TrampolineCache : public Gen::XCodeBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
const u8 *GetReadTrampoline(const InstructionInfo &info);
|
const u8 *GetReadTrampoline(const InstructionInfo &info);
|
||||||
const u8 *GetWriteTrampoline(const InstructionInfo &info);
|
const u8 *GetWriteTrampoline(const InstructionInfo &info);
|
||||||
private:
|
private:
|
||||||
ThunkManager thunks;
|
ThunkManager thunks;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
// Copyright (C) 2003 Dolphin Project.
|
// Copyright (C) 2003 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
#include "JitBase.h"
|
#include "JitBase.h"
|
||||||
|
|
||||||
JitBase *jit;
|
JitBase *jit;
|
||||||
|
|
||||||
void Jit(u32 em_address)
|
void Jit(u32 em_address)
|
||||||
{
|
{
|
||||||
jit->Jit(em_address);
|
jit->Jit(em_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Helper_Mask(u8 mb, u8 me)
|
u32 Helper_Mask(u8 mb, u8 me)
|
||||||
{
|
{
|
||||||
return (((mb > me) ?
|
return (((mb > me) ?
|
||||||
~(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1)))
|
~(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1)))
|
||||||
:
|
:
|
||||||
(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1))))
|
(((u32)-1 >> mb) ^ ((me >= 31) ? 0 : (u32) -1 >> (me + 1))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *normalEntry, JitBlock *b)
|
void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *normalEntry, JitBlock *b)
|
||||||
{
|
{
|
||||||
char pDis[1000] = "";
|
char pDis[1000] = "";
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
char temp[256] = "";
|
char temp[256] = "";
|
||||||
const PPCAnalyst::CodeOp &op = code_buffer->codebuffer[i];
|
const PPCAnalyst::CodeOp &op = code_buffer->codebuffer[i];
|
||||||
DisassembleGekko(op.inst.hex, op.address, temp, 256);
|
DisassembleGekko(op.inst.hex, op.address, temp, 256);
|
||||||
sprintf(pDis, "%08x %s", op.address, temp);
|
sprintf(pDis, "%08x %s", op.address, temp);
|
||||||
DEBUG_LOG(DYNA_REC,"IR_X86 PPC: %s\n", pDis);
|
DEBUG_LOG(DYNA_REC,"IR_X86 PPC: %s\n", pDis);
|
||||||
}
|
}
|
||||||
|
|
||||||
disassembler x64disasm;
|
disassembler x64disasm;
|
||||||
x64disasm.set_syntax_intel();
|
x64disasm.set_syntax_intel();
|
||||||
|
|
||||||
u64 disasmPtr = (u64)normalEntry;
|
u64 disasmPtr = (u64)normalEntry;
|
||||||
const u8 *end = normalEntry + b->codeSize;
|
const u8 *end = normalEntry + b->codeSize;
|
||||||
|
|
||||||
while ((u8*)disasmPtr < end)
|
while ((u8*)disasmPtr < end)
|
||||||
{
|
{
|
||||||
char sptr[1000] = "";
|
char sptr[1000] = "";
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
disasmPtr += x64disasm.disasm64(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
disasmPtr += x64disasm.disasm64(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
||||||
#else
|
#else
|
||||||
disasmPtr += x64disasm.disasm32(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
disasmPtr += x64disasm.disasm32(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
||||||
#endif
|
#endif
|
||||||
DEBUG_LOG(DYNA_REC,"IR_X86 x86: %s", sptr);
|
DEBUG_LOG(DYNA_REC,"IR_X86 x86: %s", sptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->codeSize <= 250)
|
if (b->codeSize <= 250)
|
||||||
{
|
{
|
||||||
char x86code[500] = "";
|
char x86code[500] = "";
|
||||||
for (u8 i = 0; i <= b->codeSize; i++)
|
for (u8 i = 0; i <= b->codeSize; i++)
|
||||||
{
|
{
|
||||||
char opcHex[2] = "";
|
char opcHex[2] = "";
|
||||||
u8 opc = *(normalEntry + i);
|
u8 opc = *(normalEntry + i);
|
||||||
sprintf(opcHex, "%02x", opc);
|
sprintf(opcHex, "%02x", opc);
|
||||||
strncat(x86code, opcHex, 2);
|
strncat(x86code, opcHex, 2);
|
||||||
}
|
}
|
||||||
DEBUG_LOG(DYNA_REC,"IR_X86 bin: %s\n\n\n", x86code);
|
DEBUG_LOG(DYNA_REC,"IR_X86 bin: %s\n\n\n", x86code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,111 +1,111 @@
|
||||||
// Copyright (C) 2010 Dolphin Project.
|
// Copyright (C) 2010 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef _JITBASE_H
|
#ifndef _JITBASE_H
|
||||||
#define _JITBASE_H
|
#define _JITBASE_H
|
||||||
|
|
||||||
//#define JIT_SINGLESTEP // Enables single stepping
|
//#define JIT_SINGLESTEP // Enables single stepping
|
||||||
//#define JIT_NO_CACHE // Disables the block cache and enables breakpoints
|
//#define JIT_NO_CACHE // Disables the block cache and enables breakpoints
|
||||||
//#define JIT_LOG_X86 // Enables logging of the generated x86 code
|
//#define JIT_LOG_X86 // Enables logging of the generated x86 code
|
||||||
//#define JIT_LOG_GPR // Enables logging of the PPC general purpose regs
|
//#define JIT_LOG_GPR // Enables logging of the PPC general purpose regs
|
||||||
//#define JIT_LOG_FPR // Enables logging of the PPC floating point regs
|
//#define JIT_LOG_FPR // Enables logging of the PPC floating point regs
|
||||||
|
|
||||||
#include "JitCache.h"
|
#include "JitCache.h"
|
||||||
#include "Jit_Util.h" // for EmuCodeBlock
|
#include "Jit_Util.h" // for EmuCodeBlock
|
||||||
#include "JitBackpatch.h" // for EmuCodeBlock
|
#include "JitBackpatch.h" // for EmuCodeBlock
|
||||||
#include "JitAsmCommon.h"
|
#include "JitAsmCommon.h"
|
||||||
|
|
||||||
#include "PowerPCDisasm.h"
|
#include "PowerPCDisasm.h"
|
||||||
#include "disasm.h"
|
#include "disasm.h"
|
||||||
|
|
||||||
#define JIT_OPCODE 0
|
#define JIT_OPCODE 0
|
||||||
|
|
||||||
// TODO: In the future, inherit this from CPUCoreBase and have Interpreter
|
// TODO: In the future, inherit this from CPUCoreBase and have Interpreter
|
||||||
// inherit from that too?
|
// inherit from that too?
|
||||||
class JitBase : public EmuCodeBlock
|
class JitBase : public EmuCodeBlock
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
JitBlockCache blocks;
|
JitBlockCache blocks;
|
||||||
TrampolineCache trampolines;
|
TrampolineCache trampolines;
|
||||||
|
|
||||||
struct JitOptions
|
struct JitOptions
|
||||||
{
|
{
|
||||||
bool optimizeStack;
|
bool optimizeStack;
|
||||||
bool assumeFPLoadFromMem;
|
bool assumeFPLoadFromMem;
|
||||||
bool enableBlocklink;
|
bool enableBlocklink;
|
||||||
bool fpAccurateFcmp;
|
bool fpAccurateFcmp;
|
||||||
bool enableFastMem;
|
bool enableFastMem;
|
||||||
bool optimizeGatherPipe;
|
bool optimizeGatherPipe;
|
||||||
bool fastInterrupts;
|
bool fastInterrupts;
|
||||||
bool accurateSinglePrecision;
|
bool accurateSinglePrecision;
|
||||||
};
|
};
|
||||||
struct JitState
|
struct JitState
|
||||||
{
|
{
|
||||||
u32 compilerPC;
|
u32 compilerPC;
|
||||||
u32 next_compilerPC;
|
u32 next_compilerPC;
|
||||||
u32 blockStart;
|
u32 blockStart;
|
||||||
bool cancel;
|
bool cancel;
|
||||||
UGeckoInstruction next_inst; // for easy peephole opt.
|
UGeckoInstruction next_inst; // for easy peephole opt.
|
||||||
int blockSize;
|
int blockSize;
|
||||||
int instructionNumber;
|
int instructionNumber;
|
||||||
int downcountAmount;
|
int downcountAmount;
|
||||||
|
|
||||||
bool isLastInstruction;
|
bool isLastInstruction;
|
||||||
bool forceUnsafeLoad;
|
bool forceUnsafeLoad;
|
||||||
|
|
||||||
int fifoBytesThisBlock;
|
int fifoBytesThisBlock;
|
||||||
|
|
||||||
PPCAnalyst::BlockStats st;
|
PPCAnalyst::BlockStats st;
|
||||||
PPCAnalyst::BlockRegStats gpa;
|
PPCAnalyst::BlockRegStats gpa;
|
||||||
PPCAnalyst::BlockRegStats fpa;
|
PPCAnalyst::BlockRegStats fpa;
|
||||||
PPCAnalyst::CodeOp *op;
|
PPCAnalyst::CodeOp *op;
|
||||||
u8* rewriteStart;
|
u8* rewriteStart;
|
||||||
|
|
||||||
JitBlock *curBlock;
|
JitBlock *curBlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This should probably be removed from public:
|
// This should probably be removed from public:
|
||||||
JitOptions jo;
|
JitOptions jo;
|
||||||
JitState js;
|
JitState js;
|
||||||
|
|
||||||
JitBlockCache *GetBlockCache() { return &blocks; }
|
JitBlockCache *GetBlockCache() { return &blocks; }
|
||||||
|
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
|
|
||||||
virtual void Jit(u32 em_address) = 0;
|
virtual void Jit(u32 em_address) = 0;
|
||||||
virtual void ClearCache() = 0;
|
virtual void ClearCache() = 0;
|
||||||
virtual void Run() = 0;
|
virtual void Run() = 0;
|
||||||
virtual void SingleStep() = 0;
|
virtual void SingleStep() = 0;
|
||||||
virtual void NotifyBreakpoint(u32 em_address, bool set) = 0;
|
virtual void NotifyBreakpoint(u32 em_address, bool set) = 0;
|
||||||
|
|
||||||
const u8 *BackPatch(u8 *codePtr, int accessType, u32 em_address, void *ctx);
|
const u8 *BackPatch(u8 *codePtr, int accessType, u32 em_address, void *ctx);
|
||||||
|
|
||||||
virtual const CommonAsmRoutines *GetAsmRoutines() = 0;
|
virtual const CommonAsmRoutines *GetAsmRoutines() = 0;
|
||||||
virtual const char *GetName() = 0;
|
virtual const char *GetName() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern JitBase *jit;
|
extern JitBase *jit;
|
||||||
|
|
||||||
void Jit(u32 em_address);
|
void Jit(u32 em_address);
|
||||||
|
|
||||||
// Merged routines that should be moved somewhere better
|
// Merged routines that should be moved somewhere better
|
||||||
u32 Helper_Mask(u8 mb, u8 me);
|
u32 Helper_Mask(u8 mb, u8 me);
|
||||||
void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *normalEntry, JitBlock *b);
|
void LogGeneratedX86(int size, PPCAnalyst::CodeBuffer *code_buffer, const u8 *normalEntry, JitBlock *b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue