boozook / playdate

Playdate Build Tools and API
https://mastodon.gamedev.place/@pd
MIT License
133 stars 8 forks source link

Errors about mismatched types when trying to use the latest version #379

Closed paulyoung closed 2 months ago

paulyoung commented 3 months ago

I updated my Cargo.toml file, ran cargo update playdate, cargo clean, and cargo check

    Checking playdate-graphics v0.4.0 (https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439c)
    Checking playdate-sound v0.4.1 (https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439c)
error[E0308]: mismatched types
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/sound/src/sample.rs:281:4
    |
276 |               -> unsafe extern "C" fn(data: *mut u8,
    |  ________________-
277 | |                                     format: SoundFormat,
278 | |                                     sampleRate: u32,
279 | |                                     byteCount: c_int,
280 | |                                     shouldFreeData: c_int) -> *mut AudioSample {
    | |______________________________________________________________________________- expected `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32, i32) -> *mut AudioSample` because of return type
281 |               self.0.newSampleFromData.expect("newSampleFromData")
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
    |
    = note: expected fn pointer `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32, i32) -> _`
               found fn pointer `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32) -> _`

error[E0308]: mismatched types
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/sound/src/sample.rs:335:4
    |
330 |               -> unsafe extern "C" fn(data: *mut u8,
    |  ________________-
331 | |                                     format: SoundFormat,
332 | |                                     sampleRate: u32,
333 | |                                     byteCount: c_int,
334 | |                                     shouldFreeData: c_int) -> *mut AudioSample {
    | |______________________________________________________________________________- expected `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32, i32) -> *mut AudioSample` because of return type
335 |               *sys::api!(sound.sample.newSampleFromData)
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
    |
    = note: expected fn pointer `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32, i32) -> _`
               found fn pointer `unsafe extern "C" fn(*mut u8, SoundFormat, u32, i32) -> _`

error[E0609]: no field `getBitmapPixel` on type `&playdate_graphics`
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/bitmap/api.rs:177:23
    |
177 |         *sys::api!(graphics.getBitmapPixel)
    |                             ^^^^^^^^^^^^^^ unknown field
    |
    = note: available fields are: `video`, `clear`, `setBackgroundColor`, `setStencil`, `setDrawMode` ... and 55 others

error[E0609]: no field `getBitmapTableInfo` on type `&playdate_graphics`
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/bitmap/table.rs:239:24
    |
239 |             *sys::api!(graphics.getBitmapTableInfo)
    |                                 ^^^^^^^^^^^^^^^^^^ unknown field
    |
help: a field with a similar name exists
    |
239 |             *sys::api!(graphics.newBitmapTable)
    |                                 ~~~~~~~~~~~~~~

error[E0308]: mismatched types
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/api.rs:381:3
    |
380 |     fn set_draw_mode(&self) -> unsafe extern "C" fn(mode: LCDBitmapDrawMode) -> LCDBitmapDrawMode {
    |                                ------------------------------------------------------------------ expected `unsafe extern "C" fn(LCDBitmapDrawMode) -> LCDBitmapDrawMode` because of return type
381 |         self.0.setDrawMode.expect("setDrawMode")
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `LCDBitmapDrawMode`, found `()`
    |
    = note: expected fn pointer `unsafe extern "C" fn(LCDBitmapDrawMode) -> LCDBitmapDrawMode`
               found fn pointer `unsafe extern "C" fn(LCDBitmapDrawMode)`

error[E0609]: no field `setPixel` on type `&'static playdate_graphics`
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/api.rs:489:10
    |
489 |         self.0.setPixel.expect("setPixel")
    |                ^^^^^^^^ unknown field
    |
    = note: available fields are: `video`, `clear`, `setBackgroundColor`, `setStencil`, `setDrawMode` ... and 55 others

error[E0308]: mismatched types
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/api.rs:589:3
    |
588 |     fn set_draw_mode(&self) -> unsafe extern "C" fn(mode: LCDBitmapDrawMode) -> LCDBitmapDrawMode {
    |                                ------------------------------------------------------------------ expected `unsafe extern "C" fn(LCDBitmapDrawMode) -> LCDBitmapDrawMode` because of return type
589 |         *sys::api!(graphics.setDrawMode)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `LCDBitmapDrawMode`, found `()`
    |
    = note: expected fn pointer `unsafe extern "C" fn(LCDBitmapDrawMode) -> LCDBitmapDrawMode`
               found fn pointer `unsafe extern "C" fn(LCDBitmapDrawMode)`

error[E0609]: no field `setPixel` on type `&playdate_graphics`
   --> /Users/py/.cargo/git/checkouts/playdate-dc26075b1966a65a/43f5439/api/gfx/src/api.rs:692:101
    |
692 |     fn set_pixel(&self) -> unsafe extern "C" fn(x: c_int, y: c_int, c: LCDColor) { *sys::api!(graphics.setPixel) }
    |                                                                                                        ^^^^^^^^ unknown field
    |
    = note: available fields are: `video`, `clear`, `setBackgroundColor`, `setStencil`, `setDrawMode` ... and 55 others

For more information about this error, try `rustc --explain E0308`.
error: could not compile `playdate-sound` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Some errors have detailed explanations: E0308, E0609.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `playdate-graphics` (lib) due to 6 previous errors

My Cargo.toml contains playdate = { git = "https://github.com/boozook/playdate.git", rev = "43f5439cb7a778da56b61dab362ce1fab15fd667" } but I get the same errors with playdate = "*".

My Cargo.lock file contains:

[[package]]
name = "playdate"
version = "0.2.1"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-controls",
 "playdate-display",
 "playdate-fs",
 "playdate-graphics",
 "playdate-lua",
 "playdate-menu",
 "playdate-scoreboards",
 "playdate-sound",
 "playdate-sprite",
 "playdate-sys",
 "playdate-system",
]

[[package]]
name = "playdate-bindgen"
version = "0.1.11"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "bindgen",
 "playdate-bindgen-cfg",
 "playdate-build-utils",
 "semver",
]

[[package]]
name = "playdate-bindgen-cfg"
version = "0.1.7"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "clap",
]

[[package]]
name = "playdate-build-utils"
version = "0.3.2"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "dirs",
 "windows-registry",
]

[[package]]
name = "playdate-color"
version = "0.2.4"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
]

[[package]]
name = "playdate-controls"
version = "0.3.5"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
 "playdate-system",
]

[[package]]
name = "playdate-display"
version = "0.3.6"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
]

[[package]]
name = "playdate-fs"
version = "0.2.8"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
]

[[package]]
name = "playdate-graphics"
version = "0.4.0"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-color",
 "playdate-fs",
 "playdate-sys",
]

[[package]]
name = "playdate-lua"
version = "0.1.1"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
]

[[package]]
name = "playdate-menu"
version = "0.2.4"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
 "playdate-system",
]

[[package]]
name = "playdate-scoreboards"
version = "0.1.2"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "erased_set",
 "playdate-sys",
]

[[package]]
name = "playdate-sound"
version = "0.4.1"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-fs",
 "playdate-sys",
]

[[package]]
name = "playdate-sprite"
version = "0.2.11"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-graphics",
 "playdate-sys",
]

[[package]]
name = "playdate-sys"
version = "0.4.2"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "arrayvec",
 "playdate-bindgen",
 "playdate-bindgen-cfg",
]

[[package]]
name = "playdate-system"
version = "0.3.12"
source = "git+https://github.com/boozook/playdate.git?rev=43f5439cb7a778da56b61dab362ce1fab15fd667#43f5439cb7a778da56b61dab362ce1fab15fd667"
dependencies = [
 "playdate-sys",
]
boozook commented 3 months ago

Seems to you using old SDK and bingen generated bindings for you and it is not compatible because breaking changes in SDK v2.5.0. Isn't it? If so, plz update SDK. Here is new signature of newSampleFromData, and there is old.

paulyoung commented 2 months ago

That was it. Thanks!