Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't generate proto files without package name #57

Open
osztenkurden opened this issue Aug 2, 2024 · 3 comments
Open

Can't generate proto files without package name #57

osztenkurden opened this issue Aug 2, 2024 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@osztenkurden
Copy link

Overall, love the generator, and the only thing that stumbled me was the fact that I can't generate zig files from protos without "package" directive.

Currently working on game data parser, and protos look like this:

import "networkbasetypes.proto";
import "usercmd.proto";

message CSGOInterpolationInfoPB {
	optional int32 src_tick = 1 [default = -1];
	optional int32 dst_tick = 2 [default = -1];
	optional float frac = 3 [default = 0];
}

message CSGOInputHistoryEntryPB {
	optional .CMsgQAngle view_angles = 2;
	optional int32 render_tick_count = 4;
	optional float render_tick_fraction = 5;
	optional int32 player_tick_count = 6;
	optional float player_tick_fraction = 7;
	optional .CSGOInterpolationInfoPB cl_interp = 12;
	optional .CSGOInterpolationInfoPB sv_interp0 = 13;
	optional .CSGOInterpolationInfoPB sv_interp1 = 14;
	optional .CSGOInterpolationInfoPB player_interp = 15;
	optional int32 frame_number = 20;
	optional int32 target_ent_index = 8 [default = -1];
	optional .CMsgVector shoot_position = 3;
	optional .CMsgVector target_head_pos_check = 9;
	optional .CMsgVector target_abs_pos_check = 10;
	optional .CMsgQAngle target_abs_ang_check = 11;
}

...

So, no package name. To make it work, Im adding package name by hand, and then I have to also remove dots from the field types on messages (so optional .CSGOInterpolationInfoPB cl_interp = 12; will become optional CSGOInterpolationInfoPB cl_interp = 12;). I'm trying currently to make it work on the fork of the project, but I'm quite new to zig, so it's not going super fast

@Arwalk
Copy link
Owner

Arwalk commented Aug 2, 2024

Hello there, thanks for your interest and issue.

Overall, love the generator, and the only thing that stumbled me was the fact that I can't generate zig files from protos without "package" directive.

I think we inherited this behaviour from the original generator that served as basis of this one. It was a go-based one, and it required packages. I'll take a look into it to know if i can find a workaround about this.

I have to also remove dots from the field types on messages

Looking a the proto language spec :

image

It would seem that a dot is allowed before a type name, for some reason. It's also allowed for inner messages, i think. I'll have to look into that, and handle at least properly the beginning dot.

Thank you again.

@osztenkurden
Copy link
Author

Thanks, ill try tweaking through the weekend and try to make a PR, but I dont think it will be fast

@osztenkurden
Copy link
Author

PR #58 created, still WIP, but I'd appreciate veryfing if it doesn't break existing protos

@Arwalk Arwalk added this to the v1.1.0 milestone Aug 6, 2024
@Arwalk Arwalk added the bug Something isn't working label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants